[FEATURE] timm.create_model() load pretrianed model from local path #2069
Unanswered
ShallJaiden
asked this question in
Q&A
Replies: 2 comments 1 reply
-
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.
0 replies
-
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.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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