bert.embeddings.word_embeddings的尺寸不匹配。
RuntimeError:bertforrelationExtraction的加载state_dict中的错误: bert.embeddings.word_embeddings的尺寸不匹配。
Traceback (most recent call last):
File "main.py", line 248, in <module>
result = trainer.predict(tokenizer, text, id2label, args, ids)
File "main.py", line 146, in predict
model, optimizer, epoch, loss = self.load_ckp(model, optimizer, checkpoint)
File "main.py", line 38, in load_ckp
model.load_state_dict(checkpoint['state_dict'])
File "C:\Anaconda3\envs\NLP_Research\lib\site-packages\torch\nn\modules\module.py", line 1045, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for BertForRelationExtraction:
size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 768]) from checkpoint, the shape in current model is torch.Size([30522, 768]).
RuntimeError: Error(s) in loading state_dict for BertForRelationExtraction:
size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 768]) from checkpoint, the shape in current model is torch.Size([30522, 768])
Traceback (most recent call last):
File "main.py", line 248, in <module>
result = trainer.predict(tokenizer, text, id2label, args, ids)
File "main.py", line 146, in predict
model, optimizer, epoch, loss = self.load_ckp(model, optimizer, checkpoint)
File "main.py", line 38, in load_ckp
model.load_state_dict(checkpoint['state_dict'])
File "C:\Anaconda3\envs\NLP_Research\lib\site-packages\torch\nn\modules\module.py", line 1045, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for BertForRelationExtraction:
size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 768]) from checkpoint, the shape in current model is torch.Size([30522, 768]).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论