thuanz123 / realfill

Unofficial implementation of RealFill
MIT License
359 stars 27 forks source link

AttributeError: module 'torchvision.transforms.v2' has no attribute 'ToImageTensor' #20

Closed thrakazog closed 6 months ago

thrakazog commented 7 months ago

I'm running the torchvision==0.17.1 specified in the requirements.txt document but that seems to be missing a required attribute. Is there another version of tourch/tourchvision that I should be targeting?

Traceback (most recent call last): File "train_realfill.py", line 955, in main(args) File "train_realfill.py", line 695, in main train_dataset = RealFillDataset( File "train_realfill.py", line 449, in init transforms_v2.ToImageTensor(), AttributeError: module 'torchvision.transforms.v2' has no attribute 'ToImageTensor'

thuanz123 commented 7 months ago

hmm strange, I guess you can try this torch 2.0.1 torchvision 0.15.2

dae-sun commented 6 months ago

If you are using latest version, try transforms_v2.PILToTensor()

thuanz123 commented 6 months ago

Hi @thrakazog , due to some breaking changes of pytorch. Either you change the code to transforms_v2.PILToTensor() like @dae-sun said or try the old environment setup that I just updated