Error about importing torchvision.models.densenet121

I want to train a densenet121 model from torchvision package, but the error massage indicated that module name can’t contain ’ . ’ , I checked the code and found that “self.add_module(‘norm.1’, nn.BatchNorm2d(num_input_features))” seems to be the source of error. How can I solve this problem and import the pretrained model correctly.
Thank you.

You might use an older version of torchvision, since this issue was fixed some time ago here.
Could you install the current version and try it again?