huggingface / huggingface/diffusers

DDIM previous timestep issue

Offen
#11,347 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug stale
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.