Skip to content
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

Save and load Pytorch models from another directory #29

Open
tanpengshi opened this issue Nov 7, 2022 · 1 comment
Open

Save and load Pytorch models from another directory #29

tanpengshi opened this issue Nov 7, 2022 · 1 comment

Comments

@tanpengshi
Copy link

When I run build_detector, the pytorch .pth models were automatically saved in a default directory. How can I save in another directory, and then load model from that directory during model call?

@hukkelas
Copy link
Owner

Model download is done with torch.hub. You can change the save directory by setting the environment variable TORCH_HOME.

If you run

TORCH_HOME=~/Downloads python3 test.py

the model will be saved to ~/Downloads/hub.

You can read more about setting the download directory here:
https://pytorch.org/docs/stable/hub.html#where-are-my-downloaded-models-saved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants