Skip to content

How can i change the path of pre-train models cache? #790

Answered by yohann84L
ShawYuan97 asked this question in Q&A
Discussion options

You must be logged in to vote

To load a pretrained model timm uses the function load_state_dict_from_url() from torch.hub module. In the documentation of this function here, you can see that the default path can be retrieved and set using:

import torch
# Get current default folder
print(torch.hub.get_dir())
>>> ~/.cache/torch/hub

# Set to another default folder
torch.hub.set_dir('your/cache/folder')

You can also set the environment variable TORCH_HOME as it will point to $TORCH_HOME/hub if set.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ShawYuan97
Comment options

@ziimiin14
Comment options

Answer selected by ShawYuan97
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants