Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size mismatch error when loading pretrained/finetuned model #10

Open
fazliimam opened this issue Feb 6, 2024 · 1 comment
Open

Size mismatch error when loading pretrained/finetuned model #10

fazliimam opened this issue Feb 6, 2024 · 1 comment

Comments

@fazliimam
Copy link

fazliimam commented Feb 6, 2024

Hi, I get the following error when I try to load the finetune temporal checkpoint vit large model:
RuntimeError: Error(s) in loading state_dict for VisionTransformer: size mismatch for pos_embed: copying a param with shape torch.Size([1, 197, 640]) from checkpoint, the shape in current model is torch.Size([1, 197, 1024]).

I get similar shape mismatch error when I tried loading other saved checkpoints as well

@jayshrivastava0
Copy link

jayshrivastava0 commented Mar 15, 2024

Hi, I was facing the similar problem.

RuntimeError: Error(s) in loading state_dict for GroupChannelsVisionTransformer:
	size mismatch for cls_token: copying a param with shape torch.Size([1, 1, 768]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
	size mismatch for patch_embed.0.proj.weight: copying a param with shape torch.Size([768, 4, 8, 8]) from checkpoint, the shape in current model is torch.Size([1024, 4, 8, 8]).

I looked into the documentation, this error was resolved using ViT Large, instead of ViT base, I believe they have changed the size for ViT Base since this repo used it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants