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

Errors in loading state_dict for MixNet when trying to run eval.py #9

Open
milech opened this issue Apr 8, 2024 · 2 comments
Open

Comments

@milech
Copy link

milech commented Apr 8, 2024

Running eval.py with 147836backbone.pth, as hardcoded in the eval.py script, for any of the six models (MixFaceNet-M, ShuffleMixFaceNet-M, MixFaceNet-S, ShuffleMixFaceNet-S, MixFaceNet-XS, ShuffleMixFaceNet-XS) throws the following exception:

Exception has occurred: RuntimeError
Error(s) in loading state_dict for MixNet:
	size mismatch for tail.conv.weight: copying a param with shape torch.Size([1024, 200, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 200, 1, 1]).
	size mismatch for tail.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.activ.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.conv.weight: copying a param with shape torch.Size([1024, 1, 7, 7]) from checkpoint, the shape in current model is torch.Size([512, 1, 7, 7]).
	size mismatch for feautre_layer.dw_conv.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.pw_conv.conv.weight: copying a param with shape torch.Size([512, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
  File "/user/mlech/codes/mixfacenets/eval.py", line 31, in <module>
    backbone.load_state_dict(torch.load(os.path.join('models','147836backbone.pth'),map_location=torch.device('cpu')))
RuntimeError: Error(s) in loading state_dict for MixNet:
	size mismatch for tail.conv.weight: copying a param with shape torch.Size([1024, 200, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 200, 1, 1]).
	size mismatch for tail.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for tail.activ.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.conv.weight: copying a param with shape torch.Size([1024, 1, 7, 7]) from checkpoint, the shape in current model is torch.Size([512, 1, 7, 7]).
	size mismatch for feautre_layer.dw_conv.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.dw_conv.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
	size mismatch for feautre_layer.pw_conv.conv.weight: copying a param with shape torch.Size([512, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
@Heatseeker-3
Copy link

Have you got any fix for this? I'm having the same issue.

@milech
Copy link
Author

milech commented May 8, 2024

Not sure whether you're asking me or the author, I haven't tried to fix that.

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