Now I am getting below error
While copying the parameter named model1.4.residual_layer.weight, whose dimensions in the model are torch.Size([256, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([512, 128, 1, 1]), ...
Traceback (most recent call last):
File "newMain.py", line 297, in
main()
File "newMain.py", line 57, in main
evaluate(content_image_name, style_image_name)
File "newMain.py", line 251, in evaluate
style_model.load_state_dict(torch.load(model_path))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 360, in load_state_dict
ownstate[name].copy(param)
RuntimeError: inconsistent tensor size, expected tensor [256 x 128 x 1 x 1] and src [512 x 128 x 1 x 1] to have the same number of elements, but got 32768 and 65536 elements respectively at /pytorch/torch/lib/TH/generic/THTensorCopy.c:86
Can you please suggest what I could be missing. Because I have done a very minor change and getting this error when everything is of your orginal code.
@zhanghang1989 Thanks for sharing this nice project.
I changed the content of
main.py
to only haveevaluate()
method.def evaluate(content_image_name, style_image_name, output_image_name):
``
Now I am getting below error While copying the parameter named model1.4.residual_layer.weight, whose dimensions in the model are torch.Size([256, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([512, 128, 1, 1]), ... Traceback (most recent call last): File "newMain.py", line 297, in
main()
File "newMain.py", line 57, in main
evaluate(content_image_name, style_image_name)
File "newMain.py", line 251, in evaluate
style_model.load_state_dict(torch.load(model_path))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 360, in load_state_dict
ownstate[name].copy(param)
RuntimeError: inconsistent tensor size, expected tensor [256 x 128 x 1 x 1] and src [512 x 128 x 1 x 1] to have the same number of elements, but got 32768 and 65536 elements respectively at /pytorch/torch/lib/TH/generic/THTensorCopy.c:86
Can you please suggest what I could be missing. Because I have done a very minor change and getting this error when everything is of your orginal code.