[FEATURE] timm.create_model() load pretrianed model from local path #2069
Replies: 4 comments 7 replies
-
Hi @ShallJaiden (1) You can download the pre-trained weight and find the download path, usually the import timm
model = timm.create_model('resnet50', checkpoint_path='/home/hankyul/.cache/torch/hub/checkpoints/resnet50_a1_0-14fe96d1.pth') Thank you. hankyul |
Beta Was this translation helpful? Give feedback.
-
You can also do this to load the weights as if they were the main pretrained weights (overriding the source from URL or HF hub -> local file), this lets things like features_only or head adaptation to diff # classes work ore easily |
Beta Was this translation helpful? Give feedback.
-
@rwightman #2061 (comment) |
Beta Was this translation helpful? Give feedback.
-
@rwightman |
Beta Was this translation helpful? Give feedback.
-
I tried to load a model checkpoint using timm,
model = timm.create_model( 'mobilenetv2_100', pretrained=True, features_only=True, )
but it only works with intenet connection and pretrained being True. However the machine i work on doesnt have internet access, hence I decided to load it from local, but I dont know if there's a way to do so.
Can you please tell me how to load a pretrained model from local path?
Beta Was this translation helpful? Give feedback.
All reactions