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

Error of the size mismatch for pos_embed #21

Open
lxn96 opened this issue Mar 8, 2022 · 1 comment
Open

Error of the size mismatch for pos_embed #21

lxn96 opened this issue Mar 8, 2022 · 1 comment
Labels
question Further information is requested

Comments

@lxn96
Copy link

lxn96 commented Mar 8, 2022

We load our pretrained model of vit-base trained with mae method, and we meet the size mismatch for pos_embed. Is there any solution to this problem please?

RuntimeError: Error(s) in loading state_dict for VisionTransformer: size mismatch for pos_embed: copying a param with shape torch.Size([1, 785, 768]) from checkpoint, the shape in current model is torch.Size([1, 578, 768]).

@lxn96 lxn96 added the question Further information is requested label Mar 8, 2022
@Yuxin-CV
Copy link
Member

Yuxin-CV commented Mar 9, 2022

Hello! To my knowledge, MAE uses 2D sin-cos pos embed while YOLOS uses 1D abs learnable pos embed.
I suggest changing the original YOLOS pos embed to MAE's.

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

No branches or pull requests

2 participants