DSFD-Pytorch-Inference
DSFD-Pytorch-Inference copied to clipboard
Save and load Pytorch models from another directory
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?
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