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

How to load weights of Weight Standardization model? #22

Open
mobassir94 opened this issue Jul 16, 2020 · 0 comments
Open

How to load weights of Weight Standardization model? #22

mobassir94 opened this issue Jul 16, 2020 · 0 comments

Comments

@mobassir94
Copy link

using this link : https://github.com/joe-siyuan-qiao/WeightStandardization from pytorch-classification folder i was using resnet50 for a classification task,

here is what i did - copied code from here : https://github.com/joe-siyuan-qiao/pytorch-classification/blob/e6355f829e85ac05a71b8889f4fff77b9ab95d0b/models/imagenet/resnet.py

and did - model = l_resnet50()
now we have resnet50 model that uses gn and ws together but then i was trying to load resnet50 weight file provided by author of that repo

but i get this error :

RuntimeError: Error(s) in loading state_dict for ResNet:
	Missing key(s) in state_dict: "layer3.6.conv1.weight", "layer3.6.bn1.weight", "layer3.6.bn1.bias", "layer3.6.conv2.weight", "layer3.6.bn2.weight", "layer3.6.bn2.bias", "layer3.6.conv3.weight", "layer3.6.bn3.weight", "layer3.6.bn3.bias", "layer3.7.conv1.weight", "layer3.7.bn1.weight", "layer3.7.bn1.bias", "layer3.7.conv2.weight", "layer3.7.bn2.weight", "layer3.7.bn2.bias", "layer3.7.conv3.weight", "layer3.7.bn3.weight", "layer3.7.bn3.bias", "layer3.8.conv1.weight", "layer3.8.bn1.weight", "layer3.8.bn1.bias", "layer3.8.conv2.weight", "layer3.8.bn2.weight", "layer3.8.bn2.bias", "layer3.8.conv3.weight", "layer3.8.bn3.weight", "layer3.8.bn3.bias", "layer3.9.conv1.weight", "layer3.9.bn1.weight", "layer3.9.bn1.bias", "layer3.9.conv2.weight", "layer3.9.bn2.weight", "layer3.9.bn2.bias", "layer3.9.conv3.weight", "layer3.9.bn3.weight", "layer3.9.bn3.bias", "layer3.10.conv1.weight", "layer3.10.bn1.weight", "layer3.10.bn1.bias", "layer3.10.conv2.weight", "layer3.10.bn2.weight", "layer3.10.bn2.bias", "layer3.10.conv3.weight", "layer3.10.bn3.weight", "layer3.10.bn3.bias", "layer3.11.conv1.weight", "layer3.11.bn1.weight", "layer3.11.bn1.bias", "layer3.11.conv2.weight", "layer3.11.bn2.weight", "layer3.11.bn2.bias", "layer3.11.conv3.weight", "layer3.11.bn3.weight", "layer3.11.bn3.bias", "layer3.12.conv1.weight", "layer3.12.bn1.weight", "layer3.12.bn1.bias", "layer3.12.conv2.weight", "layer3.12.bn2.weight", "layer3.12.bn2.bias", "layer3.12.conv3.weight", "layer3.12.bn3.weight", "layer3.12.bn3.bias", "layer3.13.conv1.weight", "layer3.13.bn1.weight", "layer3.13.bn1.bias", "layer3.13.conv2.weight", "layer3.13.bn2.weight", "layer3.13.bn2.bias", "layer3.13.conv3.weight", "layer3.13.bn3.weight", "layer3.13.bn3.bias", "layer3.14.conv1.weight", "layer3.14.bn1.weight", "layer3.14.bn1.bias", "layer3.14.conv2.weight", "layer3.14.bn2.weight", "layer3.14.bn2.bias", "layer3.14.conv3.weight", "layer3.14.bn3.weight", "layer3.14.bn3.bias", "layer3.15.conv1.weight", "layer3.15.bn1.weight", "layer3.15.bn1.bias", "layer3.15.conv2.weight", "layer3.15.bn2.weight", "layer3.15.bn2.bias", "layer3.15.conv3.weight", "layer3.15.bn3.weight", "layer3.15.bn3.bias", "layer3.16.conv1.weight", "layer3.16.bn1.weight", "layer3.16.bn1.bias", "layer3.16.conv2.weight", "layer3.16.bn2.weight", "layer3.16.bn2.bias", "layer3.16.conv3.weight", "layer3.16.bn3.weight", "layer3.16.bn3.bias", "layer3.17.conv1.weight", "layer3.17.bn1.weight", "layer3.17.bn1.bias", "layer3.17.conv2.weight", "layer3.17.bn2.weight", "layer3.17.bn2.bias", "layer3.17.conv3.weight", "layer3.17.bn3.weight", "layer3.17.bn3.bias", "layer3.18.conv1.weight", "layer3.18.bn1.weight", "layer3.18.bn1.bias", "layer3.18.conv2.weight", "layer3.18.bn2.weight", "layer3.18.bn2.bias", "layer3.18.conv3.weight", "layer3.18.bn3.weight", "layer3.18.bn3.bias", "layer3.19.conv1.weight", "layer3.19.bn1.weight", "layer3.19.bn1.bias", "layer3.19.conv2.weight", "layer3.19.bn2.weight", "layer3.19.bn2.bias", "layer3.19.conv3.weight", "layer3.19.bn3.weight", "layer3.19.bn3.bias", "layer3.20.conv1.weight", "layer3.20.bn1.weight", "layer3.20.bn1.bias", "layer3.20.conv2.weight", "layer3.20.bn2.weight", "layer3.20.bn2.bias", "layer3.20.conv3.weight", "layer3.20.bn3.weight", "layer3.20.bn3.bias", "layer3.21.conv1.weight", "layer3.21.bn1.weight", "layer3.21.bn1.bias", "layer3.21.conv2.weight", "layer3.21.bn2.weight", "layer3.21.bn2.bias", "layer3.21.conv3.weight", "layer3.21.bn3.weight", "layer3.21.bn3.bias", "layer3.22.conv1.weight", "layer3.22.bn1.weight", "layer3.22.bn1.bias", "layer3.22.conv2.weight", "layer3.22.bn2.weight", "layer3.22.bn2.bias", "layer3.22.conv3.weight", "layer3.22.bn3.weight", "layer3.22.bn3.bias". 
	Unexpected key(s) in state_dict: "bn1.running_mean", "bn1.running_var", "layer1.0.bn1.running_mean", "layer1.0.bn1.running_var", "layer1.0.bn2.running_mean", "layer1.0.bn2.running_var", "layer1.0.bn3.running_mean", "layer1.0.bn3.running_var", "layer1.0.downsample.1.running_mean", "layer1.0.downsample.1.running_var", "layer1.1.bn1.running_mean", "layer1.1.bn1.running_var", "layer1.1.bn2.running_mean", "layer1.1.bn2.running_var", "layer1.1.bn3.running_mean", "layer1.1.bn3.running_var", "layer1.2.bn1.running_mean", "layer1.2.bn1.running_var", "layer1.2.bn2.running_mean", "layer1.2.bn2.running_var", "layer1.2.bn3.running_mean", "layer1.2.bn3.running_var", "layer2.0.bn1.running_mean", "layer2.0.bn1.running_var", "layer2.0.bn2.running_mean", "layer2.0.bn2.running_var", "layer2.0.bn3.running_mean", "layer2.0.bn3.running_var", "layer2.0.downsample.1.running_mean", "layer2.0.downsample.1.running_var", "layer2.1.bn1.running_mean", "layer2.1.bn1.running_var", "layer2.1.bn2.running_mean", "layer2.1.bn2.running_var", "layer2.1.bn3.running_mean", "layer2.1.bn3.running_var", "layer2.2.bn1.running_mean", "layer2.2.bn1.running_var", "layer2.2.bn2.running_mean", "layer2.2.bn2.running_var", "layer2.2.bn3.running_mean", "layer2.2.bn3.running_var", "layer2.3.bn1.running_mean", "layer2.3.bn1.running_var", "layer2.3.bn2.running_mean", "layer2.3.bn2.running_var", "layer2.3.bn3.running_mean", "layer2.3.bn3.running_var", "layer3.0.bn1.running_mean", "layer3.0.bn1.running_var", "layer3.0.bn2.running_mean", "layer3.0.bn2.running_var", "layer3.0.bn3.running_mean", "layer3.0.bn3.running_var", "layer3.0.downsample.1.running_mean", "layer3.0.downsample.1.running_var", "layer3.1.bn1.running_mean", "layer3.1.bn1.running_var", "layer3.1.bn2.running_mean", "layer3.1.bn2.running_var", "layer3.1.bn3.running_mean", "layer3.1.bn3.running_var", "layer3.2.bn1.running_mean", "layer3.2.bn1.running_var", "layer3.2.bn2.running_mean", "layer3.2.bn2.running_var", "layer3.2.bn3.running_mean", "layer3.2.bn3.running_var", "layer3.3.bn1.running_mean", "layer3.3.bn1.running_var", "layer3.3.bn2.running_mean", "layer3.3.bn2.running_var", "layer3.3.bn3.running_mean", "layer3.3.bn3.running_var", "layer3.4.bn1.running_mean", "layer3.4.bn1.running_var", "layer3.4.bn2.running_mean", "layer3.4.bn2.running_var", "layer3.4.bn3.running_mean", "layer3.4.bn3.running_var", "layer3.5.bn1.running_mean", "layer3.5.bn1.running_var", "layer3.5.bn2.running_mean", "layer3.5.bn2.running_var", "layer3.5.bn3.running_mean", "layer3.5.bn3.running_var", "layer4.0.bn1.running_mean", "layer4.0.bn1.running_var", "layer4.0.bn2.running_mean", "layer4.0.bn2.running_var", "layer4.0.bn3.running_mean", "layer4.0.bn3.running_var", "layer4.0.downsample.1.running_mean", "layer4.0.downsample.1.running_var", "layer4.1.bn1.running_mean", "layer4.1.bn1.running_var", "layer4.1.bn2.running_mean", "layer4.1.bn2.running_var", "layer4.1.bn3.running_mean", "layer4.1.bn3.running_var", "layer4.2.bn1.running_mean", "layer4.2.bn1.running_var", "layer4.2.bn2.running_mean", "layer4.2.bn2.running_var", "layer4.2.bn3.running_mean", "layer4.2.bn3.running_var". 

then i tried loading that weight file into resnet50 model of torchvision and it works fine there, so it is clear that the error coming from modified resnet50 with gn and ws but how do i use pretrained weight of author then? the author shared pretrained weight link in his repo and i can't load that in gn,ws resnet50 model that he designed,i can only use his resnet50 with gn,ws and without the resnet50 weight file he provided,that means i am not able to load weights he shared,where am i making mistakes?

resnet50 weight was collected from here : https://github.com/joe-siyuan-qiao/pytorch-classification/tree/e6355f829e85ac05a71b8889f4fff77b9ab95d0b

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

1 participant