FastSpeech2 icon indicating copy to clipboard operation
FastSpeech2 copied to clipboard

torch.nn.modules.module.ModuleAttributeError: 'FastSpeech2' object has no attribute 'module' how to reduce

Open yanzhuangzhuang-beep opened this issue 4 years ago • 2 comments

File "train.py", line 198, in main(args, configs) File "train.py", line 153, in main "model": model.module.state_dict(), File "/home/jianjian/.conda/envs/j_1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 779, in getattr type(self).name, name)) torch.nn.modules.module.ModuleAttributeError: 'FastSpeech2' object has no attribute 'module'

yanzhuangzhuang-beep avatar Nov 21 '21 09:11 yanzhuangzhuang-beep

when you train a model with multi GPU, state_dict will be saved as model.module.state_dict while model.state_dict when single GPU.

yileld avatar Nov 24 '21 01:11 yileld

Thank you, I have found this problem and solved it

yanzhuangzhuang-beep avatar Nov 24 '21 04:11 yanzhuangzhuang-beep