huggingface / huggingface/diffusers

DDIM previous timestep issue

Aperta
#11,347 1 commento 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

When using `diffusers.schedulers.scheduling_ddim.DDIMScheduler` with timestep_spacing='linspace' the value of the previous timestep that is calculated is not the right one, leading to a drop in model performance.

If you run the attached code with `print(timestep,prev_timestep,prev_timestep_)` added just after calculating the previous timestep in the step fn, you can see that the timestep and prev_timestep do not match from one iteration to the next.

### Reproduction

from diffusers.schedulers.scheduling_ddim import DDIMScheduler
import torch

ddim_scheduler = DDIMScheduler(
num_train_timesteps=100,
beta_schedule='squaredcos_cap_v2',
clip_sample=True,
prediction_type='epsilon',
timestep_spacing='linspace',
)

ddim_scheduler.set_timesteps(5)

for i in ddim_scheduler.timesteps:
noise = torch.randn(1, 3, 64, 64)
a = ddim_scheduler.step(noise,i,noise)

### Logs

```shell

```

### System Info

Name: diffusers
Version: 0.32.2
Summary: State-of-the-art diffusion in PyTorch and JAX.
Home-page: https://github.com/huggingface/diffusers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)
Author-email: diffusers@huggingface.co
License: Apache 2.0 License
Location: /home/m84396953/miniconda3/envs/eaib/lib/python3.12/site-packages
Requires: filelock, huggingface-hub, importlib-metadata, numpy, Pillow, regex, requests, safetensors
Required-by:

Python 3.12.8

### Who can help?

_No response_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in diffusers.schedulers.scheduling_ddim.DDIMScheduler, reviewing set_timesteps and the step method around the previous-timestep calculation. Run the provided Python reproduction with the suggested timestep prints and compare consecutive values. Done means the calculated previous timestep matches the scheduler's timestep sequence and the reported performance issue is addressed.

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

Valutazione

Stack tecnologico
python, pytorch
Ambito
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.