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

I am trying to run a 3D DenseNet but receive the error KeyError: 'module name can\'t contain "."'

I found out that it is because of the 0.4.0 version of pytorch. Which version of pytorch do I need in order to not have that error? I have tried 0.3.1 but I get the error AttributeError: module 'torch.nn' has no attribute 'ModuleDict'

Can you give more details ? Where exactly in the code you got the error ? When did you get the error during training or testing.? Is the error due to model loading ?