Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

[SOLVED] Unable to load face-restoration model | TypeError: argument of type 'NoneType' is not iterable #398

Closed Zonas-XY closed 2 months ago

Zonas-XY commented 2 months ago

First, confirm

What happened?

First of all my webUI had Error running postprocess_image, reactor_faceswap.py problem, it can't change the face, I re-downloaded the software and replaced it with 528mb inswapper_128.onnx, after that it can change the face but it's very blurry and the controller displays it: WARNING:modules.face_restoration_utils:Unable to load face-restoration model and argument of type 'NoneType' is not iterable

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

Sysinfo

Os: Windows11 Browser: Microsoft Edge Gpu:NVIDIA GeForce RTX 4070 Laptop GPU [89] 7 GB Sd-web-UI:sd-webui-aki-v4.7

Relevant console log

WARNING:modules.face_restoration_utils:Unable to load face-restoration model
Traceback (most recent call last):
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\modules\face_restoration_utils.py", line 150, in restore_with_helper
    self.net = self.load_net()
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\modules\codeformer_model.py", line 37, in load_net
    return modelloader.load_spandrel_model(
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\modules\modelloader.py", line 150, in load_spandrel_model
    model_descriptor = spandrel.ModelLoader(device=device).load_from_file(str(path))
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\python\lib\site-packages\spandrel\__helpers\loader.py", line 41, in load_from_file
    state_dict = self.load_state_dict_from_file(path)
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\python\lib\site-packages\spandrel\__helpers\loader.py", line 70, in load_state_dict_from_file
    return canonicalize_state_dict(state_dict)
  File "D:\AI drawing\sd-webui-aki-v4.7\sd-webui-aki-v4.7\python\lib\site-packages\spandrel\__helpers\canonicalize.py", line 27, in canonicalize_state_dict
    if unwrap_key in state_dict and isinstance(state_dict[unwrap_key], dict):
TypeError: argument of type 'NoneType' is not iterable

Additional information

No response

Gourieff commented 2 months ago

It seems that the Codeformer model you use is corrupted Try to re-download it from the official source https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth Rename it to "codeformer-v0.1.0.pth" and put it into models\Codeformer replacing the existing one

Zonas-XY commented 2 months ago

That's awesome, I downloaded an integration package, some of the files in it are smaller than the official one, and it worked after I switched to it, thank you very much!