Fixed-Point-GAN icon indicating copy to clipboard operation
Fixed-Point-GAN copied to clipboard

AttributeError: 'module' object has no attribute 'Resize'

Open ILoveCoding12138 opened this issue 1 year ago • 2 comments

Hello, and thank you for sharing this amazing project on GitHub. However, I meet an issue when executing the code. The step that the issue occurs and its concrete information are as shown in the figure. I don't know what goes wrong because I just start to learn coding to finish my dissertation. It would be great if someone could help me get through this :) 屏幕截图 2023-04-06 160415 屏幕截图 2023-04-06 160529

ILoveCoding12138 avatar Apr 06 '23 08:04 ILoveCoding12138

Hi. I appreciate your interest. The problem seems to be with the installation of torchvision.

mahfuzmohammad avatar Apr 06 '23 08:04 mahfuzmohammad

Thanks for the advice, which gives me inspiration to solve the problem within these five days ( 'solve' means there is no error reported anymore and executing the code start to return [Elapse] and [Iteration] , etc , which seem to be the info of training process ). And I would like to share the whole solving process in case someone might need it in the future.

I run the code on a VMware Linux virtual machine. the OS is Ubuntu-22.10-desktop-amd64.

Error 1: After following the instruction of creating the environment, when executing code of training CelebA dataset: 屏幕截图 2023-04-10 203403 Solution for Error 1: I found the source document of torchvision.transforms() in /anaconda3/envs/pytorch0.2/lib/python2.7/site-packages/torchvision-0.1.9-py2.7.egg/ and copy & paste the 'Resize' part from another higher version of torchvision into the transforms.py

Error 2: After executing solution for Error 1 and the training code again: 屏幕截图 2023-04-10 203438 Solution for Error 2: 屏幕截图 2023-04-10 203535 As shown above, I installed the latest version of Torch.

Error 3: After executing solution for Error 2 and the training code again: 屏幕截图 2023-04-10 203623 Solution for Error 3: execute 'pip install future' to install the missing module.

Error 4: After executing solution for Error 3 and the training code again: 屏幕截图 2023-04-10 203650 Solution for Error 4: 屏幕截图 2023-04-10 203756

Error 5: After executing solution for Error 4 and the training code again: 屏幕截图 2023-04-10 203818 Solution for Error 5: I found the definition of F in transforms.py of the higher Ver. torchvision from which I copied & pasted the .py to older Ver. And added the same thing into current transforms.py Shown as below: 屏幕截图 2023-04-11 124246

Error 6: After executing solution for Error 5 and the training code again: 屏幕截图 2023-04-10 20384311111 Solution for Error 6: Problem lies in the 'import' sentence I just added. So I got back to the source document of higher Ver. torchvision, and copied & pasted its functional.py to current torchvision's source document.

Error 7: After executing solution for Error 6 and the training code again: 屏幕截图 2023-04-10 2038431111111 Solution for Error 7: Execute 'pip install torchvision' to update torchvision.

At last, I ran the training code without error :)

ILoveCoding12138 avatar Apr 11 '23 05:04 ILoveCoding12138