New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to setup the pretrained model locally? #50
Comments
The pretrained weights should only need to be downloaded once, the first time you create a pretrained model. After that, they should be stored in the torch cache locally, so nothing needs to be downloaded subsequent times. However, if the model caching isn't working for you for some reason, the pretrained weights can be downloaded from the links in the table in the repo readme. |
Thank you for your reply. so what is the local cached model file setup ????? |
in other words, which directory should I put these *.pt files in locally? |
The location of the pytorch model cache is different for different systems. It's easiest to just load the state dictionaries into the model in the standard pytorch way. You can loaded the pretrained weights using: from facenet_pytorch import InceptionResnetV1
# For VGGFace2 pretrained weights:
model = InceptionResnetV1(num_classes=8631)
model.load_state_dict(torch.load('<path to .pt file>'))
# For CASIA-webface pretrained weights:
model = InceptionResnetV1(num_classes=10575)
model.load_state_dict(torch.load('<path to .pt file>')) |
If you want to use the pytorch model cache, you will have to download the weights in their split form (they are downloaded in parts). For VGGFace2, download the following files: For CASIA-webface, download the following files: Copy those files into the directory returned by the following shell command: echo $(python -c "from facenet_pytorch.models.inception_resnet_v1 import get_torch_home; print(get_torch_home())")/checkpoints |
thank you. the changing names in your reply works for examples\infer.ipynb. ****Could you please explain the reason why the pt files were renamed that way? originally I just put the .pt files in the right pathto\checkpoints, however it keeps trying to Thank you very much.**** |
The files are named that way so that the data can be versioned. The last 10 characters on the file names are taken from the unique hash generated by Google Drive. |
since the internet is too slow to download and frequently disconnected.
I could get the pretained model files some other way.
so how should I set it up locally?
Thank you!
The text was updated successfully, but these errors were encountered: