Skip to content

DPM++ leaves residual noise in SDXL images, which is unexpected #5689

Open
@nhnt11

Description

@nhnt11

Describe the bug

When using DPM++ with SDXL, there is residual noise in the result.

Upon investigation, my colleague @CodeCorrupt and I found that the final sigma was non-zero which we empirically deemed to be the culprit - i.e. when we set the final sigma to 0 artificially, the images were clean.

Reproduction

import torch
from diffusers import StableDiffusionXLPipeline
from typing import cast
from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline, 

sdxl_model = cast(StableDiffusionXLPipeline, StableDiffusionXLPipeline.from_pretrained(
    'stabilityai/stable-diffusion-xl-base-1.0',
    torch_dtype=torch.float16,
    use_safetensors=True,
    variant="fp16",
    revision="76d28af79639c28a79fa5c6c6468febd3490a37e",
)).to('cuda')
common_config = {'beta_start': 0.00085, 'beta_end': 0.012, 'beta_schedule': 'scaled_linear'}
scheduler =  DPMSolverMultistepScheduler(**common_config)

generator = torch.Generator(device='cuda')
sdxl_model.scheduler = scheduler
generator.manual_seed(96404382)
params = {
    'prompt': ['clorful abstract background, glowing gradient waves on black background'],
    'negative_prompt': [''],
    "num_inference_steps": 40,
    "guidance_scale": 8,
    "width": 1024,
    "height": 1024
}
sdxl_res = sdxl_model(**params, generator=generator, output_type='pil')
sdxl_img = sdxl_res.images[0]
display(sdxl_img)

Output with diffusers main:
image

Output with a hack to set the last sigma to 0:
image

Logs

No response

System Info

  • diffusers version: 0.22.1
  • Platform: Linux-5.4.0-166-generic-x86_64-with-glibc2.31
  • Python version: 3.11.5
  • PyTorch version (GPU?): 2.1.0+cu121 (True)
  • Huggingface_hub version: 0.17.1
  • Transformers version: 4.34.0
  • Accelerate version: 0.22.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

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