RUCAIBox / TextBox

TextBox 2.0 is a text generation library with pre-trained language models
https://github.com/RUCAIBox/TextBox
MIT License
1.07k stars 117 forks source link

加载CPT模型报错 #326

Closed Foehnc closed 1 year ago

Foehnc commented 1 year ago

RuntimeError: Error(s) in loading state_dict for CPTForConditionalGeneration: size mismatch for model.encoder.embeddings.position_ids: copying a param with shape torch.Size([1, 1024]) from checkpoint, the shape in current model is torch.Size([1, 512]). size mismatch for model.encoder.embeddings.position_embeddings.weight: copying a param with shape torch.Size([1024, 1024]) from checkpoint, the shape in current model is torch.Size([512, 1024]). You may consider addingignore_mismatched_sizes=Truein the modelfrom_pretrainedmethod.

加载cpt-base和cpt-large的时候都报这个错,这是不是config文件的维度写错了导致初始化的模型维度和权重维度不匹配

StevenTang1998 commented 1 year ago

你可以更新一下最新的仓库并重新安装,我们最近已经解决了这个问题

Foehnc commented 1 year ago

好的我试下