下载回来模型和data 跑test 的时候报错
Opened this issue · 3 comments
huwei1024 commented
Traceback (most recent call last):
File ".\test.py", line 51, in
main("d:\test.csv", "models/best.pth.tar")
File ".\test.py", line 43, in main
model.load_state_dict(checkpoint["model"])
File "C:\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 1044, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for BertModelTest:
Missing key(s) in state_dict: "bert.bert.embeddings.position_ids".
如何解决?
ruthy-wei commented
你解决了嘛?跟你遇到同意的问题..
monkdou0 commented
same question
yh7109 commented
加一个False就好了
model.load_state_dict(checkpoint["model"], False)