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 #7

Closed
lwgkzl opened this issue Sep 29, 2021 · 5 comments
Closed

Size mismatch #7

lwgkzl opened this issue Sep 29, 2021 · 5 comments

Comments

@lwgkzl
Copy link

lwgkzl commented Sep 29, 2021

size mismatch for final_logits_bias: copying a param with shape torch.Size([1, 54953]) from checkpoint, the shape in current model is torch.Size([1, 54944]). size mismatch for model.shared.weight: copying a param with shape torch.Size([54953, 512]) from checkpoint, the shape in current model is torch.Size([54944, 512]).
size mismatch for model.encoder.embed_tokens.weight: copying a param with shape torch.Size([54953, 512]) from checkpoint, the shape in current model is torch.Size([54944, 512]).
size mismatch for model.decoder.embed_tokens.weight: copying a param with shape torch.Size([54953, 512]) from checkpoint, the shape in current model is torch.Size([54944, 512]).
size mismatch for lm_head.weight: copying a param with shape torch.Size([54953, 512]) from checkpoint, the shape in current model is torch.Size([54944, 512]).

我把从 https://huggingface.co/lsy641/ESC_Blender_noStrategy/tree/main 的模型放到blend-small文件夹下面之后,运行Python BlenderEmotionalSupport.py 文件, 遇到了这个维度不匹配的错误,请问这是怎么回事呢?

@lwgkzl
Copy link
Author

lwgkzl commented Sep 30, 2021

我使用的是codes文件夹下的代码

@Sahandfer
Copy link
Member

  1. 你先要加载原来的facebook/blenderbot-small,然后在tokenizer上加上所有strategy的tokens,再做model.resize_token_embeddings(len(tokenizer)),然后用torch.load_state把这个checkpoint 加载
  2. 如果你只需要nostrategy的这个模型可以试一试 https://huggingface.co/chujiezheng/blenderbot_small-90M-ESC

@lsy641
Copy link
Collaborator

lsy641 commented Oct 13, 2021

54953 是原词表大小, 54944是在54953基础上加上8个策略token和一个CLS token,所以应该是要resize一个词表。

@lsy641 lsy641 closed this as completed Oct 13, 2021
@lwgkzl
Copy link
Author

lwgkzl commented Nov 29, 2021

谢谢:)

@PHI6kai
Copy link

PHI6kai commented Jun 25, 2022

你搞定了吗?是咋操作的呀

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