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

load pretrain model issue #29

Closed
zzzmm1 opened this issue Apr 14, 2020 · 5 comments
Closed

load pretrain model issue #29

zzzmm1 opened this issue Apr 14, 2020 · 5 comments

Comments

@zzzmm1
Copy link

zzzmm1 commented Apr 14, 2020

RuntimeError: Error(s) in loading state_dict for Res2Net:
size mismatch for layer1.0.downsample.1.weight: copying a param of torch.Size([256]) from checkpoint, where the shape is torch.Size([256, 64, 1, 1]) in current model.
size mismatch for layer2.0.downsample.1.weight: copying a param of torch.Size([512]) from checkpoint, where the shape is torch.Size([512, 256, 1, 1]) in current model.
size mismatch for layer3.0.downsample.1.weight: copying a param of torch.Size([1024]) from checkpoint, where the shape is torch.Size([1024, 512, 1, 1]) in current model.

when i load res2net50_v1b.pth, i meet this problem, but i can load res2net50_26w_4s.pth pretrain model to train my network.
i guess there is a problem between pytorch version?

pytorch: 0.4.1;
torchvision: 0.2.1
python: 3.6

@gasvn
Copy link
Member

gasvn commented Apr 14, 2020

I guess so. Maybe you can try pytorch>1.0, those models are not trained with pytorch0.4.1.

@gasvn
Copy link
Member

gasvn commented Apr 17, 2020

If the problem still exists, please let me know.

@zzzmm1
Copy link
Author

zzzmm1 commented Apr 17, 2020

I use pytorch 1.4.0 and the problem still exists.

@gasvn
Copy link
Member

gasvn commented Apr 20, 2020

Do you use the res2net_v1b.py file? Or do you add res2net to your existing model? The downsample module in res2netv1b is silightly differenet from res2netv1 and resnet.
You can sent your code to me via email shgao@live.com , maybe I can help you find the problem.

@zzzmm1
Copy link
Author

zzzmm1 commented Apr 20, 2020

I did not use the res2net_v1b.py file, that's the problem.
Now it is ok, thank you for your help.

@zzzmm1 zzzmm1 closed this as completed Apr 20, 2020
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

2 participants