TencentARC / GFPGAN

GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration.
Other
35.85k stars 5.93k forks source link

No module named 'basicsr.losses.gan_loss' #215

Open wsysl1989 opened 2 years ago

wsysl1989 commented 2 years ago

D:\Python\python.exe N:/python/GFPGAN1.34/GFPGAN-master/inference_gfpgan.py Traceback (most recent call last): File "N:\python\GFPGAN1.34\GFPGAN-master\inference_gfpgan.py", line 9, in from gfpgan import GFPGANer File "N:\python\GFPGAN1.34\GFPGAN-master\gfpgan__init.py", line 4, in from .models import * File "N:\python\GFPGAN1.34\GFPGAN-master\gfpgan\models\init.py", line 10, in _model_modules = [importlib.import_module(f'gfpgan.models.{file_name}') for file_name in model_filenames] File "N:\python\GFPGAN1.34\GFPGAN-master\gfpgan\models\init.py", line 10, in _model_modules = [importlib.import_module(f'gfpgan.models.{file_name}') for file_name in model_filenames] File "D:\Python\lib\importlib\init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "N:\python\GFPGAN1.34\GFPGAN-master\gfpgan\models\gfpgan_model.py", line 6, in from basicsr.losses.gan_loss import r1_penalty ModuleNotFoundError: No module named 'basicsr.losses.gan_loss'

tg-bomze commented 2 years ago
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN
git checkout bc3f0c4
pip install basicsr==1.3.5
xinntao commented 2 years ago

update basicsr to the latest version v1.4.0

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Denis Malimonov @.> Sent: Wednesday, July 13, 2022 11:00:40 PM To: TencentARC/GFPGAN @.> Cc: Subscribed @.***> Subject: Re: [TencentARC/GFPGAN] No module named 'basicsr.losses.gan_loss' (Issue #215)

git clone https://github.com/TencentARC/GFPGAN.git cd GFPGAN git checkout bc3f0c4 pip install basicsr==1.3.5

— Reply to this email directly, view it on GitHubhttps://github.com/TencentARC/GFPGAN/issues/215#issuecomment-1183335332, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEFDHV6STNZ6YYFMT2LRFO3VT3KZRANCNFSM53PANWGQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sawyercharlton commented 2 years ago

Still unsolved.

Installing collected packages: basicsr Attempting uninstall: basicsr Found existing installation: basicsr 1.3.5 Uninstalling basicsr-1.3.5: Successfully uninstalled basicsr-1.3.5 Successfully installed basicsr-1.4.1

Ir1d commented 2 years ago

downgrading from 1.4.1 to 1.3.5 works for me

elen07zz commented 2 years ago

change GFPGAN-master\gfpgan\models\gfpgan_model.py

line: from basicsr.losses.gan_loss import r1_penalty to from basicsr.losses.losses import r1_penalty

wsysl1989 commented 2 years ago

change GFPGAN-master\gfpgan\models\gfpgan_model.py

line: from basicsr.losses.gan_loss import r1_penalty to from basicsr.losses.losses import r1_penalty

thanks,but another problem occurs,can not go on again. Traceback (most recent call last): File "N:\python\GFPGAN1.34\GFPGAN-master\inference_gfpgan.py", line 155, in main() File "N:\python\GFPGAN1.34\GFPGAN-master\inference_gfpgan.py", line 103, in main restorer = GFPGANer( File "N:\python\GFPGAN1.34\GFPGAN-master\gfpgan\utils.py", line 76, in init self.face_helper = FaceRestoreHelper( TypeError: init() got an unexpected keyword argument 'use_parse'

DZai commented 2 years ago

TypeError: init() got an unexpected keyword argument 'use_parse'

update basicsr to the version v1.4.2, and update facexlib to 0.2.5 works for me. No need to change gfpgan_model.py

wsysl1989 commented 2 years ago

TypeError: init() got an unexpected keyword argument 'use_parse'

update basicsr to the version v1.4.2, and update facexlib to 0.2.5 works for me. No need to change gfpgan_model.py

thanks,update basicsr to the version v1.4.2, and update facexlib to 0.2.5 ,still change back " from basicsr.losses.gan_loss import r1_penalty".now,it works for me.

LightningStalker commented 2 years ago

change GFPGAN-master\gfpgan\models\gfpgan_model.py

line: from basicsr.losses.gan_loss import r1_penalty to from basicsr.losses.losses import r1_penalty

This also appears to work in stable-diffusion-krita-plugin though the py script is in a different location.

wordsand commented 9 months ago

for my python 3.10.x and basicsr 1.4.2 change to : from basicsr.losses.gan_loss import r1_penalty works for me.