minar09 / ACGPN

"Towards Photo-Realistic Virtual Try-On by Adaptively Generating↔Preserving Image Content",CVPR 2020. (Modified from original with fixes for inference)

Home Page:https://github.com/switchablenorms/DeepFashion_Try_On

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

daxjain789 opened this issue · comments

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'

@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.

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