deJQK
June 9, 2018, 1:50pm
6
I am facing the same error, for vgg 13 and 19. These two websites talks about this problem, but I have not yet tested on it. I am not sure about if this applies to vgg 13 also. BTW, vgg11 and 16 does not have this problem.
Once upon a time, I downloaded the vgg models by jonhson and loaded with torchvision.models.vgg16/19 without a problem.
Lately, I pip upgraded torchvision modules, and the same old vgg models fail to load, error goes like:
KeyError: 'unexpected key "classifier.1.weight" in state_dict'
Then I check stat_dict of current upgraded torchvision.models.vgg19, goes like this:
In [5]: v19.state_dict().keys()
Out[5]: odict_keys([‘features.0.weight’, ‘features.0.bias’, ‘features.2.weight’, ‘features.2…
opened 09:26PM - 08 Apr 17 UTC
See https://discuss.pytorch.org/t/upgrading-torchvision-module-makes-old-model-u… seless/1719
The reason this changed was because of https://github.com/pytorch/vision/pull/107 where Sam realized that he put dropout in the wrong location.
So the state_dict needs the names changed appropriately.