InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: System Error with most Karras schedulers when using certain models

Open CubeTheThird opened this issue 1 year ago • 3 comments

Is there an existing issue for this problem?

  • [X] I have searched the existing issues

Operating system

Linux

GPU vendor

AMD (ROCm)

GPU model

RX 6700 XT

GPU VRAM

12GB

Version number

5.4.2

Browser

Firefox 132.0.2

Python dependencies

{ "accelerate": "1.0.1", "compel": "2.0.2", "cuda": null, "diffusers": "0.31.0", "numpy": "1.26.4", "opencv": "4.9.0.80", "onnx": "1.16.1", "pillow": "10.4.0", "python": "3.10.13", "torch": "2.4.1+rocm6.1", "torchvision": "0.19.1+rocm6.1", "transformers": "4.41.1", "xformers": null }

What happened

Error logged when attempting to use most Karras schedulers. Errors are like this:

[2024-11-24 18:55:46,409]::[InvokeAI]::ERROR --> Error while invoking session 6f07aea6-40b5-4ed0-bd42-af1133b61b39, invocation 8e57df48-c81e-4e5e-ae74-d3599102a320 (denoise_latents): index 36 is out of bounds for dimension 0 with size 36
[2024-11-24 18:55:46,409]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File ".venv/lib/python3.10/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 ".venv/lib/python3.10/site-packages/invokeai/app/invocations/baseinvocation.py", line 300, in invoke_internal
    output = self.invoke(context)
  File ".venv/lib/python3.10/site-packages/invokeai/app/invocations/denoise_latents.py", line 812, in invoke
    return self._old_invoke(context)
  File ".venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File ".venv/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File ".venv/lib/python3.10/site-packages/invokeai/app/invocations/denoise_latents.py", line 1073, in _old_invoke
    result_latents = pipeline.latents_from_embeddings(
  File ".venv/lib/python3.10/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 394, in latents_from_embeddings
    step_output = self.step(
  File ".venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File ".venv/lib/python3.10/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 571, in step
    step_output = self.scheduler.step(noise_pred, timestep, latents, **scheduler_step_kwargs)
  File ".venv/lib/python3.10/site-packages/diffusers/schedulers/scheduling_dpmsolver_multistep.py", line 1074, in step
    prev_sample = self.multistep_dpm_solver_third_order_update(self.model_outputs, sample=sample)
  File ".venv/lib/python3.10/site-packages/diffusers/schedulers/scheduling_dpmsolver_multistep.py", line 928, in multistep_dpm_solver_third_order_update
    self.sigmas[self.step_index + 1],
IndexError: index 36 is out of bounds for dimension 0 with size 36

What you expected to happen

The image to generate normally, like their non-Karras counterparts.

How to reproduce the problem

Obtain the DucHaiten-Pony-XL (no-score), alternative download on HuggingFace

Additional context

The schedulers that failed are as follows:

DEIS Karras DPM++ 2S Karras DPM++ 2M Karras DPM++ 2M SDE Karras DPM++ 3M Karras Euler Karras Heun Karras

Additionally, these two, while not failing outright, resulted in black images:

KDPM2 Karras KDPM2 Ancestral Karras

Discord username

cubethethird

CubeTheThird avatar Nov 25 '24 01:11 CubeTheThird

This error still occurs in Invoke 5.7.2

The error message appears to be slightly different:

[2025-03-06 13:04:08,510]::[InvokeAI]::ERROR --> Error while invoking session c30793f0-5e94-4da2-bce6-e92f0861a949, invocation a9f24c5e-f6bd-46c6-9c83-8df567abf6a7 (denoise_latents): list index out of range
[2025-03-06 13:04:08,511]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File "invokeai2/venv/lib/python3.10/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 "invokeai2/venv/lib/python3.10/site-packages/invokeai/app/invocations/baseinvocation.py", line 303, in invoke_internal
    output = self.invoke(context)
  File "invokeai2/venv/lib/python3.10/site-packages/invokeai/app/invocations/denoise_latents.py", line 824, in invoke
    return self._old_invoke(context)
  File "invokeai2/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "invokeai2/venv/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "invokeai2/venv/lib/python3.10/site-packages/invokeai/app/invocations/denoise_latents.py", line 1087, in _old_invoke
    result_latents = pipeline.latents_from_embeddings(
  File "invokeai2/venv/lib/python3.10/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 394, in latents_from_embeddings
    step_output = self.step(
  File "invokeai2/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "invokeai2/venv/lib/python3.10/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 571, in step
    step_output = self.scheduler.step(noise_pred, timestep, latents, **scheduler_step_kwargs)
  File "invokeai2/venv/lib/python3.10/site-packages/diffusers/schedulers/scheduling_dpmsolver_singlestep.py", line 1056, in step
    order = self.order_list[self.step_index]
IndexError: list index out of range

CubeTheThird avatar Mar 06 '25 18:03 CubeTheThird

I've found that I can reproduce this error with certain models:

jib-mix-pony-realistic-v2-sdxl damn-ponyxl-realistic-model-v3-sdxl jib-mix-realistic-xl-v15-maximus-sdxl realism-by-stable-yogi-sdxlv2-sdxl

Scheduler is DPM++ 2D Karras, 31 steps

firesign avatar Mar 19 '25 22:03 firesign

Still occurs in 5.9.0

CubeTheThird avatar Mar 28 '25 12:03 CubeTheThird

Still occurs in 5.10.1

CubeTheThird avatar Apr 22 '25 12:04 CubeTheThird

Still occurs in 5.11

CubeTheThird avatar May 13 '25 14:05 CubeTheThird

Still an issue in Invoke 5.12

CubeTheThird avatar May 25 '25 19:05 CubeTheThird

Still an issue in Invoke 5.14

CubeTheThird avatar Jun 09 '25 13:06 CubeTheThird

Still an issue in Invoke 6.0.0

CubeTheThird avatar Jul 09 '25 15:07 CubeTheThird