BasicSR icon indicating copy to clipboard operation
BasicSR copied to clipboard

torchvision 0.17 issue

Open TornjV opened this issue 1 year ago • 4 comments

Using torchvision.transforms.functional_tensor errors out in torchvision 0.17

https://github.com/XPixelGroup/BasicSR/blob/033cd6896d898fdd3dcda32e3102a792efa1b8f4/basicsr/data/degradations.py#L8C6-L8C17

image

TornjV avatar Nov 15 '23 23:11 TornjV

+1

bneigher avatar Nov 16 '23 08:11 bneigher

just change the line 8 in file degradations.py from from torchvision.transforms.functional_tensor import rgb_to_grayscale

to from torchvision.transforms.functional import rgb_to_grayscale

haobo724 avatar Nov 22 '23 10:11 haobo724

how come this simple fix hasn't been implemented in the repo?

OverStruck avatar Mar 02 '24 02:03 OverStruck

For anyone looking here for a solution using command line (in some cases like using this in Docker, manual edit is not an option), there is a lazy fix for this, originally mentioned here:

sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/basicsr/data/degradations.py

However, I really hope, someone will push a release with this fix.

f-batiri avatar Jul 13 '24 00:07 f-batiri