[feature request] Add optional 'directory/path' parameter to save available pretrained models.
See original GitHub issueI may be wrong but I could not find any simple way of specifying where the pre-trained models from torchvision.models are saved.
By default, they are saved in the ...\.torch\models\ directory.
It would be very helpful to have an optional parameter to set the download path for the pre-trained models. (something like model_dir parameter in torch.utils.model_zoo.load_url())
If there is an existing way to do this already, please correct me in the comments.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:6 (2 by maintainers)
Top Results From Across the Web
montreal_forced_aligner.models - Montreal Forced Aligner
Source code for montreal_forced_aligner.models ... from typing import TYPE_CHECKING, Collection, Dict, List, Optional, Tuple, Union import requests import ...
Read more >Saving Models to the Model Catalog - Oracle Help Center
You can save a model to the model catalog after you've created it using the ADS SDK, OCI Python SDK, or the OCI...
Read more >torch.hub — PyTorch 1.13 documentation
Pytorch Hub is a pre-trained model repository designed to facilitate research ... kwargs are optional, for models which take positional/keyword arguments.
Read more >07. PyTorch Experiment Tracking - Zero to Mastery Learn ...
And so far we've keep track of them via Python dictionaries. ... PyTorch Transfer Learning we'll download a pretrained model from torchvision.models and ......
Read more >EfficientDet — TAO Toolkit 3.22.05 documentation
-k, --key : The key to load a :code`.tlt` model. Optional Arguments¶. -n, –normalizer : Specify ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The documentation is a bit confusing in this regard, to be honest. As documented here (the same function you mentioned), the
TORCH_HOMEenvironment variable can be used for this. Sincetorchvisionuses this function (e.g., here) models will be downloaded to$TORCH_HOME/models.Still, it feels like a workaround. I agree that a
model_dirargument would be nice in this case.EDIT: I forgot to mention that the
TORCH_MODEL_ZOOenvironment variable can override the above, as can be seen here.I am just coming from issue #2299 , and inclined to agree with adding an extra parameter for controlling the model-path of both downloading and loading.
As @fmassa explained in #2299 , using
TORCH_HOMEmakes our code agnostic to the model-path . After thinking it over, I find it convenient for the novice, as it makes the users don’t need to consider the model-path for both downloading and loading.But it leads to much more inflexibility for those familiar with Pytorch and Python
For this reason, I have worked out a compromise as a temporary solution. (Many codes are following the source codes in
torchvision)For downloading:
Downloading demo
For loading:
Loading demo
Hope it helpful~