Downloading CoAtNet offline #1950
-
Hello.. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I found these 2 ways but I don't know how to download the model weights. model = timm.create_model(model_name,pretrained=True,pretrained_cfg_overlay=dict(file=saved_weights_path)) So, how can I save the model weights locally? |
Beta Was this translation helpful? Give feedback.
-
Hi @emanalattas You can download model weight via import timm
from huggingface_hub import hf_hub_download
import torch
saved_path = hf_hub_download('timm/coatnet_rmlp_2_rw_224.sw_in12k_ft_in1k', 'pytorch_model.bin', library_name='timm', library_version=timm.__version__)
state_dict = torch.load(saved_path, map_location='cpu') +) I hope this could help you. Thank you. Hankyul |
Beta Was this translation helpful? Give feedback.
-
Thanks Hankyul. I appreciate your reply. But I didn't find this location in my laptop. |
Beta Was this translation helpful? Give feedback.
-
Hi @emanalattas As the Google Colab seems to prohibit browsing specific folders such as You can download model weight to a specific folder e.g., import timm
from huggingface_hub import hf_hub_download
import torch
saved_path = hf_hub_download('timm/coatnet_rmlp_2_rw_224.sw_in12k_ft_in1k', 'pytorch_model.bin', local_dir='/home/', library_name='timm', library_version=timm.__version__)
state_dict = torch.load(saved_path, map_location='cpu') I hope this answer could help you. Thank you. Hankyul. |
Beta Was this translation helpful? Give feedback.
Hi @emanalattas
As the Google Colab seems to prohibit browsing specific folders such as
root
(maybe I'm wrong), you can alternatively save the model weight to your/home/
folder and access it through the file browser.You can download model weight to a specific folder e.g.,
/home/
by setting thelocal_dir
parameter inhf_hub_download(..., local_dir='/home/')
like the below code snippet.I hope th…