Skip to content

DPMSolverMultistepScheduler using karras_sigmas doesn't work anymore #7214

@Bigfield77

Description

@Bigfield77

Describe the bug

I had modified the comfyui extension from Zuellni https://github.com/Zuellni/ComfyUI-Custom-Nodes

to enable karras_sigmas for the deepfloyd IF model.

This has stopped working a few months ago, i get an error when enabling karras_sigmas now:
ERROR:root:Traceback (most recent call last):
File "D:\stable\comfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\stable\comfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "D:\stable\comfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\stable\comfyUI\ComfyUI\custom_nodes\ComfyUI-Custom-Nodes\Nodes\IF.py", line 275, in process
images = model(
File "D:\stable\comfyUI\comf\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\pipelines\deepfloyd_if\pipeline_if.py", line 742, in call
intermediate_images = self.scheduler.step(
File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py", line 908, in step
prev_sample = self.multistep_dpm_solver_second_order_update(self.model_outputs, sample=sample, noise=noise)
File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py", line 649, in multistep_dpm_solver_second_order_update
self.sigmas[self.step_index + 1],
IndexError: index 101 is out of bounds for dimension 0 with size 101

Prompt executed in 19.44 seconds

It used to make the deepfloyd if generation faster by stopping at step 47 out of a 100. now it seems to try to go further than max step.

Reproduction

//load model:
model = DiffusionPipeline.from_pretrained(
f"DeepFloyd/IF-{class._MODELS[model]}-v1.0",
text_encoder=None,
**class._CONFIG,
)

    if scheduler == "sde-dpmsolver++":
        SdeScheduler = DPMSolverMultistepScheduler.from_config(model.scheduler.config)
        SdeScheduler.config.algorithm_type = 'sde-dpmsolver++'
        model.scheduler= SdeScheduler
            
    if (karrasSigmas) :
        model.scheduler.config.use_karras_sigmas=True

    return self.offload(model, device)

//call generation:
images = model(
prompt_embeds=positive,
negative_prompt_embeds=negative,
height=height,
width=width,
generator=torch.manual_seed(seed),
guidance_scale=cfg,
num_images_per_prompt=batch_size,
num_inference_steps=steps,
callback=callback,
output_type="pt",
).images

Logs

ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
  File "D:\stable\comfyUI\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\stable\comfyUI\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "D:\stable\comfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "D:\stable\comfyUI\ComfyUI\custom_nodes\ComfyUI-Custom-Nodes\Nodes\IF.py", line 275, in process
    images = model(
  File "D:\stable\comfyUI\comf\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\pipelines\deepfloyd_if\pipeline_if.py", line 742, in __call__
    intermediate_images = self.scheduler.step(
  File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py", line 908, in step
    prev_sample = self.multistep_dpm_solver_second_order_update(self.model_outputs, sample=sample, noise=noise)
  File "D:\stable\comfyUI\comf\lib\site-packages\diffusers\schedulers\scheduling_dpmsolver_multistep.py", line 649, in multistep_dpm_solver_second_order_update
    self.sigmas[self.step_index + 1],
IndexError: index 101 is out of bounds for dimension 0 with size 101

System Info

windows 11, cuda, diffusers 0.27.0.dev0

Who can help?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions