Skip to content

DPMSolverSinglestepScheduler, SD generates blank images at EVEN step numbers #6949

Closed
@Vargol

Description

@Vargol

Describe the bug

If DPMSolverSinglestepScheduler is used as a schedule with a stable diffusion pipeline the image generated by stable diffusion is a blank, black image if the number of inference steps is even.

Here's a shared Colab ready to go
https://colab.research.google.com/drive/1AUOvWu380FDJE0J0XOWKPBqX4qR2wUpZ?usp=sharing
Note this has the step numbers as (10,12, 11, 13, 14) as I wanted to check it wasn't just every other run worked

Reproduction

%pip install --quiet --upgrade diffusers transformers accelerate mediapy torchaudio torchdata torchtext torchvision
import mediapy as media
from diffusers import DiffusionPipeline, DPMSolverSinglestepScheduler

from diffusers import DiffusionPipeline, AutoencoderKL, UNet2DConditionModel, DPMSolverSinglestepScheduler

model_ref = "runwayml/stable-diffusion-v1-5"

prompt = "A film still of a teddy bear standing in a lush green jungle"

pipe = DiffusionPipeline.from_pretrained(
      model_ref,
      use_safetensors=True,
      safety_checker=None
     )
pipe.to('cuda')

pipe.scheduler =  DPMSolverSinglestepScheduler.from_config(pipe.scheduler.config)

for i in (10,11, 12, 13, 14):

  images = pipe(
    prompt = prompt,
    num_inference_steps=i,
    guidance_scale=8
    ).images

  print(f'num_inference_steps {i}')
  media.show_images(images)



### Logs

```shell
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .

System Info

  • diffusers version: 0.26.2
  • Platform: Linux-6.1.58+-x86_64-with-glibc2.35
  • Python version: 3.10.12
  • PyTorch version (GPU?): 2.2.0+cu121 (True)
  • Huggingface_hub version: 0.20.3
  • Transformers version: 4.37.2
  • Accelerate version: 0.27.0
  • xFormers version: not installed
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Who can help?

@yiyixuxu @patrickvonplaten

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingschedulerstaleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions