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

Error loading pretrained model #55

Open
skerit opened this issue May 31, 2020 · 1 comment
Open

Error loading pretrained model #55

skerit opened this issue May 31, 2020 · 1 comment

Comments

@skerit
Copy link

skerit commented May 31, 2020

Just like in issue #21 I get an error when I load the pre-trained RBPN_4x.pth model:

Namespace(chop_forward=False, data_dir='./Vid4', file_list='foliage.txt', future_frame=True, gpu_mode=True, gpus=1, model='weights/RBPN_4x.pth', model_type='RBPN', nFrames=7, other_dataset=True, output='Results/', residual=False, seed=123, testBatchSize=1, threads=1, upscale_factor=4)
===> Loading datasets
===> Building model  RBPN
Traceback (most recent call last):
  File "eval.py", line 67, in <module>
    model.load_state_dict(torch.load(opt.model, map_location=lambda storage, loc: storage))
  File "/home/skerit/projects/miniconda3/envs/py35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 847, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Net:
	Missing key(s) in state_dict: "feat0.conv.bias", "feat0.conv.weight", "feat0.act.weight", "feat1.conv.bias", "feat1.conv.weight", "feat1.act.weight", "DBPN.feat1.conv.bias", "DBPN.feat1.conv.weight", "DBPN.feat1.act.weight", "DBPN.up1.up_conv1.deconv.bias", "DBPN.up1.up_conv1.deconv.weight", "DBPN.up1.up_conv1.act.weight", "DBPN.up1.up_conv2.conv.bias", "DBPN.up1.up_conv2.conv.weight", "DBPN.up1.up_conv2.act.weight", "DBPN.up1.up_conv3.deconv.bias", "DBPN.up1.up_conv3.deconv.weight", "DBPN.up1.up_conv3.act.weight", "DBPN.down1.down_conv1.conv.bias", "DBPN.down1.down_conv1.conv.weight", "DBPN.down1.down_conv1.act.weight", "DBPN.down1.down_conv2.deconv.bias", "DBPN.down1.down_conv2.deconv.weight", "DBPN.down1.down_conv2.act.weight", "DBPN.down1.down_conv3.conv.bias", "DBPN.down1.down_conv3.conv.weight", "DBPN.down1.down_conv3.act.weight", "DBPN.up2.up_conv1.deconv.bias", "DBPN.up2.up_conv1.deconv.weight", "DBPN.up2.up_conv1.act.weight", "DBPN.up2.up_conv2.conv.bias", "DBPN.up2.up_conv2.conv.weight", "DBPN.up2.up_conv2.act.weight", "DBPN.up2.up_conv3.deconv.bias", "DBPN.up2.up_conv3.deconv.weight", "DBPN.up2.up_conv3.act.weight", "DBPN.down2.down_conv1.conv.bias", "DBPN.down2.down_conv1.conv.weight", "DBPN.down2.down_conv1.act.weight", "DBPN.down2.down_conv2.deconv.bias", "DBPN.down2.down_conv2.deconv.weight", "DBPN.down2.down_conv2.act.weight", "DBPN.down2.down_conv3.conv.bias", "DBPN.down2.down_conv3.conv.weight", "DBPN.down2.down_conv3.act.weight", "DBPN.up3.up_conv1.deconv.bias", "DBPN.up3.up_conv1.deconv.weight", "DBPN.up3.up_conv1.act.weight", "DBPN.up3.up_conv2.conv.bias", "DBPN.up3.up_conv2.conv.weight", "DBPN.up3.up_conv2.act.weight", "DBPN.up3.up_conv3.deconv.bias", "DBPN.up3.up_conv3.deconv.weight", "DBPN.up3.up_conv3.act.weight", "DBPN.output.conv.bias", "DBPN.output.conv.weight", "res_feat1.0.conv1.bias", "res_feat1.0.conv1.weight", "res_feat1.0.conv2.bias", "res_feat1.0.conv2.weight", "res_feat1.0.act.weight", "res_feat1.1.conv1.bias", "res_feat1.1.conv1.weight", "res_feat1.1.conv2.bias", "res_feat1.1.conv2.weight", "res_feat1.1.act.weight", "res_feat1.2.conv1.bias", "res_feat1.2.conv1.weight", "res_feat1.2.conv2.bias", "res_feat1.2.conv2.weight", "res_feat1.2.act.weight", "res_feat1.3.conv1.bias", "res_feat1.3.conv1.weight", "res_feat1.3.conv2.bias", "res_feat1.3.conv2.weight", "res_feat1.3.act.weight", "res_feat1.4.conv1.bias", "res_feat1.4.conv1.weight", "res_feat1.4.conv2.bias", "res_feat1.4.conv2.weight", "res_feat1.4.act.weight", "res_feat1.5.deconv.bias", "res_feat1.5.deconv.weight", "res_feat1.5.act.weight", "res_feat2.0.conv1.bias", "res_feat2.0.conv1.weight", "res_feat2.0.conv2.bias", "res_feat2.0.conv2.weight", "res_feat2.0.act.weight", "res_feat2.1.conv1.bias", "res_feat2.1.conv1.weight", "res_feat2.1.conv2.bias", "res_feat2.1.conv2.weight", "res_feat2.1.act.weight", "res_feat2.2.conv1.bias", "res_feat2.2.conv1.weight", "res_feat2.2.conv2.bias", "res_feat2.2.conv2.weight", "res_feat2.2.act.weight", "res_feat2.3.conv1.bias", "res_feat2.3.conv1.weight", "res_feat2.3.conv2.bias", "res_feat2.3.conv2.weight", "res_feat2.3.act.weight", "res_feat2.4.conv1.bias", "res_feat2.4.conv1.weight", "res_feat2.4.conv2.bias", "res_feat2.4.conv2.weight", "res_feat2.4.act.weight", "res_feat2.5.conv.bias", "res_feat2.5.conv.weight", "res_feat2.5.act.weight", "res_feat3.0.conv1.bias", "res_feat3.0.conv1.weight", "res_feat3.0.conv2.bias", "res_feat3.0.conv2.weight", "res_feat3.0.act.weight", "res_feat3.1.conv1.bias", "res_feat3.1.conv1.weight", "res_feat3.1.conv2.bias", "res_feat3.1.conv2.weight", "res_feat3.1.act.weight", "res_feat3.2.conv1.bias", "res_feat3.2.conv1.weight", "res_feat3.2.conv2.bias", "res_feat3.2.conv2.weight", "res_feat3.2.act.weight", "res_feat3.3.conv1.bias", "res_feat3.3.conv1.weight", "res_feat3.3.conv2.bias", "res_feat3.3.conv2.weight", "res_feat3.3.act.weight", "res_feat3.4.conv1.bias", "res_feat3.4.conv1.weight", "res_feat3.4.conv2.bias", "res_feat3.4.conv2.weight", "res_feat3.4.act.weight", "res_feat3.5.conv.bias", "res_feat3.5.conv.weight", "res_feat3.5.act.weight", "output.conv.bias", "output.conv.weight". 
	Unexpected key(s) in state_dict: "module.feat0.conv.weight", "module.feat0.conv.bias", "module.feat0.act.weight", "module.feat1.conv.weight", "module.feat1.conv.bias", "module.feat1.act.weight", "module.DBPN.feat1.conv.weight", "module.DBPN.feat1.conv.bias", "module.DBPN.feat1.act.weight", "module.DBPN.up1.up_conv1.deconv.weight", "module.DBPN.up1.up_conv1.deconv.bias", "module.DBPN.up1.up_conv1.act.weight", "module.DBPN.up1.up_conv2.conv.weight", "module.DBPN.up1.up_conv2.conv.bias", "module.DBPN.up1.up_conv2.act.weight", "module.DBPN.up1.up_conv3.deconv.weight", "module.DBPN.up1.up_conv3.deconv.bias", "module.DBPN.up1.up_conv3.act.weight", "module.DBPN.down1.down_conv1.conv.weight", "module.DBPN.down1.down_conv1.conv.bias", "module.DBPN.down1.down_conv1.act.weight", "module.DBPN.down1.down_conv2.deconv.weight", "module.DBPN.down1.down_conv2.deconv.bias", "module.DBPN.down1.down_conv2.act.weight", "module.DBPN.down1.down_conv3.conv.weight", "module.DBPN.down1.down_conv3.conv.bias", "module.DBPN.down1.down_conv3.act.weight", "module.DBPN.up2.up_conv1.deconv.weight", "module.DBPN.up2.up_conv1.deconv.bias", "module.DBPN.up2.up_conv1.act.weight", "module.DBPN.up2.up_conv2.conv.weight", "module.DBPN.up2.up_conv2.conv.bias", "module.DBPN.up2.up_conv2.act.weight", "module.DBPN.up2.up_conv3.deconv.weight", "module.DBPN.up2.up_conv3.deconv.bias", "module.DBPN.up2.up_conv3.act.weight", "module.DBPN.down2.down_conv1.conv.weight", "module.DBPN.down2.down_conv1.conv.bias", "module.DBPN.down2.down_conv1.act.weight", "module.DBPN.down2.down_conv2.deconv.weight", "module.DBPN.down2.down_conv2.deconv.bias", "module.DBPN.down2.down_conv2.act.weight", "module.DBPN.down2.down_conv3.conv.weight", "module.DBPN.down2.down_conv3.conv.bias", "module.DBPN.down2.down_conv3.act.weight", "module.DBPN.up3.up_conv1.deconv.weight", "module.DBPN.up3.up_conv1.deconv.bias", "module.DBPN.up3.up_conv1.act.weight", "module.DBPN.up3.up_conv2.conv.weight", "module.DBPN.up3.up_conv2.conv.bias", "module.DBPN.up3.up_conv2.act.weight", "module.DBPN.up3.up_conv3.deconv.weight", "module.DBPN.up3.up_conv3.deconv.bias", "module.DBPN.up3.up_conv3.act.weight", "module.DBPN.output.conv.weight", "module.DBPN.output.conv.bias", "module.res_feat1.0.conv1.weight", "module.res_feat1.0.conv1.bias", "module.res_feat1.0.conv2.weight", "module.res_feat1.0.conv2.bias", "module.res_feat1.0.act.weight", "module.res_feat1.1.conv1.weight", "module.res_feat1.1.conv1.bias", "module.res_feat1.1.conv2.weight", "module.res_feat1.1.conv2.bias", "module.res_feat1.1.act.weight", "module.res_feat1.2.conv1.weight", "module.res_feat1.2.conv1.bias", "module.res_feat1.2.conv2.weight", "module.res_feat1.2.conv2.bias", "module.res_feat1.2.act.weight", "module.res_feat1.3.conv1.weight", "module.res_feat1.3.conv1.bias", "module.res_feat1.3.conv2.weight", "module.res_feat1.3.conv2.bias", "module.res_feat1.3.act.weight", "module.res_feat1.4.conv1.weight", "module.res_feat1.4.conv1.bias", "module.res_feat1.4.conv2.weight", "module.res_feat1.4.conv2.bias", "module.res_feat1.4.act.weight", "module.res_feat1.5.deconv.weight", "module.res_feat1.5.deconv.bias", "module.res_feat1.5.act.weight", "module.res_feat2.0.conv1.weight", "module.res_feat2.0.conv1.bias", "module.res_feat2.0.conv2.weight", "module.res_feat2.0.conv2.bias", "module.res_feat2.0.act.weight", "module.res_feat2.1.conv1.weight", "module.res_feat2.1.conv1.bias", "module.res_feat2.1.conv2.weight", "module.res_feat2.1.conv2.bias", "module.res_feat2.1.act.weight", "module.res_feat2.2.conv1.weight", "module.res_feat2.2.conv1.bias", "module.res_feat2.2.conv2.weight", "module.res_feat2.2.conv2.bias", "module.res_feat2.2.act.weight", "module.res_feat2.3.conv1.weight", "module.res_feat2.3.conv1.bias", "module.res_feat2.3.conv2.weight", "module.res_feat2.3.conv2.bias", "module.res_feat2.3.act.weight", "module.res_feat2.4.conv1.weight", "module.res_feat2.4.conv1.bias", "module.res_feat2.4.conv2.weight", "module.res_feat2.4.conv2.bias", "module.res_feat2.4.act.weight", "module.res_feat2.5.conv.weight", "module.res_feat2.5.conv.bias", "module.res_feat2.5.act.weight", "module.res_feat3.0.conv1.weight", "module.res_feat3.0.conv1.bias", "module.res_feat3.0.conv2.weight", "module.res_feat3.0.conv2.bias", "module.res_feat3.0.act.weight", "module.res_feat3.1.conv1.weight", "module.res_feat3.1.conv1.bias", "module.res_feat3.1.conv2.weight", "module.res_feat3.1.conv2.bias", "module.res_feat3.1.act.weight", "module.res_feat3.2.conv1.weight", "module.res_feat3.2.conv1.bias", "module.res_feat3.2.conv2.weight", "module.res_feat3.2.conv2.bias", "module.res_feat3.2.act.weight", "module.res_feat3.3.conv1.weight", "module.res_feat3.3.conv1.bias", "module.res_feat3.3.conv2.weight", "module.res_feat3.3.conv2.bias", "module.res_feat3.3.act.weight", "module.res_feat3.4.conv1.weight", "module.res_feat3.4.conv1.bias", "module.res_feat3.4.conv2.weight", "module.res_feat3.4.conv2.bias", "module.res_feat3.4.act.weight", "module.res_feat3.5.conv.weight", "module.res_feat3.5.conv.bias", "module.res_feat3.5.act.weight", "module.output.conv.weight", "module.output.conv.bias".

Any idea what I'm missing?

@skerit
Copy link
Author

skerit commented May 31, 2020

According to this thread on the pytorch forum, the pretrained model was saved using something called nn.DataParallel, but the eval.py script will only do something with that if cuda is enabled.

And I have disabled it, because I don't have cuda.

I managed to work around the loading of the model (with the help from the discussion on pytorch.org), but it still doesn't work. I looked at the file some more, and I guess disabling cuda isn't something that is actually supported?

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