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

运行./test.sh时发生报错: #24

Closed
Asuka0002 opened this issue Apr 26, 2021 · 2 comments
Closed

运行./test.sh时发生报错: #24

Asuka0002 opened this issue Apr 26, 2021 · 2 comments

Comments

@Asuka0002
Copy link

你好 我在训练网络完毕之后 将test.py中的m_path改为了结果中最新的checkpoint的地址

但是在运行./test.sh时发生报错:
Traceback (most recent call last):
File "test.py", line 34, in
lm_model, lm_vocab, lm_args = init_model(m_path, gpu, "./model/vocab.txt")
File "test.py", line 28, in init_model
lm_model.load_state_dict(ckpt['model'])
File "/usr/local/anaconda3/envs/GPT/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for BIGLM:
size mismatch for tok_embed.weight: copying a param with shape torch.Size([6410, 768]) from checkpoint, the shape in current model is torch.Size([28781, 768]).
size mismatch for out_proj.weight: copying a param with shape torch.Size([6410, 768]) from checkpoint, the shape in current model is torch.Size([28781, 768]).
size mismatch for out_proj.bias: copying a param with shape torch.Size([6410]) from checkpoint, the shape in current model is torch.Size([28781]).

请问这是什么原因导致的呢?非常感谢

@lipiji
Copy link
Owner

lipiji commented Apr 26, 2021

你好,加载的哪个模型,我看看

@Asuka0002
Copy link
Author

我自己训的一个模型 ,是vocab维度出了问题。 已经解决,非常感谢

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