Open dearleiii opened 6 years ago
leichen@gpu-compute2$ python3 load_model_test.py Traceback (most recent call last): File "load_model_test.py", line 28, in <module> model1 = model1.load_state_dict(torch.load('model3_3_cp1.pt')) File "/home/home2/leichen/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 721, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for APXM_conv3: Missing key(s) in state_dict: "main.0.bias", "main.0.weight", "main.2.bias", "main.2.weight", "main.4.weight", "regressor.0.bias", "regressor.0.weight", "regressor.2.bias", "regressor.2.weight". Unexpected key(s) in state_dict: "module.main.0.weight", "module.main.0.bias", "module.main.2.weight", "module.main.2.bias", "module.main.4.weight", "module.regressor.0.weight", "module.regressor.0.bias", "module.regressor.2.weight", "module.regressor.2.bias".
Sol:
https://github.com/kuangliu/torchcv/issues/28
@dearleiii did you get why using torch.nn.DataParallel, the issue gets resolved? I faced the same issue, and the same solution worked for me, but not able to understand the reasoning.