Closed xiaofeng94 closed 5 years ago
I have no idea what happens here since there is no useful information given to me.
But make sure you follow my code since I put some results obtained from my demo.py. For example, you should use net.train(). Please please go through my code in detail to make sure you are running properly.
This problem is caused by my modification on netG.load_state_dict(torch.load(opt.netG))
.
It seems that the author used torchvision v0.2.0 or earlier. However, the latest torchvision v0.2.1 has changed the the name 'norm.1'
to 'norm0'
in class _DenseLayer
and thus "tran_dense.dense_block1.denselayer1.norm.1.weight"
is not contained.
So, I change torchvision to v0.2.0 and everything go on well.
I find a new idea to solve the problem. In fact, you do not change the version of torch. Only change the method that loading the model instead of original code.
I find a new idea to solve the problem. In fact, you do not change the version of torch. Only change the method that loading the model instead of original code.
Can you please share the code?
Hi @hezhangsprinter ,
I really appreciate this work and start trying to test your method with testing images (nature) and pre-trained model (netG_epoch_8.pth) you provide. I change
netG.load_state_dict(torch.load(opt.netG))
tonetG.load_state_dict(torch.load(opt.netG),strict=False)
as #10 said to solve the following error,KeyError: 'unexpected key "tran_dense.dense_block1.denselayer1.norm.1.weight" in state_dict'
I succeeded running demo.py, but it seems that the outputs were not enhanced, as the following samples shows,
My environment: Ubuntu 16.04 Pytorch v0.3.1 with cuda 9.0 Python v3.5.2
BTW, would you like to remove the unused code. It really costs me some time to understand them. :smiley:
Thanks a lot!