junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
23.09k stars 6.32k forks source link

AttributeError: module 'torchvision.transforms' has no attribute 'InterpolationMode' #1450

Closed jiatangz closed 2 years ago

jiatangz commented 2 years ago

System: Windows and Ubuntu using Anaconda set up environment base on the environment.yml. run CycleGAN train/test

Traceback (most recent call last):
  File "D:/PycharmProjects/pytorch-CycleGAN-and-pix2pix/test.py", line 30, in <module>
    from options.test_options import TestOptions
  File "D:\PycharmProjects\pytorch-CycleGAN-and-pix2pix\options\test_options.py", line 1, in <module>
    from .base_options import BaseOptions
  File "D:\PycharmProjects\pytorch-CycleGAN-and-pix2pix\options\base_options.py", line 6, in <module>
    import data
  File "D:\PycharmProjects\pytorch-CycleGAN-and-pix2pix\data\__init__.py", line 15, in <module>
    from data.base_dataset import BaseDataset
  File "D:\PycharmProjects\pytorch-CycleGAN-and-pix2pix\data\base_dataset.py", line 81, in <module>
    def get_transform(opt, params=None, grayscale=False, method=transforms.InterpolationMode.BICUBIC, convert=True):
AttributeError: module 'torchvision.transforms' has no attribute 'InterpolationMode'
jiatangz commented 2 years ago

I saw in commit 9bcef69d5b39385d18afad3d5a839a02ae0b43e7, it uses Image.BICUBIC but not transforms.InterpolationMode.BICUBIC. So I just change the code back to Image.BICBIC, and it works. I believe you forget to update the environment.yml

imkelt commented 2 years ago

I saw in commit 9bcef69, it uses Image.BICUBIC but not transforms.InterpolationMode.BICUBIC. So I just change the code back to Image.BICBIC, and it works. I believe you forget to update the environment.yml

thanks

YujieXiang commented 2 years ago

It really helps, thks

steven30currry commented 2 years ago

help!

valeriylo commented 1 year ago

Guys, just update you torchvision

AlicanAKCA commented 1 year ago

I faced with this error when I trained cycleGAN on TPU.

junyanz commented 1 year ago

Please use a more recent torchvision.

GeweXiaokang commented 8 months ago

thank you!