huggingface / huggingface/diffusers

DDIMScheduler (or DDPM) of StableDiffusion with 1000 num_inference_steps bugs out

Aperta
#10,003 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug stale
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

### Describe the bug

There's something going on with the set_timesteps offset parameters on Stable Diffusion (1v4). The timesteps are set from 1->1000 instead from 0, and so it tries to index out of bounds

### Reproduction

```
model_id = "CompVis/stable-diffusion-v1-4"
scheduler = DDIMScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler).to(device)
pipe("an image of a cat", num_inference_steps=1000)
```

gives
`IndexError: index 1000 is out of bounds for dimension 0 with size 1000`
because `scheduler.timesteps` gives: `tensor([1000, 999, 998, 997, ..., 3, 2, 1], device='cuda:0')`
instead of `tensor([999, 998, 997, ..., 3, 2, 1, 0], device='cuda:0')`

### Logs

_No response_

### System Info

ste the text below in your GitHub issue and FILL OUT the two last points.

- 🤗 Diffusers version: 0.31.0
- Platform: Linux-5.15.0-119-generic-x86_64-with-glibc2.31
- Running on Google Colab?: No
- Python version: 3.12.7
- PyTorch version (GPU?): 2.5.1+cu124 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface_hub version: 0.26.2
- Transformers version: 4.46.3
- Accelerate version: 1.1.1
- PEFT version: not installed
- Bitsandbytes version: not installed
- Safetensors version: 0.4.5
- xFormers version: 0.0.28.post3
- Accelerator: NVIDIA RTX A6000, 49140 MiB

### Who can help?

@yiyixuxu @asomoza @sayakpaul @DN6

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with DDIMScheduler.set_timesteps and reproduce the issue using the StableDiffusionPipeline example with num_inference_steps=1000. Check that the generated timesteps stay within the 0–999 range and that the pipeline completes without the reported IndexError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, pytorch
Ambito
ai, machine-learning
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.