OdingdongO/pytorch_classification

KeyError: 'unexpected key "base_model.0.weight" in state_dict'

struggling-man opened this issue · 2 comments

Traceback (most recent call last):
File "/home/sky/work/soft/PycharmProjects/untitled1/BD_XJTU/predict/pred_BDXJTU.py", line 59, in
model.load_state_dict(torch.load(resume))
File "/home/sky/work/environment/python/anaconda/envs/baidu_match/lib/python2.7/site-packages/torch/nn/modules/module.py", line 522, in load_state_dict
.format(name))
KeyError: 'unexpected key "base_model.0.weight" in state_dict'

在预测阶段报的错误,查找了下,这个是模型加载的一个错误,有点迷茫,调试也不太了解原因是什么?有没有大佬跑过的?

这个问题应该是没有更新pred_BDXJTU.py中的模型结构

预测代码已更新