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

For vgg16, there are three classifier layers in the provided checkpoint but only one in the model #34

Closed
Hanson13 opened this issue Jul 6, 2019 · 2 comments

Comments

@Hanson13
Copy link

Hanson13 commented Jul 6, 2019

When I am loading the checkpoint of vgg16, which is downloaded from https://download.pytorch.org/models/vgg16-397923af.pth, there is an error:

RuntimeError: Error(s) in loading state_dict for VGG:
Missing key(s) in state_dict: "classifier.weight", "classifier.bias".
Unexpected key(s) in state_dict: "classifier.0.weight", "classifier.0.bias", "classifier.3.weight", "classifier.3.bias", "classifier.6.weight", "classifier.6.bias".

So I find that there are three classifier layers(classifier.0\3\6) in the provided checkpoint but only one classifier layers (classifier) in the model, can anyone tell me why there is a mismatch problem?
Thank you!

@Hanson13 Hanson13 closed this as completed Jul 6, 2019
@Hanson13
Copy link
Author

Hanson13 commented Jul 6, 2019

The pretrained model in the model_url is for imagenet but not cifar10, so there are three fc layers in the checkpoint.

@GShef
Copy link

GShef commented Jul 30, 2023

Hello @Hanson13 , how did u fix this?

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