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

模型维度问题 #100

Open
terminator123 opened this issue Jul 27, 2022 · 5 comments
Open

模型维度问题 #100

terminator123 opened this issue Jul 27, 2022 · 5 comments

Comments

@terminator123
Copy link

gpt2模型config里面n_positions=513,会报
size mismatch for transformer.h.0.attn.bias: copying a param with shape torch.Size([1, 1, 512, 512]) from checkpoint, the shape in current model is torch.Size([1, 1, 513, 513]).

改成512后,如果use_gpt2=True,会报
size mismatch for transformer.wpe.weight: copying a param with shape torch.Size([513, 768]) from checkpoint, the shape in current model is torch.Size([512, 768]).

@pppihf
Copy link

pppihf commented Aug 9, 2022

我也遇到这种情况了,请问怎么解决

@terminator123
Copy link
Author

不知道呀,你要是解决了告诉我下

@zhaojunGUO
Copy link

我也是,怎么解决哇

@YuChuXi
Copy link

YuChuXi commented May 13, 2023

tokenizer = tokenizer_class.from_pretrained(checkpoint, do_lower_case=False)  
model = model_class.from_pretrained(checkpoint)  

两句中加入参数 ignore_mismatched_sizes=True 然后忽略报错就好

@YuChuXi
Copy link

YuChuXi commented May 13, 2023

不用动模型的配置文件

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

4 participants