'Is there any way I can use the downloaded pre-trained models for TIMM?

For some reason, I have to use TIMM package offline. But I found that if I use create_model(), for example:

self.img_encoder = timm.create_model("swin_base_patch4_window7_224", pretrained=True)

I would get

http.client.RemoteDisconnected: Remote end closed connection without response

I found the function wanted to fetch the pre-trained model by the URL below, but it failed. https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_base_patch4_window7_224_22kto1k.pth

Can I just download the pre-trained model and load it in my code like in Huggingface? (I have checked the timmdocs but found nothing mentioning this.)



Solution 1:[1]

Yes, you can download all models somewhere local. ( all models can be found in the project's release section).

The on your offline system. put them under:

~/.cache/torch/hub/checkpoints

to be more clear this is the ls return for the mentioned folder on my computer:

tf_efficientdet_d7x-f390b87c.pth
tf_efficientnet_b0_aa-827b6e33.pth
tf_efficientnet_b7_ra-6c08e654.pth

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sadra