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 PoolNet #64

Open
czHappy opened this issue Sep 2, 2020 · 3 comments
Open

RuntimeError: Error(s) in loading state_dict for PoolNet #64

czHappy opened this issue Sep 2, 2020 · 3 comments

Comments

@czHappy
Copy link

czHappy commented Sep 2, 2020

When I run test: python main.py --mode='test' --model='results/run-1/models/final.pth' --test_fold='results/run-1-sal-e' --sal_mode='e'

RuntimeError: Error(s) in loading state_dict for PoolNet:
Unexpected key(s) in state_dict: "block.0.block_in1.0.weight", "block.0.block_in2.0.weight", "block.0.block_mid1.0.0.weight"...
size mismatch for score.score.weight: copying a param with shape torch.Size([1, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([1, 128, 1, 1]).

my environment:
torch=0.4.1
python=3.6.7

When I use pre-trained model of results/run-0/models/final.pth, no errors occur. Were the pre-trained models trained in the same pytorch version?

@czHappy czHappy changed the title RuntimeError RuntimeError: Error(s) in loading state_dict for PoolNet Sep 2, 2020
@Siddharth-Shrivastava7
Copy link

Facing the same issue while testing the pre-trained model of joint training.

torch: 1.6.0
python: 3.6.9

@backseason
Copy link
Owner

Duplicate of #59

@backseason backseason marked this as a duplicate of #59 Sep 4, 2020
@Siddharth-Shrivastava7
Copy link

Thank you, it worked out. Really appreciate your fast response!

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

3 participants