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

convert failed with pytorch 0.2.0 #35

Open
Royzon opened this issue Jan 2, 2019 · 1 comment
Open

convert failed with pytorch 0.2.0 #35

Royzon opened this issue Jan 2, 2019 · 1 comment

Comments

@Royzon
Copy link

Royzon commented Jan 2, 2019

there are some problems when i convert pytorch mobilefacenet to ncnn model, the pytorch version is just the 0.2.0, can anybody here give me some suggestions?

Traceback (most recent call last):
File "/media/roy/data/MyDocuments/src/tools/PytorchConverter/code/run.py", line 93, in
pytorch_net.load_state_dict(torch.load(model_path, map_location=lambda storage, loc: storage))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 769, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for MobileFaceNet:
Missing key(s) in state_dict: "conv1.conv.weight", "conv1.bn.running_var", "conv1.bn.bias", "conv1.bn.weight", "conv1.bn.running_mean", "conv1.prelu.weight", "conv2_dw.conv.weight", "conv2_dw.bn.running_var", "conv2_dw.bn.bias", "conv2_dw.bn.weight", "conv2_dw.bn.running_mean", "conv2_dw.prelu.weight", "conv_23.conv.conv.weight", "conv_23.conv.bn.running_var", "conv_23.conv.bn.bias", "conv_23.conv.bn.weight", "conv_23.conv.bn.running_mean", "conv_23.conv.prelu.weight", "conv_23.conv_dw.conv.weight", "conv_23.conv_dw.bn.running_var", "conv_23.conv_dw.bn.bias", "conv_23.conv_dw.bn.weight", "conv_23.conv_dw.bn.running_mean", "conv_23.conv_dw.prelu.weight", "conv_23.project.conv.weight", "conv_23.project.bn.running_var", "conv_23.project.bn.bias", "conv_23.project.bn.weight", "conv_23.project.bn.running_mean", "conv_3.model.0.conv.conv.weight", "conv_3.model.0.conv.bn.running_var", "conv_3.model.0.conv.bn.bias", "conv_3.model.0.conv.bn.weight", "conv_3.model.0.conv.bn.running_mean", "conv_3.model.0.conv.prelu.weight", "conv_3.model.0.conv_dw.conv.weight", "conv_3.model.0.conv_dw.bn.running_var", "conv_3.model.0.conv_dw.bn.bias", "conv_3.model.0.conv_dw.bn.weight", "conv_3.model.0.conv_dw.bn.running_mean", "conv_3.model.0.conv_dw.prelu.weight", "conv_3.model.0.project.conv.weight", "conv_3.model.0.project.bn.running_var", "conv_3.model.0.project.bn.bias", "conv_3.model.0.project.bn.weight", "conv_3.model.0.project.bn.running_mean", "conv_3.model.1.conv.conv.weight", "conv_3.model.1.conv.bn.running_var", "conv_3.model.1.conv.bn.bias", "conv_3.model.1.conv.bn.weight", "conv_3.model.1.conv.bn.running_mean", "conv_3.model.1.conv.prelu.weight", "conv_3.model.1.conv_dw.conv.weight", "conv_3.model.1.conv_dw.bn.running_var", "conv_3.model.1.conv_dw.bn.bias", "conv_3.model.1.conv_dw.bn.weight", "conv_3.model.1.conv_dw.bn.running_mean", "conv_3.model.1.conv_dw.prelu.weight", "conv_3.model.1.project.conv.weight", "conv_3.model.1.project.bn.running_var", "conv_3.model.1.project.bn.bias", "conv_3.model.1.project.bn.weight", "conv_3.model.1.project.bn.running_mean", "conv_3.model.2.conv.conv.weight", "conv_3.model.2.conv.bn.running_var", "conv_3.model.2.conv.bn.bias", "conv_3.model.2.conv.bn.weight", "conv_3.model.2.conv.bn.running_mean", "conv_3.model.2.conv.prelu.weight", "conv_3.model.2.conv_dw.conv.weight", "conv_3.model.2.conv_dw.bn.running_var", "conv_3.model.2.conv_dw.bn.bias", "conv_3.model.2.conv_dw.bn.weight", "conv_3.model.2.conv_dw.bn.running_mean", "conv_3.model.2.conv_dw.prelu.weight", "conv_3.model.2.project.conv.weight", "conv_3.model.2.project.bn.running_var", "conv_3.model.2.project.bn.bias", "conv_3.model.2.project.bn.weight", "conv_3.model.2.project.bn.running_mean", "conv_3.model.3.conv.conv.weight", "conv_3.model.3.conv.bn.running_var", "conv_3.model.3.conv.bn.bias", "conv_3.model.3.conv.bn.weight", "conv_3.model.3.conv.bn.running_mean", "conv_3.model.3.conv.prelu.weight", "conv_3.model.3.conv_dw.conv.weight", "conv_3.model.3.conv_dw.bn.running_var", "conv_3.model.3.conv_dw.bn.bias", "conv_3.model.3.conv_dw.bn.weight", "conv_3.model.3.conv_dw.bn.running_mean", "conv_3.model.3.conv_dw.prelu.weight", "conv_3.model.3.project.conv.weight", "conv_3.model.3.project.bn.running_var", "conv_3.model.3.project.bn.bias", "conv_3.model.3.project.bn.weight", "conv_3.model.3.project.bn.running_mean", "conv_34.conv.conv.weight", "conv_34.conv.bn.running_var", "conv_34.conv.bn.bias", "conv_34.conv.bn.weight", "conv_34.conv.bn.running_mean", "conv_34.conv.prelu.weight", "conv_34.conv_dw.conv.weight", "conv_34.conv_dw.bn.running_var", "conv_34.conv_dw.bn.bias", "conv_34.conv_dw.bn.weight", "conv_34.conv_dw.bn.running_mean", "conv_34.conv_dw.prelu.weight", "conv_34.project.conv.weight", "conv_34.project.bn.running_var", "conv_34.project.bn.bias", "conv_34.project.bn.weight", "conv_34.project.bn.running_mean", "conv_4.model.0.conv.conv.weight", "conv_4.model.0.conv.bn.running_var", "conv_4.model.0.conv.bn.bias", "conv_4.model.0.conv.bn.weight", "conv_4.model.0.conv.bn.running_mean", "conv_4.model.0.conv.prelu.weight", "conv_4.model.0.conv_dw.conv.weight", "conv_4.model.0.conv_dw.bn.running_var", "conv_4.model.0.conv_dw.bn.bias", "conv_4.model.0.conv_dw.bn.weight", "conv_4.model.0.conv_dw.bn.running_mean", "conv_4.model.0.conv_dw.prelu.weight", "conv_4.model.0.project.conv.weight", "conv_4.model.0.project.bn.running_var", "conv_4.model.0.project.bn.bias", "conv_4.model.0.project.bn.weight", "conv_4.model.0.project.bn.running_mean", "conv_4.model.1.conv.conv.weight", "conv_4.model.1.conv.bn.running_var", "conv_4.model.1.conv.bn.bias", "conv_4.model.1.conv.bn.weight", "conv_4.model.1.conv.bn.running_mean", "conv_4.model.1.conv.prelu.weight", "conv_4.model.1.conv_dw.conv.weight", "conv_4.model.1.conv_dw.bn.running_var", "conv_4.model.1.conv_dw.bn.bias", "conv_4.model.1.conv_dw.bn.weight", "conv_4.model.1.conv_dw.bn.running_mean", "conv_4.model.1.conv_dw.prelu.weight", "conv_4.model.1.project.conv.weight", "conv_4.model.1.project.bn.running_var", "conv_4.model.1.project.bn.bias", "conv_4.model.1.project.bn.weight", "conv_4.model.1.project.bn.running_mean", "conv_4.model.2.conv.conv.weight", "conv_4.model.2.conv.bn.running_var", "conv_4.model.2.conv.bn.bias", "conv_4.model.2.conv.bn.weight", "conv_4.model.2.conv.bn.running_mean", "conv_4.model.2.conv.prelu.weight", "conv_4.model.2.conv_dw.conv.weight", "conv_4.model.2.conv_dw.bn.running_var", "conv_4.model.2.conv_dw.bn.bias", "conv_4.model.2.conv_dw.bn.weight", "conv_4.model.2.conv_dw.bn.running_mean", "conv_4.model.2.conv_dw.prelu.weight", "conv_4.model.2.project.conv.weight", "conv_4.model.2.project.bn.running_var", "conv_4.model.2.project.bn.bias", "conv_4.model.2.project.bn.weight", "conv_4.model.2.project.bn.running_mean", "conv_4.model.3.conv.conv.weight", "conv_4.model.3.conv.bn.running_var", "conv_4.model.3.conv.bn.bias", "conv_4.model.3.conv.bn.weight", "conv_4.model.3.conv.bn.running_mean", "conv_4.model.3.conv.prelu.weight", "conv_4.model.3.conv_dw.conv.weight", "conv_4.model.3.conv_dw.bn.running_var", "conv_4.model.3.conv_dw.bn.bias", "conv_4.model.3.conv_dw.bn.weight", "conv_4.model.3.conv_dw.bn.running_mean", "conv_4.model.3.conv_dw.prelu.weight", "conv_4.model.3.project.conv.weight", "conv_4.model.3.project.bn.running_var", "conv_4.model.3.project.bn.bias", "conv_4.model.3.project.bn.weight", "conv_4.model.3.project.bn.running_mean", "conv_4.model.4.conv.conv.weight", "conv_4.model.4.conv.bn.running_var", "conv_4.model.4.conv.bn.bias", "conv_4.model.4.conv.bn.weight", "conv_4.model.4.conv.bn.running_mean", "conv_4.model.4.conv.prelu.weight", "conv_4.model.4.conv_dw.conv.weight", "conv_4.model.4.conv_dw.bn.running_var", "conv_4.model.4.conv_dw.bn.bias", "conv_4.model.4.conv_dw.bn.weight", "conv_4.model.4.conv_dw.bn.running_mean", "conv_4.model.4.conv_dw.prelu.weight", "conv_4.model.4.project.conv.weight", "conv_4.model.4.project.bn.running_var", "conv_4.model.4.project.bn.bias", "conv_4.model.4.project.bn.weight", "conv_4.model.4.project.bn.running_mean", "conv_4.model.5.conv.conv.weight", "conv_4.model.5.conv.bn.running_var", "conv_4.model.5.conv.bn.bias", "conv_4.model.5.conv.bn.weight", "conv_4.model.5.conv.bn.running_mean", "conv_4.model.5.conv.prelu.weight", "conv_4.model.5.conv_dw.conv.weight", "conv_4.model.5.conv_dw.bn.running_var", "conv_4.model.5.conv_dw.bn.bias", "conv_4.model.5.conv_dw.bn.weight", "conv_4.model.5.conv_dw.bn.running_mean", "conv_4.model.5.conv_dw.prelu.weight", "conv_4.model.5.project.conv.weight", "conv_4.model.5.project.bn.running_var", "conv_4.model.5.project.bn.bias", "conv_4.model.5.project.bn.weight", "conv_4.model.5.project.bn.running_mean", "conv_45.conv.conv.weight", "conv_45.conv.bn.running_var", "conv_45.conv.bn.bias", "conv_45.conv.bn.weight", "conv_45.conv.bn.running_mean", "conv_45.conv.prelu.weight", "conv_45.conv_dw.conv.weight", "conv_45.conv_dw.bn.running_var", "conv_45.conv_dw.bn.bias", "conv_45.conv_dw.bn.weight", "conv_45.conv_dw.bn.running_mean", "conv_45.conv_dw.prelu.weight", "conv_45.project.conv.weight", "conv_45.project.bn.running_var", "conv_45.project.bn.bias", "conv_45.project.bn.weight", "conv_45.project.bn.running_mean", "conv_5.model.0.conv.conv.weight", "conv_5.model.0.conv.bn.running_var", "conv_5.model.0.conv.bn.bias", "conv_5.model.0.conv.bn.weight", "conv_5.model.0.conv.bn.running_mean", "conv_5.model.0.conv.prelu.weight", "conv_5.model.0.conv_dw.conv.weight", "conv_5.model.0.conv_dw.bn.running_var", "conv_5.model.0.conv_dw.bn.bias", "conv_5.model.0.conv_dw.bn.weight", "conv_5.model.0.conv_dw.bn.running_mean", "conv_5.model.0.conv_dw.prelu.weight", "conv_5.model.0.project.conv.weight", "conv_5.model.0.project.bn.running_var", "conv_5.model.0.project.bn.bias", "conv_5.model.0.project.bn.weight", "conv_5.model.0.project.bn.running_mean", "conv_5.model.1.conv.conv.weight", "conv_5.model.1.conv.bn.running_var", "conv_5.model.1.conv.bn.bias", "conv_5.model.1.conv.bn.weight", "conv_5.model.1.conv.bn.running_mean", "conv_5.model.1.conv.prelu.weight", "conv_5.model.1.conv_dw.conv.weight", "conv_5.model.1.conv_dw.bn.running_var", "conv_5.model.1.conv_dw.bn.bias", "conv_5.model.1.conv_dw.bn.weight", "conv_5.model.1.conv_dw.bn.running_mean", "conv_5.model.1.conv_dw.prelu.weight", "conv_5.model.1.project.conv.weight", "conv_5.model.1.project.bn.running_var", "conv_5.model.1.project.bn.bias", "conv_5.model.1.project.bn.weight", "conv_5.model.1.project.bn.running_mean", "conv_6_sep.conv.weight", "conv_6_sep.bn.running_var", "conv_6_sep.bn.bias", "conv_6_sep.bn.weight", "conv_6_sep.bn.running_mean", "conv_6_sep.prelu.weight", "conv_6_dw.conv.weight", "conv_6_dw.bn.running_var", "conv_6_dw.bn.bias", "conv_6_dw.bn.weight", "conv_6_dw.bn.running_mean", "linear.weight", "bn.running_var", "bn.bias", "bn.weight", "bn.running_mean".
Unexpected key(s) in state_dict: "module.conv1.conv.weight", "module.conv1.bn.weight", "module.conv1.bn.bias", "module.conv1.bn.running_mean", "module.conv1.bn.running_var", "module.conv1.bn.num_batches_tracked", "module.conv1.prelu.weight", "module.conv2_dw.conv.weight", "module.conv2_dw.bn.weight", "module.conv2_dw.bn.bias", "module.conv2_dw.bn.running_mean", "module.conv2_dw.bn.running_var", "module.conv2_dw.bn.num_batches_tracked", "module.conv2_dw.prelu.weight", "module.conv_23.conv.conv.weight", "module.conv_23.conv.bn.weight", "module.conv_23.conv.bn.bias", "module.conv_23.conv.bn.running_mean", "module.conv_23.conv.bn.running_var", "module.conv_23.conv.bn.num_batches_tracked", "module.conv_23.conv.prelu.weight", "module.conv_23.conv_dw.conv.weight", "module.conv_23.conv_dw.bn.weight", "module.conv_23.conv_dw.bn.bias", "module.conv_23.conv_dw.bn.running_mean", "module.conv_23.conv_dw.bn.running_var", "module.conv_23.conv_dw.bn.num_batches_tracked", "module.conv_23.conv_dw.prelu.weight", "module.conv_23.project.conv.weight", "module.conv_23.project.bn.weight", "module.conv_23.project.bn.bias", "module.conv_23.project.bn.running_mean", "module.conv_23.project.bn.running_var", "module.conv_23.project.bn.num_batches_tracked", "module.conv_3.model.0.conv.conv.weight", "module.conv_3.model.0.conv.bn.weight", "module.conv_3.model.0.conv.bn.bias", "module.conv_3.model.0.conv.bn.running_mean", "module.conv_3.model.0.conv.bn.running_var", "module.conv_3.model.0.conv.bn.num_batches_tracked", "module.conv_3.model.0.conv.prelu.weight", "module.conv_3.model.0.conv_dw.conv.weight", "module.conv_3.model.0.conv_dw.bn.weight", "module.conv_3.model.0.conv_dw.bn.bias", "module.conv_3.model.0.conv_dw.bn.running_mean", "module.conv_3.model.0.conv_dw.bn.running_var", "module.conv_3.model.0.conv_dw.bn.num_batches_tracked", "module.conv_3.model.0.conv_dw.prelu.weight", "module.conv_3.model.0.project.conv.weight", "module.conv_3.model.0.project.bn.weight", "module.conv_3.model.0.project.bn.bias", "module.conv_3.model.0.project.bn.running_mean", "module.conv_3.model.0.project.bn.running_var", "module.conv_3.model.0.project.bn.num_batches_tracked", "module.conv_3.model.1.conv.conv.weight", "module.conv_3.model.1.conv.bn.weight", "module.conv_3.model.1.conv.bn.bias", "module.conv_3.model.1.conv.bn.running_mean", "module.conv_3.model.1.conv.bn.running_var", "module.conv_3.model.1.conv.bn.num_batches_tracked", "module.conv_3.model.1.conv.prelu.weight", "module.conv_3.model.1.conv_dw.conv.weight", "module.conv_3.model.1.conv_dw.bn.weight", "module.conv_3.model.1.conv_dw.bn.bias", "module.conv_3.model.1.conv_dw.bn.running_mean", "module.conv_3.model.1.conv_dw.bn.running_var", "module.conv_3.model.1.conv_dw.bn.num_batches_tracked", "module.conv_3.model.1.conv_dw.prelu.weight", "module.conv_3.model.1.project.conv.weight", "module.conv_3.model.1.project.bn.weight", "module.conv_3.model.1.project.bn.bias", "module.conv_3.model.1.project.bn.running_mean", "module.conv_3.model.1.project.bn.running_var", "module.conv_3.model.1.project.bn.num_batches_tracked", "module.conv_3.model.2.conv.conv.weight", "module.conv_3.model.2.conv.bn.weight", "module.conv_3.model.2.conv.bn.bias", "module.conv_3.model.2.conv.bn.running_mean", "module.conv_3.model.2.conv.bn.running_var", "module.conv_3.model.2.conv.bn.num_batches_tracked", "module.conv_3.model.2.conv.prelu.weight", "module.conv_3.model.2.conv_dw.conv.weight", "module.conv_3.model.2.conv_dw.bn.weight", "module.conv_3.model.2.conv_dw.bn.bias", "module.conv_3.model.2.conv_dw.bn.running_mean", "module.conv_3.model.2.conv_dw.bn.running_var", "module.conv_3.model.2.conv_dw.bn.num_batches_tracked", "module.conv_3.model.2.conv_dw.prelu.weight", "module.conv_3.model.2.project.conv.weight", "module.conv_3.model.2.project.bn.weight", "module.conv_3.model.2.project.bn.bias", "module.conv_3.model.2.project.bn.running_mean", "module.conv_3.model.2.project.bn.running_var", "module.conv_3.model.2.project.bn.num_batches_tracked", "module.conv_3.model.3.conv.conv.weight", "module.conv_3.model.3.conv.bn.weight", "module.conv_3.model.3.conv.bn.bias", "module.conv_3.model.3.conv.bn.running_mean", "module.conv_3.model.3.conv.bn.running_var", "module.conv_3.model.3.conv.bn.num_batches_tracked", "module.conv_3.model.3.conv.prelu.weight", "module.conv_3.model.3.conv_dw.conv.weight", "module.conv_3.model.3.conv_dw.bn.weight", "module.conv_3.model.3.conv_dw.bn.bias", "module.conv_3.model.3.conv_dw.bn.running_mean", "module.conv_3.model.3.conv_dw.bn.running_var", "module.conv_3.model.3.conv_dw.bn.num_batches_tracked", "module.conv_3.model.3.conv_dw.prelu.weight", "module.conv_3.model.3.project.conv.weight", "module.conv_3.model.3.project.bn.weight", "module.conv_3.model.3.project.bn.bias", "module.conv_3.model.3.project.bn.running_mean", "module.conv_3.model.3.project.bn.running_var", "module.conv_3.model.3.project.bn.num_batches_tracked", "module.conv_34.conv.conv.weight", "module.conv_34.conv.bn.weight", "module.conv_34.conv.bn.bias", "module.conv_34.conv.bn.running_mean", "module.conv_34.conv.bn.running_var", "module.conv_34.conv.bn.num_batches_tracked", "module.conv_34.conv.prelu.weight", "module.conv_34.conv_dw.conv.weight", "module.conv_34.conv_dw.bn.weight", "module.conv_34.conv_dw.bn.bias", "module.conv_34.conv_dw.bn.running_mean", "module.conv_34.conv_dw.bn.running_var", "module.conv_34.conv_dw.bn.num_batches_tracked", "module.conv_34.conv_dw.prelu.weight", "module.conv_34.project.conv.weight", "module.conv_34.project.bn.weight", "module.conv_34.project.bn.bias", "module.conv_34.project.bn.running_mean", "module.conv_34.project.bn.running_var", "module.conv_34.project.bn.num_batches_tracked", "module.conv_4.model.0.conv.conv.weight", "module.conv_4.model.0.conv.bn.weight", "module.conv_4.model.0.conv.bn.bias", "module.conv_4.model.0.conv.bn.running_mean", "module.conv_4.model.0.conv.bn.running_var", "module.conv_4.model.0.conv.bn.num_batches_tracked", "module.conv_4.model.0.conv.prelu.weight", "module.conv_4.model.0.conv_dw.conv.weight", "module.conv_4.model.0.conv_dw.bn.weight", "module.conv_4.model.0.conv_dw.bn.bias", "module.conv_4.model.0.conv_dw.bn.running_mean", "module.conv_4.model.0.conv_dw.bn.running_var", "module.conv_4.model.0.conv_dw.bn.num_batches_tracked", "module.conv_4.model.0.conv_dw.prelu.weight", "module.conv_4.model.0.project.conv.weight", "module.conv_4.model.0.project.bn.weight", "module.conv_4.model.0.project.bn.bias", "module.conv_4.model.0.project.bn.running_mean", "module.conv_4.model.0.project.bn.running_var", "module.conv_4.model.0.project.bn.num_batches_tracked", "module.conv_4.model.1.conv.conv.weight", "module.conv_4.model.1.conv.bn.weight", "module.conv_4.model.1.conv.bn.bias", "module.conv_4.model.1.conv.bn.running_mean", "module.conv_4.model.1.conv.bn.running_var", "module.conv_4.model.1.conv.bn.num_batches_tracked", "module.conv_4.model.1.conv.prelu.weight", "module.conv_4.model.1.conv_dw.conv.weight", "module.conv_4.model.1.conv_dw.bn.weight", "module.conv_4.model.1.conv_dw.bn.bias", "module.conv_4.model.1.conv_dw.bn.running_mean", "module.conv_4.model.1.conv_dw.bn.running_var", "module.conv_4.model.1.conv_dw.bn.num_batches_tracked", "module.conv_4.model.1.conv_dw.prelu.weight", "module.conv_4.model.1.project.conv.weight", "module.conv_4.model.1.project.bn.weight", "module.conv_4.model.1.project.bn.bias", "module.conv_4.model.1.project.bn.running_mean", "module.conv_4.model.1.project.bn.running_var", "module.conv_4.model.1.project.bn.num_batches_tracked", "module.conv_4.model.2.conv.conv.weight", "module.conv_4.model.2.conv.bn.weight", "module.conv_4.model.2.conv.bn.bias", "module.conv_4.model.2.conv.bn.running_mean", "module.conv_4.model.2.conv.bn.running_var", "module.conv_4.model.2.conv.bn.num_batches_tracked", "module.conv_4.model.2.conv.prelu.weight", "module.conv_4.model.2.conv_dw.conv.weight", "module.conv_4.model.2.conv_dw.bn.weight", "module.conv_4.model.2.conv_dw.bn.bias", "module.conv_4.model.2.conv_dw.bn.running_mean", "module.conv_4.model.2.conv_dw.bn.running_var", "module.conv_4.model.2.conv_dw.bn.num_batches_tracked", "module.conv_4.model.2.conv_dw.prelu.weight", "module.conv_4.model.2.project.conv.weight", "module.conv_4.model.2.project.bn.weight", "module.conv_4.model.2.project.bn.bias", "module.conv_4.model.2.project.bn.running_mean", "module.conv_4.model.2.project.bn.running_var", "module.conv_4.model.2.project.bn.num_batches_tracked", "module.conv_4.model.3.conv.conv.weight", "module.conv_4.model.3.conv.bn.weight", "module.conv_4.model.3.conv.bn.bias", "module.conv_4.model.3.conv.bn.running_mean", "module.conv_4.model.3.conv.bn.running_var", "module.conv_4.model.3.conv.bn.num_batches_tracked", "module.conv_4.model.3.conv.prelu.weight", "module.conv_4.model.3.conv_dw.conv.weight", "module.conv_4.model.3.conv_dw.bn.weight", "module.conv_4.model.3.conv_dw.bn.bias", "module.conv_4.model.3.conv_dw.bn.running_mean", "module.conv_4.model.3.conv_dw.bn.running_var", "module.conv_4.model.3.conv_dw.bn.num_batches_tracked", "module.conv_4.model.3.conv_dw.prelu.weight", "module.conv_4.model.3.project.conv.weight", "module.conv_4.model.3.project.bn.weight", "module.conv_4.model.3.project.bn.bias", "module.conv_4.model.3.project.bn.running_mean", "module.conv_4.model.3.project.bn.running_var", "module.conv_4.model.3.project.bn.num_batches_tracked", "module.conv_4.model.4.conv.conv.weight", "module.conv_4.model.4.conv.bn.weight", "module.conv_4.model.4.conv.bn.bias", "module.conv_4.model.4.conv.bn.running_mean", "module.conv_4.model.4.conv.bn.running_var", "module.conv_4.model.4.conv.bn.num_batches_tracked", "module.conv_4.model.4.conv.prelu.weight", "module.conv_4.model.4.conv_dw.conv.weight", "module.conv_4.model.4.conv_dw.bn.weight", "module.conv_4.model.4.conv_dw.bn.bias", "module.conv_4.model.4.conv_dw.bn.running_mean", "module.conv_4.model.4.conv_dw.bn.running_var", "module.conv_4.model.4.conv_dw.bn.num_batches_tracked", "module.conv_4.model.4.conv_dw.prelu.weight", "module.conv_4.model.4.project.conv.weight", "module.conv_4.model.4.project.bn.weight", "module.conv_4.model.4.project.bn.bias", "module.conv_4.model.4.project.bn.running_mean", "module.conv_4.model.4.project.bn.running_var", "module.conv_4.model.4.project.bn.num_batches_tracked", "module.conv_4.model.5.conv.conv.weight", "module.conv_4.model.5.conv.bn.weight", "module.conv_4.model.5.conv.bn.bias", "module.conv_4.model.5.conv.bn.running_mean", "module.conv_4.model.5.conv.bn.running_var", "module.conv_4.model.5.conv.bn.num_batches_tracked", "module.conv_4.model.5.conv.prelu.weight", "module.conv_4.model.5.conv_dw.conv.weight", "module.conv_4.model.5.conv_dw.bn.weight", "module.conv_4.model.5.conv_dw.bn.bias", "module.conv_4.model.5.conv_dw.bn.running_mean", "module.conv_4.model.5.conv_dw.bn.running_var", "module.conv_4.model.5.conv_dw.bn.num_batches_tracked", "module.conv_4.model.5.conv_dw.prelu.weight", "module.conv_4.model.5.project.conv.weight", "module.conv_4.model.5.project.bn.weight", "module.conv_4.model.5.project.bn.bias", "module.conv_4.model.5.project.bn.running_mean", "module.conv_4.model.5.project.bn.running_var", "module.conv_4.model.5.project.bn.num_batches_tracked", "module.conv_45.conv.conv.weight", "module.conv_45.conv.bn.weight", "module.conv_45.conv.bn.bias", "module.conv_45.conv.bn.running_mean", "module.conv_45.conv.bn.running_var", "module.conv_45.conv.bn.num_batches_tracked", "module.conv_45.conv.prelu.weight", "module.conv_45.conv_dw.conv.weight", "module.conv_45.conv_dw.bn.weight", "module.conv_45.conv_dw.bn.bias", "module.conv_45.conv_dw.bn.running_mean", "module.conv_45.conv_dw.bn.running_var", "module.conv_45.conv_dw.bn.num_batches_tracked", "module.conv_45.conv_dw.prelu.weight", "module.conv_45.project.conv.weight", "module.conv_45.project.bn.weight", "module.conv_45.project.bn.bias", "module.conv_45.project.bn.running_mean", "module.conv_45.project.bn.running_var", "module.conv_45.project.bn.num_batches_tracked", "module.conv_5.model.0.conv.conv.weight", "module.conv_5.model.0.conv.bn.weight", "module.conv_5.model.0.conv.bn.bias", "module.conv_5.model.0.conv.bn.running_mean", "module.conv_5.model.0.conv.bn.running_var", "module.conv_5.model.0.conv.bn.num_batches_tracked", "module.conv_5.model.0.conv.prelu.weight", "module.conv_5.model.0.conv_dw.conv.weight", "module.conv_5.model.0.conv_dw.bn.weight", "module.conv_5.model.0.conv_dw.bn.bias", "module.conv_5.model.0.conv_dw.bn.running_mean", "module.conv_5.model.0.conv_dw.bn.running_var", "module.conv_5.model.0.conv_dw.bn.num_batches_tracked", "module.conv_5.model.0.conv_dw.prelu.weight", "module.conv_5.model.0.project.conv.weight", "module.conv_5.model.0.project.bn.weight", "module.conv_5.model.0.project.bn.bias", "module.conv_5.model.0.project.bn.running_mean", "module.conv_5.model.0.project.bn.running_var", "module.conv_5.model.0.project.bn.num_batches_tracked", "module.conv_5.model.1.conv.conv.weight", "module.conv_5.model.1.conv.bn.weight", "module.conv_5.model.1.conv.bn.bias", "module.conv_5.model.1.conv.bn.running_mean", "module.conv_5.model.1.conv.bn.running_var", "module.conv_5.model.1.conv.bn.num_batches_tracked", "module.conv_5.model.1.conv.prelu.weight", "module.conv_5.model.1.conv_dw.conv.weight", "module.conv_5.model.1.conv_dw.bn.weight", "module.conv_5.model.1.conv_dw.bn.bias", "module.conv_5.model.1.conv_dw.bn.running_mean", "module.conv_5.model.1.conv_dw.bn.running_var", "module.conv_5.model.1.conv_dw.bn.num_batches_tracked", "module.conv_5.model.1.conv_dw.prelu.weight", "module.conv_5.model.1.project.conv.weight", "module.conv_5.model.1.project.bn.weight", "module.conv_5.model.1.project.bn.bias", "module.conv_5.model.1.project.bn.running_mean", "module.conv_5.model.1.project.bn.running_var", "module.conv_5.model.1.project.bn.num_batches_tracked", "module.conv_6_sep.conv.weight", "module.conv_6_sep.bn.weight", "module.conv_6_sep.bn.bias", "module.conv_6_sep.bn.running_mean", "module.conv_6_sep.bn.running_var", "module.conv_6_sep.bn.num_batches_tracked", "module.conv_6_sep.prelu.weight", "module.conv_6_dw.conv.weight", "module.conv_6_dw.bn.weight", "module.conv_6_dw.bn.bias", "module.conv_6_dw.bn.running_mean", "module.conv_6_dw.bn.running_var", "module.conv_6_dw.bn.num_batches_tracked", "module.linear.weight", "module.bn.weight", "module.bn.bias", "module.bn.running_mean", "module.bn.running_var", "module.bn.num_batches_tracked".

@Royzon Royzon changed the title convert failed with Unknown layer type…… convert failed with pytorch 0.2.0 Jan 2, 2019
@unanan
Copy link

unanan commented Mar 7, 2019

To load models trained under DataParallel Mode & multi-GPUs, you should modify the code like this:

from collections import OrderedDict

state_dict = torch.load('path/to/YourModel.pth')
new_state_dict = OrderedDict()
for k, v in state_dict.items():
    name = k[7:] # remove `module.`
    new_state_dict[name] = v

pytorch_net.load_state_dict(new_state_dict)

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