If you set DEEPFACE_HOME environment variable to the target folder, then deepface will use that folder for weights. If you don't have that env var, then it will use your home folder by default. Corresponding logic can be found here.
DEEPFACE_HOME