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

I inserted some layers into dbpn.py,and it can be trained successfully.But failed to test. #47

Open
yangyingni opened this issue Aug 23, 2019 · 1 comment

Comments

@yangyingni
Copy link

It shows RuntimeError:Error(s) in loading state_dict for Net:
Missing key(s) in state_dict:"feat0.conv.bias","feat0.conv.weight","feat0.conv.act.weight"...........
Unexcepted key(s) in state_dict:"moudle.feat0.conv.weight","moudle.feat0.conv.bias"........

Can you give me some advices?Thank you very much.

@shazib-summar
Copy link

I'm probably a little late to the party, but let me answer this for the future wanderers. When you modify the network by adding/removing a layer or doing anything that modifies the architecture of the network, you are inherently changing the whole model itself.

Simply put, you made a new network. The state dict you're using is for the original model, and hence does not include the parameter entries for your layers. If you wish to test your modified network you will have to train it from scratch (which I wont suggest) or you can use transfer learning (which might save you a lot of time by converging to a lower loss quicker).

You may have to write your own script that initializes the weights of the original layers from the original state dict while using some other parameters initialization method (Glorot, He, Xavier initialization are some of them. Also see this) for the newer layers that you added.

Hope that helps.

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