huggingface / huggingface/diffusers

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

Abierto
#5,689 13 comentarios 1 reacción 1 asignado Reclamado por @yiyixuxu Ver en GitHub
bug scheduler stale
Lenguaje dominante
Python
Estrellas
34.5k
Forks
7.3k
Merge medio
3 d 3 h
PR fusionados (30 d)
91

Descripción

### 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

```python3
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](https://github.com/huggingface/diffusers/assets/485488/136d7ee9-7864-4d22-8381-4d5d3ef80ee0)

Output with a hack to set the last sigma to 0:
![image](https://github.com/huggingface/diffusers/assets/485488/82bd3da4-1c48-45ba-b900-0fd3c15db2c9)

### 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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.