How can i change the path of pre-train models cache? #790
-
| I want to change the default cache path | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
| To load a pretrained model timm uses the function  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  | 
Beta Was this translation helpful? Give feedback.
-
| Reference: https://huggingface.co/docs/transformers/v4.38.1/en/installation#cache-setup For version  You can either run the following options: or import os
os.environ["HUGGINGFACE_HUB_CACHE"] = "./your/cache/dir" | 
Beta Was this translation helpful? Give feedback.
To load a pretrained model timm uses the function
load_state_dict_from_url()fromtorch.hubmodule. In the documentation of this function here, you can see that the default path can be retrieved and set using:You can also set the environment variable
TORCH_HOMEas it will point to$TORCH_HOME/hubif set.