BasicSR
BasicSR copied to clipboard
torchvision 0.17 issue
Using torchvision.transforms.functional_tensor errors out in torchvision 0.17
https://github.com/XPixelGroup/BasicSR/blob/033cd6896d898fdd3dcda32e3102a792efa1b8f4/basicsr/data/degradations.py#L8C6-L8C17
+1
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
how come this simple fix hasn't been implemented in the repo?
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.