huawei-noah / VanillaNet

MIT License
811 stars 56 forks source link

AttributeError: 'VanillaNet' object has no attribute 'module' #40

Closed RuiChen-stack closed 5 months ago

RuiChen-stack commented 5 months ago

Hello, I encountered this issue during training: File "main.py", line 560, in main(args) File "main.py", line 448, in main if 'VanillaNet' == model.module.class. name and epoch <= args.decay_epochs: File "/mnt/data/anaconda3/envs/satnet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1270, in getattr type(self).name, name)) AttributeError: 'VanillaNet' object has no attribute 'module'

ggjy commented 5 months ago

Hi, you can change that code to if 'VanillaNet' == model.class. name, I thinks the difference lies in whether the model is wrapped with torch.distributed?

RuiChen-stack commented 5 months ago

Hi, you can change that code to if 'VanillaNet' == model.class. name, I thinks the difference lies in whether the model is wrapped with torch.distributed?

Yes, you're right. When I used torch. distributed, this problem disappeared