Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Error(s) in loading state_dict for APXM_conv3: Missing key(s) in state_dict: "main.0.bias", #22

Open
dearleiii opened this issue Jul 20, 2018 · 2 comments

Comments

@dearleiii
Copy link
Owner

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".
@dearleiii
Copy link
Owner Author

Sol:

kuangliu/torchcv#28

@ghost
Copy link

ghost commented Apr 9, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant