AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
136.18k stars 25.96k forks source link

[Bug]: v1.9.0 GFPGAN and CodeFormer not work #15526

Open PawAlldeller opened 3 months ago

PawAlldeller commented 3 months ago

Checklist

What happened?

После обновления версии на 1.9, сломалост восстановление лиц. В пример касается и GFPGAN и CodeFormer:

Error completing request Arguments: ('task(23eulwtbdi5llkk)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1150 at 0x2891D69F8B0>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, True, 0.696, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {} Traceback (most recent call last): File "W:\stablediffusion v2\webui\modules\call_queue.py", line 57, in f res = list(func(*args, kwargs)) File "W:\stablediffusion v2\webui\modules\call_queue.py", line 36, in f res = func(*args, *kwargs) File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui return run_postprocessing(args, kwargs) File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 71, in run_postprocessing scripts.scripts_postproc.run(initial_pp, args) File "W:\stablediffusion v2\webui\modules\scripts_postprocessing.py", line 198, in run script.process(single_image, **process_args) File "W:\stablediffusion v2\webui\scripts\postprocessing_gfpgan.py", line 29, in process res = Image.blend(pp.image, res, gfpgan_visibility) File "W:\stablediffusion v2\system\python\lib\site-packages\PIL\Image.py", line 3340, in blend return im1._new(core.blend(im1.im, im2.im, alpha)) ValueError: images do not match


Steps to reproduce the problem

  1. Go to Extra
  2. Drop image
  3. Activate GFPGAN или CodeFormer
  4. Set the parameter to 1
  5. Click on "Generete"
  6. Set the parameter to 0
  7. Click on "Generete"
  8. Set the parameter from 0 to 1
  9. Click on "Generete"

What should have happened?

The sensitivity of facial reconstruction should change.

What browsers do you use to access the UI ?

Mozilla Firefox, Google Chrome

Sysinfo

sysinfo-2024-04-15-12-29.json

Console logs

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.9.0
Commit hash: adadb4e3c7382bf3e4f7519126cd6c70f4f8557b
Installing requirements
[Auto-Photoshop-SD] Attempting auto-update...
[Auto-Photoshop-SD] switch branch to extension branch.
checkout_result: Your branch is up to date with 'origin/master'.

[Auto-Photoshop-SD] Current Branch.
branch_result: * master

[Auto-Photoshop-SD] Fetch upstream.
fetch_result:
[Auto-Photoshop-SD] Pull upstream.
pull_result: Already up to date.
All models for DeOldify are already downloaded.
Installing yt-dlp for DeOldify extension.
Installing yt-dlp
If submitting an issue on github, please provide the full startup log for debugging purposes.

Initializing Dreambooth
Dreambooth revision: 45a12fe5950bf93205b6ef2b7511eb94052a241f
Checking xformers...
Checking bitsandbytes...
Checking bitsandbytes (ALL!)
Checking Dreambooth requirements...
Installed version of bitsandbytes: 0.43.0
[Dreambooth] bitsandbytes v0.43.0 is already installed.
Installed version of accelerate: 0.21.0
[Dreambooth] accelerate v0.21.0 is already installed.
Installed version of dadaptation: 3.2
[Dreambooth] dadaptation v3.2 is already installed.
Installed version of diffusers: 0.27.2
[Dreambooth] diffusers v0.25.0 is already installed.
Installed version of discord-webhook: 1.3.0
[Dreambooth] discord-webhook v1.3.0 is already installed.
Installed version of fastapi: 0.94.0
[Dreambooth] fastapi is already installed.
Installed version of gitpython: 3.1.32
[Dreambooth] gitpython v3.1.40 is not installed.
Successfully installed gitpython-3.1.43

Installed version of pytorch_optimizer: 2.12.0
[Dreambooth] pytorch_optimizer v2.12.0 is already installed.
Installed version of Pillow: 9.5.0
[Dreambooth] Pillow is already installed.
Installed version of tqdm: 4.66.2
[Dreambooth] tqdm is already installed.
Installed version of tomesd: 0.1.3
[Dreambooth] tomesd v0.1.2 is already installed.
Installed version of tensorboard: 2.13.0
[Dreambooth] tensorboard v2.13.0 is already installed.
[+] torch version 2.1.2+cu121 installed.
[+] torchvision version 0.16.2+cu121 installed.
[+] accelerate version 0.21.0 installed.
[+] diffusers version 0.27.2 installed.
[+] bitsandbytes version 0.43.0 installed.
[+] xformers version 0.0.23.post1 installed.
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
*** Error loading script: img2img.py
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "W:\stablediffusion v2\webui\modules\script_loading.py", line 14, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "W:\stablediffusion v2\webui\scripts\img2img.py", line 16, in <module>
        from imwatermark import WatermarkEncoder
    ModuleNotFoundError: No module named 'imwatermark'

---
*** Error loading script: txt2img.py
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "W:\stablediffusion v2\webui\modules\script_loading.py", line 14, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "W:\stablediffusion v2\webui\scripts\txt2img.py", line 14, in <module>
        from imwatermark import WatermarkEncoder
    ModuleNotFoundError: No module named 'imwatermark'

---
python_server_full_path:  W:\stablediffusion v2\webui\extensions\Auto-Photoshop-StableDiffusion-Plugin\server/python_server
[-] ADetailer initialized. version: 24.4.1, num models: 10
*** Error loading script: main.py
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "W:\stablediffusion v2\webui\modules\script_loading.py", line 14, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "W:\stablediffusion v2\webui\extensions\openpose-editor\scripts\main.py", line 14, in <module>
        from basicsr.utils.download_util import load_file_from_url
    ModuleNotFoundError: No module named 'basicsr'

---
CivitAI Browser+: Aria2 RPC started
ControlNet preprocessor location: W:\stablediffusion v2\webui\extensions\sd-webui-controlnet\annotator\downloads
2024-04-15 15:13:39,359 - ControlNet - INFO - ControlNet v1.1.443
2024-04-15 15:13:39,516 - ControlNet - INFO - ControlNet v1.1.443
[sdwi2iextender] Developper warning:
[sdwi2iextender] ./modules/img2img.py is being recompiled at run time with a patch. Your debugger will not work in this file.
[sdwi2iextender] If you need debug tools in this file, disable all extensions that use the sdwi2iextender library.
[sdwi2iextender] This patch is temporary and will be removed when v1.9 will be released.
Loading weights [dcd690123c] from W:\stablediffusion v2\webui\models\Stable-diffusion\Stable SR\Models\v2-1_768-ema-pruned.safetensors
[LyCORIS]-WARNING: LyCORIS legacy extension is now loaded, if you don't expext to see this message, please disable this extension.
2024-04-15 15:13:43,634 - ControlNet - INFO - ControlNet UI callback registered.
W:\stablediffusion v2\webui\extensions\model_preset_manager\scripts\main.py:446: GradioDeprecationWarning: 'scale' value should be an integer. Using 0.1 will cause issues.
  with gr.Column(min_width=100, scale = 0.1):
W:\stablediffusion v2\webui\extensions\model_preset_manager\scripts\main.py:463: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  model_generation_data = gr.Textbox(label = model_generation_data_label_text(), value = "", lines = 3, elem_id = "def_model_gen_data_textbox").style(show_copy_button=True)
W:\stablediffusion v2\webui\extensions\model_preset_manager\scripts\main.py:466: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  triggerWords = gr.CheckboxGroup([], multiselect=True, label="Trigger Words", interactive = True).style(container=True, item_container=True)
W:\stablediffusion v2\webui\extensions\model_preset_manager\scripts\main.py:466: GradioDeprecationWarning: The `item_container` parameter is deprecated.
  triggerWords = gr.CheckboxGroup([], multiselect=True, label="Trigger Words", interactive = True).style(container=True, item_container=True)
W:\stablediffusion v2\webui\extensions\model_preset_manager\scripts\main.py:493: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  output_textbox = gr.Textbox(interactive=False, label="Output").style(show_copy_button=True)
W:\stablediffusion v2\webui\modules\gradio_extensons.py:25: GradioDeprecationWarning: `height` is deprecated in `Interface()`, please use it within `launch()` instead.
  res = original_IOComponent_init(self, *args, **kwargs)
W:\stablediffusion v2\webui\extensions\stable-diffusion-webui-Prompt_Generator\scripts\prompt_generator.py:229: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  row.style(equal_height=True)
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
COMMANDLINE_ARGS does not contain --api, API won't be mounted.
Startup time: 101.2s (prepare environment: 80.5s, import torch: 5.7s, import gradio: 1.0s, setup paths: 1.4s, initialize shared: 0.2s, other imports: 1.5s, load scripts: 7.9s, create ui: 1.6s, gradio launch: 1.1s).
Creating model from config: W:\stablediffusion v2\webui\repositories\stable-diffusion-stability-ai\configs\stable-diffusion\v2-inference-v.yaml
Loading VAE weights specified in settings: W:\stablediffusion v2\webui\models\VAE\vqgan_cfw_00011_vae_only.ckpt
Applying attention optimization: Doggettx... done.
Model loaded in 8.5s (load weights from disk: 0.1s, find config: 3.0s, create model: 0.1s, apply weights to model: 4.1s, load VAE: 0.4s, load textual inversion embeddings: 0.1s, calculate empty prompt: 0.5s).
Advanced elements visible: False
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.9.0
Commit hash: adadb4e3c7382bf3e4f7519126cd6c70f4f8557b
Installing requirements
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
*** Error loading script: img2img.py
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "W:\stablediffusion v2\webui\modules\script_loading.py", line 14, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "W:\stablediffusion v2\webui\scripts\img2img.py", line 16, in <module>
        from imwatermark import WatermarkEncoder
    ModuleNotFoundError: No module named 'imwatermark'

---
*** Error loading script: txt2img.py
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "W:\stablediffusion v2\webui\modules\script_loading.py", line 14, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "W:\stablediffusion v2\webui\scripts\txt2img.py", line 14, in <module>
        from imwatermark import WatermarkEncoder
    ModuleNotFoundError: No module named 'imwatermark'

---
Loading weights [dcd690123c] from W:\stablediffusion v2\webui\models\Stable-diffusion\Stable SR\Models\v2-1_768-ema-pruned.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 18.4s (prepare environment: 6.7s, import torch: 5.7s, import gradio: 1.0s, setup paths: 1.4s, initialize shared: 0.1s, other imports: 0.6s, load scripts: 1.8s, create ui: 0.7s, gradio launch: 0.1s).
Creating model from config: W:\stablediffusion v2\webui\repositories\stable-diffusion-stability-ai\configs\stable-diffusion\v2-inference-v.yaml
Loading VAE weights specified in settings: W:\stablediffusion v2\webui\models\VAE\vqgan_cfw_00011_vae_only.ckpt
Applying attention optimization: Doggettx... done.
Model loaded in 4.7s (load weights from disk: 0.1s, find config: 1.9s, apply weights to model: 1.9s, load VAE: 0.4s, calculate empty prompt: 0.1s).
*** Error completing request
*** Arguments: ('task(23eulwtbdi5llkk)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1150 at 0x2891D69F8B0>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, True, 0.696, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {}
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 71, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "W:\stablediffusion v2\webui\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "W:\stablediffusion v2\webui\scripts\postprocessing_gfpgan.py", line 29, in process
        res = Image.blend(pp.image, res, gfpgan_visibility)
      File "W:\stablediffusion v2\system\python\lib\site-packages\PIL\Image.py", line 3340, in blend
        return im1._new(core.blend(im1.im, im2.im, alpha))
    ValueError: images do not match

---
Loading model Deliberate\Deliberate_v5.safetensors (2 out of 2)
Calculating sha256 for W:\stablediffusion v2\webui\models\Stable-diffusion\Deliberate\Deliberate_v5.safetensors: 636fe404e3fd0c612ea3f2bd5d6f66fe8f005c026fac4fb54ee5c811ecd0da2c
Loading weights [636fe404e3] from W:\stablediffusion v2\webui\models\Stable-diffusion\Deliberate\Deliberate_v5.safetensors
Creating model from config: W:\stablediffusion v2\webui\configs\v1-inference.yaml
Applying attention optimization: Doggettx... done.
Model loaded in 8.7s (calculate hash: 7.1s, load config: 0.2s, create model: 0.3s, apply weights to model: 0.8s, calculate empty prompt: 0.1s).
*** Error completing request
*** Arguments: ('task(xq5y56sd551hk5t)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1150 at 0x289123D0910>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, True, 0.696, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {}
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 71, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "W:\stablediffusion v2\webui\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "W:\stablediffusion v2\webui\scripts\postprocessing_gfpgan.py", line 29, in process
        res = Image.blend(pp.image, res, gfpgan_visibility)
      File "W:\stablediffusion v2\system\python\lib\site-packages\PIL\Image.py", line 3340, in blend
        return im1._new(core.blend(im1.im, im2.im, alpha))
    ValueError: images do not match

---
*** Error completing request
*** Arguments: ('task(3mdy8dmj69j1luo)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1150 at 0x289123D2200>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, True, 0.345, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {}
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 71, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "W:\stablediffusion v2\webui\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "W:\stablediffusion v2\webui\scripts\postprocessing_gfpgan.py", line 29, in process
        res = Image.blend(pp.image, res, gfpgan_visibility)
      File "W:\stablediffusion v2\system\python\lib\site-packages\PIL\Image.py", line 3340, in blend
        return im1._new(core.blend(im1.im, im2.im, alpha))
    ValueError: images do not match

---
*** Error completing request
*** Arguments: ('task(lv65ayupoqo2u2a)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1150 at 0x289123E1810>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'None', 'None', 0, True, 0.036, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru']) {}
    Traceback (most recent call last):
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "W:\stablediffusion v2\webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 131, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "W:\stablediffusion v2\webui\modules\postprocessing.py", line 71, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "W:\stablediffusion v2\webui\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "W:\stablediffusion v2\webui\scripts\postprocessing_gfpgan.py", line 29, in process
        res = Image.blend(pp.image, res, gfpgan_visibility)
      File "W:\stablediffusion v2\system\python\lib\site-packages\PIL\Image.py", line 3340, in blend
        return im1._new(core.blend(im1.im, im2.im, alpha))
    ValueError: images do not match

---

Additional information

Only automatic updates to the latest version to date, version 1.9

marchcat69 commented 1 month ago

scripts/postprocessing_gfpgan.py in line 29: change this: res = Image.blend(pp.image, res, gfpgan_visibility) to this: res = Image.blend(pp.image.convert("RGB"), res, gfpgan_visibility)

scripts/postprocessing_codeformer.py in line 32: change this: res = Image.blend(pp.image, res, codeformer_visibility) to this: res = Image.blend(pp.image.convert("RGB"), res, codeformer_visibility)

PawAlldeller commented 1 month ago

scripts/postprocessing_gfpgan.py in line 29: change this: res = Image.blend(pp.image, res, gfpgan_visibility) to this: res = Image.blend(pp.image.convert("RGB"), res, gfpgan_visibility)

scripts/postprocessing_codeformer.py in line 32: change this: res = Image.blend(pp.image, res, codeformer_visibility) to this: res = Image.blend(pp.image.convert("RGB"), res, codeformer_visibility)

Thanks, this helped!

Is this a bug on my system, or will there be a fix in the new updates?

Now updated to the latest version, same story. Will you have to edit each subsequent version manually?

marchcat69 commented 3 weeks ago

Thanks, this helped!

Is this a bug on my system, or will there be a fix in the new updates?

Now updated to the latest version, same story. Will you have to edit each subsequent version manually?

Apparently, none of the developers care about this problem. I don't know if this will be fixed.