-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I'm trying to load pretrained ViTs using timm and huggingface pretrained models offline. I download the pretrained weights from huggingface mannualy. However, when loading pretrained vit_tiny_patch16_224 and vit_small_patch16_224 weights via timm.create_model, I get the following error:
KeyError: 'embedding/kernel is not a file in the archive'.
It seems that the _load_weights function of vision_transformer.py is troublesome.
To Reproduce
Steps to reproduce the behavior:
- Download the pretrained weights (
pytorch.bin) from huggingface and put it into the proper location. - using timm create_model function to load the pretrained weights:
timm.create_model( "vit_tiny_patch16_224", pretrained=True, pretrained_cfg_overlay=dict( file="/home/your_path/.cache/huggingface/hub/models--timm--vit_tiny_patch16_224.augreg_in21k_ft_in1k/pytorch_model.bin") )
Expected behavior
load the pretrained weights successfully.
Desktop (please complete the following information):
- OS: [Ubuntu 22.04]
- pytorch: 1.11.0
- timm: 0.9.12
Lustrewilkin and MyhooSalsa
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
