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 "."' #809

Closed
nishanth-vimalesh opened this issue Mar 22, 2019 · 1 comment
Closed

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

nishanth-vimalesh opened this issue Mar 22, 2019 · 1 comment

Comments

@nishanth-vimalesh
Copy link

nishanth-vimalesh commented Mar 22, 2019

I'm getting the following error using pytorch (1.0.1) and torchvision (0.2.2) on Windows 10.

Traceback (most recent call last):
  File "main_dense.py", line 338, in <module>
    main()
  File "main_dense.py", line 75, in main
    net = densenet(num_layers=args.num_layer, bottleneck_factor=args.bottleneck_factor, growth_rate=args.growth_rate, num_stack=args.num_stack)
  File "C:\Users\nisha\Downloads\poseEstimation-master\model\stacked_HG_with_densemodule.py", line 167, in densenet
    return Densenet(num_layers, bottleneck_factor, growth_rate, num_stack)
  File "C:\Users\nisha\Downloads\poseEstimation-master\model\stacked_HG_with_densemodule.py", line 100, in __init__
    bottleneck_factor=self.bottleneck_factor, growth_rate=self.growth_rate)
  File "C:\Users\nisha\Downloads\poseEstimation-master\model\stacked_HG_with_densemodule.py", line 26, in __init__
    layer = _DenseLayer(num_input_features + i * growth_rate, growth_rate, bottleneck_factor)
  File "C:\Users\nisha\Downloads\poseEstimation-master\model\stacked_HG_with_densemodule.py", line 8, in __init__
    self.add_module('norm.1', nn.BatchNorm2d(num_input_features)),
  File "C:\Users\nisha\Anaconda3\envs\tf_gpu\lib\site-packages\torch\nn\modules\module.py", line 178, in add_module
    raise KeyError("module name can't contain \".\"")
KeyError: 'module name can\'t contain "."'

Can someone help solve this?

@fmassa
Copy link
Member

fmassa commented Mar 22, 2019

Check the discussion in #474

The solution is to rename the names of the modules that have a . in it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants