Skip to content

ControlNetPipeline mixes up width and height #2893

@antoche

Description

@antoche

Describe the bug

In the same vein as #2558

StableDiffusionControlNetPipeline gets width and height wrong in _default_height_width (https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_controlnet.py#L692):

                height = image.shape[3]
                width = image.shape[2]

Should be

                height = image.shape[-2]
                width = image.shape[-1]

(I recommend using negative shape indices so the code can work on BxCxHxW layout as well as CxHxW layout)

Reproduction

Pass a non-square image to StableDiffusionControlNetPipeline

Logs

No response

System Info

Any

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions