DSFD-Pytorch-Inference icon indicating copy to clipboard operation
DSFD-Pytorch-Inference copied to clipboard

Save and load Pytorch models from another directory

Open tanpengshi opened this issue 3 years ago • 1 comments

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?

tanpengshi avatar Nov 07 '22 07:11 tanpengshi

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

hukkelas avatar Nov 11 '22 09:11 hukkelas