Skip to content

[ControlNet] Usage example fails with the default scheduler #3927

Description

@sayakpaul

The StableDiffusionControlNetPipeline errors out with the default scheduler (PNDM).

I took the code example from here: https://huggingface.co/docs/diffusers/main/en/api/pipelines/controlnet#usage-example.

To get reproducible results, check out the Colab Notebook: https://colab.research.google.com/gist/sayakpaul/4f1f1114e7c8cc38a241f7629ee0698a/scratchpad.ipynb

Error trace:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 33>:33                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py:115 in decorate_context       │
│                                                                                                  │
│   112 │   @functools.wraps(func)                                                                 │
│   113 │   def decorate_context(*args, **kwargs):                                                 │
│   114 │   │   with ctx_factory():                                                                │
│ ❱ 115 │   │   │   return func(*args, **kwargs)                                                   │
│   116 │                                                                                          │
│   117 │   return decorate_context                                                                │
│   118                                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.10/dist-packages/diffusers/pipelines/controlnet/pipeline_controlnet.py:97 │
│ 5 in __call__                                                                                    │
│                                                                                                  │
│    972 │   │   │   │   │   control_model_input = latent_model_input                              │
│    973 │   │   │   │   │   controlnet_prompt_embeds = prompt_embeds                              │
│    974 │   │   │   │                                                                             │
│ ❱  975 │   │   │   │   if isinstance(controlnet_keep[i], list):                                  │
│    976 │   │   │   │   │   cond_scale = [c * s for c, s in zip(controlnet_conditioning_scale, c  │
│    977 │   │   │   │   else:                                                                     │
│    978 │   │   │   │   │   cond_scale = controlnet_conditioning_scale * controlnet_keep[i]       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: list index out of range

Somehow the scheduler adds an additional timestep after:

self.scheduler.set_timesteps(num_inference_steps, device=device)

Cc: @patrickvonplaten

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions