How to load a fine-tuned model with HF trainer script and save it into local #2270
-
model_reloaded = timm.create_model('hf_hub:nateraw/resnet18-random', pretrained=True)
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Whene there are architectures that exist across both timm and transformers like this, the weights are almost always in different formats with different key names, sometimes different structure in terms of nesting and qkv vs q, k, v being separate or fused layers, etc. There's always a way to remap them but you have to have a bit of experience to do that easily (or give Claude the two model impl and ask for a weight translation, it's usually pretty close). |
Beta Was this translation helpful? Give feedback.
'facebook/dinov2-base'
is a transformers model not a timm model,timm
options that work with timm.create_model are:Whene there are architectures that exist across both timm and transformers like this, the weights are almost always in different formats with different key names, sometimes different structure in terms of nesting and qkv vs q, k, v being separate or fused layers, etc. There's always a way to remap them but you have to have a bit of experience to do that easily (or give Claude the two model impl and ask for a weight translation, it's …