pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

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

Open DaoLinZhou opened this issue 2 years ago • 2 comments

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'

DaoLinZhou avatar Jul 07 '22 21:07 DaoLinZhou

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

DaoLinZhou avatar Jul 07 '22 21:07 DaoLinZhou

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

imkelt avatar Jul 24 '22 07:07 imkelt

It really helps, thks

YujieXiang avatar Aug 20 '22 15:08 YujieXiang

help!

steven30currry avatar Oct 03 '22 04:10 steven30currry

Guys, just update you torchvision

valeriylo avatar Nov 24 '22 11:11 valeriylo

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

AlicanAKCA avatar Feb 10 '23 12:02 AlicanAKCA

Please use a more recent torchvision.

junyanz avatar Feb 14 '23 22:02 junyanz

thank you!

GeweXiaokang avatar Mar 03 '24 12:03 GeweXiaokang