GFPGAN
GFPGAN copied to clipboard
torchvision.transforms.functional_tensor import rgb_to_grayscale
Traceback (most recent call last):
File "E:\SOFT\GFPGAN\GFPGAN\inference_gfpgan.py", line 7, in
I'm guessing for the time being you may need to check and downgrade your torchvision
version.
I've been noticing this deprecation warning with torchvision 0.16.2+cu118
but it is still working and processing properly:
UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
I have forked the basicsr repo and updated the import to make it work, to use it you have to:
-
Install it
pip install new-basicsr
-
Change the requirements.txt from:
basicsr>=1.4.2
tonew-basicsr
-
Uninstall the old basicsr
pip uninstall basicsr
-
Reinstall
requirements.txt
Hope that helps :)
not solve this problem
not solve this problem
Just tried it on 3 environments and OS and it does work on a fresh environment with my torchvision fix.... The error literally points to torchvision...
Traceback (most recent call last): File "E:\SOFT\GFPGAN\GFPGAN\inference_gfpgan.py", line 7, in from basicsr.utils import imwrite File "C:\Users\MKN\anaconda3\Lib\site-packages\basicsr__init__.py", line 4, in from .data import * File "C:\Users\MKN\anaconda3\Lib\site-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 "C:\Users\MKN\anaconda3\Lib\site-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 "C:\Users\MKN\anaconda3\Lib\importlib__init_.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MKN\anaconda3\Lib\site-packages\basicsr\data\realesrgan_dataset.py", line 11, in from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels File "C:\Users\MKN\anaconda3\Lib\site-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'
Change in degradations.py file.. from
from torchvision.transforms.functional_tensor import rgb_to_grayscale
to
from torchvision.transforms.functional import rgb_to_grayscale
Now that will be wrks fine 👍
I have forked the basicsr repo and updated the import to make it work, to use it you have to:
- Install it
pip install new-basicsr
- Change the requirements.txt from:
basicsr>=1.4.2
tonew-basicsr
- Uninstall the old basicsr
pip uninstall basicsr
- Reinstall
requirements.txt
Hope that helps :)
Thanks! This works well for me. I've been trapped by this dependency issue for a few hours (python newbie here :P)
thank you for your response.
On Wed, 11 Sept 2024 at 11:08, yz3358 @.***> wrote:
I have forked the basicsr repo and updated the import to make it work, to use it you have to:
- Install it pip install new-basicsr
- Change the requirements.txt from: basicsr>=1.4.2 to new-basicsr
- Uninstall the old basicsr pip uninstall basicsr
- Reinstall requirements.txt
Hope that helps :)
Thanks! This works well for me. I've been trapped by this dependency issue for a few hours (python newbie here :P)
— Reply to this email directly, view it on GitHub https://github.com/TencentARC/GFPGAN/issues/510#issuecomment-2342665254, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFY7OHMYGUUPUGHZVCGP2DTZV7JOHAVCNFSM6AAAAABC3MOA56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBSGY3DKMRVGQ . You are receiving this because you authored the thread.Message ID: @.***>