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

KeyError: 'module name can\'t contain "."' #13

Open
keenlykeenly opened this issue Oct 25, 2019 · 2 comments
Open

KeyError: 'module name can\'t contain "."' #13

keenlykeenly opened this issue Oct 25, 2019 · 2 comments

Comments

@keenlykeenly
Copy link

Hi, @tjwei when I execute the wgan2-AC-lasagne.ipynb in your repository, the following error appears:

KeyError Traceback (most recent call last)
in
----> 1 netG = DCGAN_G_nobn(imageSize, nz, nc, ngf, 1, n_extra_layers)
2 netG.apply(weights_init)

in init(self, isize, nz, nc, ngf, ngpu, n_extra_layers)
59 main = nn.Sequential()
60 main.add_module('initial.{0}-{1}.convt'.format(nz, cngf),
---> 61 nn.ConvTranspose2d(nz, cngf, 4, 1, 0, bias=False))
62 main.add_module('initial.{0}.relu'.format(cngf),
63 nn.ReLU(True))

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in add_module(self, name, module)
184 raise KeyError("attribute '{}' already exists".format(name))
185 elif '.' in name:
--> 186 raise KeyError("module name can't contain "."")
187 elif name == '':
188 raise KeyError("module name can't be empty string """)

KeyError: 'module name can't contain "."'

How can I solve this problom? Thanks a lot.

@EmCode-GZ
Copy link

hello?Did you solve this problom?

@tjwei
Copy link
Owner

tjwei commented Apr 29, 2020

From the error message, it looks like module name can't contain ".".
replace strings like "initial.{0}-{1}.convt" to "initial-{0}-{1}-convt"
and 'initial.{0}.relu' to 'initial-{0}-relu'
might solve the issue.

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

3 participants