unexpected key “model.conv1.weight” in state_dict
程序员文章站
2022-05-27 10:32:41
...
被自己都蠢哭了~~
一直报错没有调整过来,以为是key的问题,后来发现是自己导入key的方式有问题,周末要好好研究一下这个 state_dict,以免之后再次出现这种超级低级的错误!!
之前的问题是
unexpected key “model.conv1.weight” in state_dict
其实是我载入模型参数时,我使用的是
model_reid.model.load_state_dict(statedict)
使用方法有误,应该使用
model_reid.load_state_dict(statedict)
这样就会直接去掉model
上一篇: KeyError: ‘unexpected key “module.encoder.embedding.weight” in state_dict’
下一篇: 解决Pytorch下报错Missing key(s) in state_dict: "resnet.conv1.0.weight",和 Unexpected key(s) in state_dict
推荐阅读
-
pytorch加载模型报错Missing key(s) in state_dict: “classifier00.0.fc.weight“, “classifier00.0.fc.bias“
-
unexpected key "module.conv1_1.weight" in state_dict
-
unexpected key "module.encoder.embedding.weight" in state_dict解决方案
-
Missing key(s) in state_dict: “module.resnet50.conv1.weight“
-
Missing key(s) in state_dict: “features.conv1.weight“
-
KeyError: ‘unexpected key “module.encoder.embedding.weight” in state_dict’
-
unexpected key “model.conv1.weight” in state_dict
-
解决Pytorch下报错Missing key(s) in state_dict: "resnet.conv1.0.weight",和 Unexpected key(s) in state_dict
-
Unexpected key(s) in state_dict: “dense_block1.denselayer1.norm.1
-
Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: “module.conv0.weight