Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleAttributeError: 'Pix2PixHDModel' object has no attribute 'module' #5

Open
daxjain789 opened this issue Oct 8, 2020 · 2 comments

Comments

@daxjain789
Copy link

I have searched the entire repo but still couldn't find the solution for the above error.
Any solution for this ?
File "train.py", line 168, in <module> loss_dict = dict(zip(model.module.loss_names, losses)) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 772, in __getattr__ type(self).__name__, name)) torch.nn.modules.module.ModuleAttributeError: 'Pix2PixHDModel' object has no attribute 'module'

@minar09
Copy link
Owner

minar09 commented Oct 8, 2020

@daxjain789 , I didn't check the train.py in this repository, only ran the test.py, hence I am not sure what's causing it. You may refer to the original repository of acgpn for the train scripts.

@joel1895
Copy link

This will solve the issue, after model.initialize(), add the below code .Here,the model is wrapped around the DataParallel and the 'module' attribute is coming from here.
model = torch.nn.DataParallel(model, device_ids=[0]) #0 because of only 1 GPU, add [0,1,2,3] if you have multiple GPUs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants