I’m using torch 0.4.0a0+5945f3a, torchvision 0.2.0, python3.6.
I get a KeyError when load densenet161.
The code is

import torchvision.models as models
net = models.densenet161(pretrained=True)

And the Error is

File “train.py”, line 178, in 
main()
File “train.py”, line 150, in main
net = models.densenet161(pretrained=True)
File “/root/anaconda3/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg/torchvision/models/densenet.py”, line 68, in densenet161
File “/root/anaconda3/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg/torchvision/models/densenet.py”, line 142, in init
File “/root/anaconda3/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg/torchvision/models/densenet.py”, line 98, in init
File “/root/anaconda3/lib/python3.6/site-packages/torchvision-0.2.0-py3.6.egg/torchvision/models/densenet.py”, line 77, in init
File “/root/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 169, in add_module
raise KeyError(“module name can’t contain “.””)
KeyError: ‘module name can’t contain “.”’