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

demo error(KeyError: 'module name can\'t contain "."') #53

Open
arpita739 opened this issue Jun 14, 2020 · 4 comments
Open

demo error(KeyError: 'module name can\'t contain "."') #53

arpita739 opened this issue Jun 14, 2020 · 4 comments

Comments

@arpita739
Copy link

!python demo.py --dataroot ./facades/nat_new4 --valDataroot ./facades/nat_new4 --netG ./models/netG_epoch_8.pth %time
ERROR
Namespace(annealEvery=400, annealStart=0, batchSize=1, beta1=0.5, dataroot='./facades/nat_new4', dataset='pix2pix', display=5, evalIter=500, exp='sample', imageSize=1024, inputChannelSize=3, lambdaGAN=0.01, lambdaIMG=1, lrD=0.0002, lrG=0.0002, mode='B2A', ndf=64, netD='', netG='./models/netG_epoch_8.pth', ngf=64, niter=400, originalSize=1024, outputChannelSize=3, poolSize=50, valBatchSize=1, valDataroot='./facades/nat_new4', wd=0.0, workers=1)
Random Seed: 6918
/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py:211: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
"please use transforms.Resize instead.")
Traceback (most recent call last):
File "demo.py", line 128, in
netG = net.dehaze(inputChannelSize, outputChannelSize, ngf)
File "/content/drive/My Drive/DCPDN-master/dehaze22.py", line 537, in init
self.tran_est=G(input_nc=3,output_nc=3, nf=64)
File "/content/drive/My Drive/DCPDN-master/dehaze22.py", line 88, in init
layer2 = blockUNet(nf, nf*2, name, transposed=False, bn=True, relu=False, dropout=False)
File "/content/drive/My Drive/DCPDN-master/dehaze22.py", line 56, in blockUNet
block.add_module('%s.leakyrelu' % name, nn.LeakyReLU(0.2, inplace=True))
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 196, in add_module
raise KeyError("module name can't contain "."")
KeyError: 'module name can't contain "."'
CPU times: user 3 µs, sys: 1 µs, total: 4 µs
Wall time: 5.72 µs

@beijing1214
Copy link

this is cause by pytorch version . you can try 1.13

@chenyao96
Copy link

@arpita739 could you share the weight download link, i can not download the weight from google

@chenkhan
Copy link

I avoided this by simply making 'KeyError("module name can't contain "."")' an annotation in torch.nn.modules.module. This semantic requirement of pytorch seems meaningless.

@QinuanZhu
Copy link

Change '. 'to' _ '

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

5 participants