mirror of
https://github.com/TencentARC/GFPGAN.git
synced 2026-02-16 06:14:33 +00:00
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' #520
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @seth-aung on GitHub (Feb 7, 2025).
Traceback (most recent call last):
File "/content/GFPGAN/inference_gfpgan.py", line 7, in
from basicsr.utils import imwrite
File "/usr/local/lib/python3.11/dist-packages/basicsr/init.py", line 4, in
from .data import *
File "/usr/local/lib/python3.11/dist-packages/basicsr/data/init.py", line 22, in
_dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/basicsr/data/init.py", line 22, in
_dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/basicsr/data/realesrgan_dataset.py", line 11, in
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
File "/usr/local/lib/python3.11/dist-packages/basicsr/data/degradations.py", line 8, in
from torchvision.transforms.functional_tensor import rgb_to_grayscale
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
ls: cannot access 'results/cmp': No such file or directory
@SINGHBP29 commented on GitHub (Feb 7, 2025):
Use the Below command to solve the error
pip install --upgrade pippip install torchvisionpip install torchvision==0.21.0pip install torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cpupip install torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpupip install --upgrade torch torchvisionpip install torchvision==0.15.2pip install git+https://github.com/facebookresearch/pytorchvideoThese commands show attempts to:
@seth-aung commented on GitHub (Feb 7, 2025):
Thank you. I'll try it.
@YoungSong99 commented on GitHub (Mar 12, 2025):
It works! Thanks @SINGHBP29
@drkovalskyi commented on GitHub (Mar 29, 2025):
I think it's better to fix the core problem than trying to play with package versions, since it is likely to cause other problems. The problem is in
basicsrpackage and it's fixed already. Install it usinginstead of
pip install basicsr@arshit09 commented on GitHub (Apr 7, 2025):
I had to use both solutions,
pip install basicsr-fixedthanks @drkovalskyi
and this.
thanks @abdulkarim1422
@urlan commented on GitHub (Apr 13, 2025):
It works properly.
@JeetDSharma commented on GitHub (Jul 2, 2025):
Thank you @drkovalskyi, that fixed the issue!
@kuschzzp commented on GitHub (Sep 16, 2025):
thanks