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 when loading state dict #17

Closed
HuiyuanXie opened this issue Jul 13, 2022 · 2 comments
Closed

Size mismatch when loading state dict #17

HuiyuanXie opened this issue Jul 13, 2022 · 2 comments

Comments

@HuiyuanXie
Copy link

Thanks for this amazing work!

I tried running the predict_amrs_from_plaintext.py script but came cross a runtime error. It occurred when loading the state_dict of the checkpoint you released for AMR 3.0 for AMRBartForConditionalGeneration. I saw that you suggested that transformers version < 3 should be used. I experimented version 2.11.0 as suggested in your requirements.txt file, and also version 2.8.0, but the problem persisted. The tokenizers is of version 2.7.0. I was wondering if you have any idea regarding what the reason might be, and how I can fix the problem? Many thanks!

I've attached the full error message below:

RuntimeError: Error(s) in loading state_dict for AMRBartForConditionalGeneration:
size mismatch for final_logits_bias: copying a param with shape torch.Size([1, 53587]) from checkpoint, the shape in current model is torch.Size([1, 53075]).
size mismatch for model.shared.weight: copying a param with shape torch.Size([53587, 1024]) from checkpoint, the shape in current model is torch.Size([53075, 1024]).
size mismatch for model.encoder.embed_tokens.weight: copying a param with shape torch.Size([53587, 1024]) from checkpoint, the shape in current model is torch.Size([53075, 1024]).
size mismatch for model.decoder.embed_tokens.weight: copying a param with shape torch.Size([53587, 1024]) from checkpoint, the shape in current model is torch.Size([53075, 1024]).

@mbevila
Copy link
Collaborator

mbevila commented Jul 18, 2022

Is #4 relevant?

@HuiyuanXie
Copy link
Author

Hi @mbevila , thanks for the useful info! Now I'm able to load the pretrained model weights. Thanks very much for the help!

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