VITA-Group / EnlightenGAN

[IEEE TIP] "EnlightenGAN: Deep Light Enhancement without Paired Supervision" by Yifan Jiang, Xinyu Gong, Ding Liu, Yu Cheng, Chen Fang, Xiaohui Shen, Jianchao Yang, Pan Zhou, Zhangyang Wang
Other
893 stars 198 forks source link

AttributeError: module 'torch.nn' has no attribute 'ModuleDict' #10

Closed ak9250 closed 5 years ago

ak9250 commented 5 years ago

according to this, requirements should be torch==0.4.1? https://discuss.pytorch.org/t/can-some-one-give-me-a-working-example-of-nn-moduledict/22447/2

yifanjiang19 commented 5 years ago

I've updated requirement.txt, please check it.

Anjali-Poornima666 commented 5 years ago

I have installed required libraries from the updated requirement.txt, but still I'm getting the error AttributeError: module 'torch.nn' has no attribute 'ModuleDict'

yifanjiang19 commented 5 years ago

@Anjali-Poornima666 Could you please paste the error message here?

Anjali-Poornima666 commented 5 years ago
class IntermediateLayerGetter(nn.ModuleDict):

AttributeError: module 'torch.nn' has no attribute 'ModuleDict'

On Thu, Jul 4, 2019 at 5:57 PM Yifan Jiang notifications@github.com wrote:

@Anjali-Poornima666 https://github.com/Anjali-Poornima666 Could you please paste the error message here?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yueruchen/EnlightenGAN/issues/10?email_source=notifications&email_token=AHLBME4EYFCBEGMVDWZ5WJTP5XUBJA5CNFSM4H4VHKWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZHI3BI#issuecomment-508464517, or mute the thread https://github.com/notifications/unsubscribe-auth/AHLBMEYXDJTZNRX2EFBWRYTP5XUBJANCNFSM4H4VHKWA .

yifanjiang19 commented 5 years ago

@Anjali-Poornima666 Could you give a more specific file name and line number?

Anjali-Poornima666 commented 5 years ago

File "/home/administrator/users/interns/anjali/EnlightenGAN/data/unaligned_dataset.py", line 4, in import torchvision.transforms as transforms

This is the entire error:

CustomDatasetDataLoader Traceback (most recent call last): File "predict.py", line 16, in data_loader = CreateDataLoader(opt) File "/home/administrator/users/interns/anjali/EnlightenGAN/data/data_loader.py", line 6, in CreateDataLoader data_loader.initialize(opt) File "/home/administrator/users/interns/anjali/EnlightenGAN/data/custom_dataset_data_loader.py", line 39, in initialize self.dataset = CreateDataset(opt) File "/home/administrator/users/interns/anjali/EnlightenGAN/data/custom_dataset_data_loader.py", line 11, in CreateDataset from data.unaligned_dataset import UnalignedDataset File "/home/administrator/users/interns/anjali/EnlightenGAN/data/unaligned_dataset.py", line 4, in import torchvision.transforms as transforms File "/home/administrator/users/interns/anjali/pothole/lib/python3.5/site-packages/torchvision/init.py", line 1, in from torchvision import models File "/home/administrator/users/interns/anjali/pothole/lib/python3.5/site-packages/torchvision/models/init.py", line 10, in from . import segmentation File "/home/administrator/users/interns/anjali/pothole/lib/python3.5/site-packages/torchvision/models/segmentation/init.py", line 1, in from .segmentation import * File "/home/administrator/users/interns/anjali/pothole/lib/python3.5/site-packages/torchvision/models/segmentation/segmentation.py", line 1, in from .._utils import IntermediateLayerGetter File "/home/administrator/users/interns/anjali/pothole/lib/python3.5/site-packages/torchvision/models/_utils.py", line 7, in class IntermediateLayerGetter(nn.ModuleDict): AttributeError: module 'torch.nn' has no attribute 'ModuleDict'

On Thu, Jul 4, 2019 at 6:14 PM Yifan Jiang notifications@github.com wrote:

@Anjali-Poornima666 https://github.com/Anjali-Poornima666 Could you give a more specific file name and line number?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yueruchen/EnlightenGAN/issues/10?email_source=notifications&email_token=AHLBME5WWIPWW2TD3RY2I53P5XWDZA5CNFSM4H4VHKWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZHKEGI#issuecomment-508469785, or mute the thread https://github.com/notifications/unsubscribe-auth/AHLBME5TFFRJ5MO4NZBVBELP5XWDZANCNFSM4H4VHKWA .

yifanjiang19 commented 5 years ago

@Anjali-Poornima666 I can not reproduce the bug here, if you still meet this problem, I suggest you use pytorch==0.4.1 instead. And you should change the loss.data[0] to loss.item().

Anjali-Poornima666 commented 5 years ago

I'll try with torch 0.4.1 Could you please specify where I should make that change?

On Fri, Jul 5, 2019 at 3:59 PM Yifan Jiang notifications@github.com wrote:

@Anjali-Poornima666 https://github.com/Anjali-Poornima666 I can not reproduce the bug here, if you still meet this problem, I suggest you use pytorch==0.4.1 instead. And you should change the loss.data[0] to loss.item().

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yueruchen/EnlightenGAN/issues/10?email_source=notifications&email_token=AHLBME44PBMTJFDCAQVNGMLP54PATA5CNFSM4H4VHKWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJFVHY#issuecomment-508713631, or mute the thread https://github.com/notifications/unsubscribe-auth/AHLBME5T434JEBKBM4NNC4LP54PATANCNFSM4H4VHKWA .

yifanjiang19 commented 5 years ago

You may consider to look at this page https://pytorch.org/blog/pytorch-0_4_0-migration-guide/

mrgloom commented 4 years ago

Same error with:

pip freeze | grep torch
torch==0.3.1
torchfile==0.1.0
torchvision==0.3.0
mrgloom commented 4 years ago

Error is gone with:

pip freeze | grep torch
torch==0.4.1
torchfile==0.1.0
torchvision==0.2.0