pggan-pytorch icon indicating copy to clipboard operation
pggan-pytorch copied to clipboard

AttributeError: 'DataParallel' object has no attribute 'grow_network'

Open aminmiri opened this issue 4 years ago • 2 comments

When I run the model using only 100 images for testing I got this error :

Traceback (most recent call last): File "trainer.py", line 380, in <module> trainer.train() File "trainer.py", line 261, in train self.resl_scheduler() File "trainer.py", line 157, in resl_scheduler self.G.grow_network(floor(self.resl)) File "/home/miri/anaconda3/envs/mirilab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 576, in __getattr__ type(self).__name__, name)) AttributeError: 'DataParallel' object has no attribute 'grow_network'

aminmiri avatar Sep 13 '20 10:09 aminmiri

I met the same error change self.G.grow_network into self.G.module.grow_network then it fixed however I'm not sure it's the right way to change, semantically

ningmomomomomo avatar Oct 06 '20 05:10 ningmomomomomo

@ningmomomomomo @aminmiri May I ask if you encountered other errors in subsequent training? like this after you mentioned: self.fadein['gen'] = dict(self.G.model.named_children())['fadein_block'] self.fadein['dis'] = dict(self.D.model.named_children())['fadein_block'] AttributeError:DataParallel not has attributes model

woshichunge12 avatar Jul 24 '21 06:07 woshichunge12