InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Error with starter model dreamshaper 8 and certain schedulers

Open psychedelicious opened this issue 9 months ago • 1 comments

Is there an existing issue for this problem?

  • [X] I have searched the existing issues

Operating system

Linux

GPU vendor

Nvidia (CUDA)

GPU model

No response

GPU VRAM

24

Version number

4.2.1

Browser

FF

Python dependencies

No response

What happened

When using the starter model dreamshaper 8 (or dreamshaper 8 inpainting) and some schedulers, generation fails during denoising.

Only these schedulers trigger the error:

  • DPM++ 2M
  • DPM++ 2M Karras
  • DPM++ 2S
  • DPM++ 2S Karras
[2024-05-15 08:41:36,681]::[InvokeAI]::ERROR --> Error while invoking session 7c0fe7a9-5eab-454e-877c-98802fec7854, invocation 08dbe0a3-30d8-4da7-a510-a5ac52264c8e (denoise_latents):
`final_sigmas_type` zero is not supported for `algorithm_type` deis. Please choose `sigma_min` instead.
[2024-05-15 08:41:36,681]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/session_processor/session_processor_default.py", line 185, in _process
    outputs = self._invocation.invoke_internal(
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/invocations/baseinvocation.py", line 281, in invoke_internal
    output = self.invoke(context)
  File "/home/bat/Documents/Code/InvokeAI/.venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/invocations/latent.py", line 948, in invoke
    scheduler = get_scheduler(
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/invocations/latent.py", line 313, in get_scheduler
    scheduler = scheduler_class.from_config(scheduler_config)
  File "/home/bat/Documents/Code/InvokeAI/.venv/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 259, in from_config
    model = cls(**init_dict)
  File "/home/bat/Documents/Code/InvokeAI/.venv/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 653, in inner_init
    init(self, *args, **init_kwargs)
  File "/home/bat/Documents/Code/InvokeAI/.venv/lib/python3.10/site-packages/diffusers/schedulers/scheduling_dpmsolver_multistep.py", line 268, in __init__
    raise ValueError(
ValueError: `final_sigmas_type` zero is not supported for `algorithm_type` deis. Please choose `sigma_min` instead.

The starter models tab installs a diffusers version of the affected models. When using the checkpoint version of this model, there is no error.

What you expected to happen

All the schedulers work.

How to reproduce the problem

No response

Additional context

No response

Discord username

No response

psychedelicious avatar May 14 '24 22:05 psychedelicious

I'd guess it's picking up algorithm-type 'deis' from the default scheduler for the model which is DEISMultistepScheduler, and using that in the scheduler config for the DPM schedulers. DEISMultistepScheduler however doesn't have a final_sigmas_type parameter so it's using the default 'zero' value for final_sigmas_type from the DPM schedulers which is not compatible with the deis algorithm type.

It's probably going to need a check for this in the code which picks other f the values to change (algorithm type would seem most sensible to me, so DPM using its default value) unless the InvokeAI team give us a way of changing the scheduler parameters.

Vargol avatar May 22 '24 18:05 Vargol

Just confirming that this is happening with dreamshaper 9 inpaint and the Orthodox Christian Iconography LoRA if you wanna test. https://civitai.com/models/146025/orthodox-christian-iconography-artstyle-lora

Earnest-Williams avatar Jun 20 '24 04:06 Earnest-Williams

I had a similar issue and attempted to fix by updating the below files. afterwards, i can see the image generating in the UI but as soon as it reaches 100%, the entire images turns black.

  1. changed from zero to sigma_min file: C:\Users\vvv\invokeai.venv\Lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py line 210: final_sigmas_type: Optional[str] = "sigma_min", # "zero", "sigma_min"

  2. changed from duis to sigma_min file: C:\Users\vidur\invokeai.venv\Lib\site-packages\diffusers\schedulers\scheduling_deis_multistep.py line 171: self.register_to_config(algorithm_type="sigma_min")

This was the error message in UI for me: Server Error ValueError: final_sigmas_type zero is not supported for algorithm_type deis. Please choose sigma_min instead

and error message in CMD: [2024-10-28 10:18:34,793]::[uvicorn.access]::INFO --> 127.0.0.1:54900 - "GET /api/v1/queue/default/current HTTP/1.1" 200 [2024-10-28 10:18:37,335]::[InvokeAI]::ERROR --> Error while invoking session 2e06cf0b-58c8-499e-9cea-3e44eb4ed688, invocation e4256eaf-053b-4f33-adfb-8b0cb1b5faef (denoise_latents): final_sigmas_type zero is not supported for algorithm_type deis. Please choose sigma_min instead. [2024-10-28 10:18:37,337]::[InvokeAI]::ERROR --> Traceback (most recent call last): File "C:\Users\vvv\invokeai\.venv\lib\site-packages\invokeai\app\services\session_processor\session_processor_default.py", line 129, in run_node output = invocation.invoke_internal(context=context, services=self._services) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\invokeai\app\invocations\baseinvocation.py", line 290, in invoke_internal output = self.invoke(context) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 792, in invoke return self._old_invoke(context) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "C:\Python310\lib\contextlib.py", line 79, in inner return func(*args, **kwds) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 1001, in _old_invoke scheduler = get_scheduler( File "C:\Users\vvv\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 106, in get_scheduler scheduler = scheduler_class.from_config(scheduler_config) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\diffusers\configuration_utils.py", line 259, in from_config model = cls(**init_dict) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\diffusers\configuration_utils.py", line 653, in inner_init init(self, *args, **init_kwargs) File "C:\Users\vvv\invokeai\.venv\lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py", line 268, in __init__ raise ValueError( ValueError: final_sigmas_type zero is not supported for algorithm_type deis. Please choose sigma_min instead.

vidura-dissanayake avatar Oct 28 '24 00:10 vidura-dissanayake