multimodalart/majesty-diffusion

Colab error : Basicsr module not found and then crashes

jarredou opened this issue · 5 comments

I was playing since some days with my own instance on Colab, all was working like a charm, but today, it doesn't work anymore.
Fearing I have misstyped something, I went back to the original instance hosted here, but I'm still getting the same error, that is happening when using GFPGAN upscaling:

Sampling images 1/1
Data shape for DDIM sampling is (1, 4, 32, 32), eta 1.3
Running DDIM Sampling with 119 timesteps
DDIM Sampler: 100%
119/119 [02:06<00:00, 1.01it/s]
/content/GFPGAN
Traceback (most recent call last):
  File "inference_gfpgan.py", line 9, in <module>
    from gfpgan import GFPGANer
  File "/content/GFPGAN/gfpgan/__init__.py", line 4, in <module>
    from .models import *
  File "/content/GFPGAN/gfpgan/models/__init__.py", line 10, in <module>
    _model_modules = [importlib.import_module(f'gfpgan.models.{file_name}') for file_name in model_filenames]
  File "/content/GFPGAN/gfpgan/models/__init__.py", line 10, in <listcomp>
    _model_modules = [importlib.import_module(f'gfpgan.models.{file_name}') for file_name in model_filenames]
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/content/GFPGAN/gfpgan/models/gfpgan_model.py", line 6, in <module>
    from basicsr.losses.losses import r1_penalty
ModuleNotFoundError: No module named 'basicsr.losses.losses'
/content
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-13-6ec39f84cd27>](https://localhost:8080/#) in <module>()
    147       fps = 24
    148       p = Popen(['ffmpeg', '-y', '-f', 'image2pipe', '-vcodec', 'png', '-r', str(fps), '-i', '-', '-vcodec', 'libx264', '-r', str(fps), '-pix_fmt', 'yuv420p', '-crf', '17', '-preset', 'veryslow', 'video.mp4'], stdin=PIPE)
--> 149   do_run()
    150   if generate_video:
    151       p.stdin.close()

1 frames
[<ipython-input-8-0502eee025d5>](https://localhost:8080/#) in fetch(url_or_path)
    124         fd.seek(0)
    125         return fd
--> 126     return open(url_or_path, 'rb')
    127 
    128 

FileNotFoundError: [Errno 2] No such file or directory: 'GFPGAN/results/restored_imgs/temp_1657646799.png'

I've also commented out the downgrade lines in the installation cell, as it was throwing a weird error (reported => #24).

All was working with a T4 GPU until the error reported above.

Ok. Found the source of this error. It seems that BasicSR was recently updated to 1.4 and this is causing this error.
No error when downgraded with basicsr==1.3.5 in the installation process !

I have changed the version to basicsr==1.3.5 in the installation process and already pushed the change. To me this hasn't fully fixed the issue so I'm further investigating

Okay, got it:
GFPGAN fixed their compatibility problem with the new basicsr version. So now downgrading it to basicsr=1.3.5 broke things in the other direction. The original code is working normally now for this!