huggingface / huggingface/diffusers

[BUG] FlowMatchEulerDiscreteScheduler.__init__ computes sigma_min/sigma_max after shift, causing duplicate shift in set_timesteps

Open
#13,243 2 comments 0 reactions 1 assignee Claimed by @dg845 View on GitHub
bug
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
91

Description

### Describe the bug

There is an initialization order issue in the FlowMatchEulerDiscreteScheduler class that causes set_timesteps to apply timestep shifting twice, resulting in different sigma values for the same timestep settings.
https://github.com/huggingface/diffusers/blob/07a63e197e10860a470576cf4f610381b31a4dd7/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L132-L143
Then in the set_timesteps method:
https://github.com/huggingface/diffusers/blob/07a63e197e10860a470576cf4f610381b31a4dd7/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L333-L350

sigma_min will be saved after shift and used to generate a new list of sigma, then there is another shift happening :).

### Reproduction

scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(
os.path.join(model_path, "scheduler"),
)
# default scheduler.num_train_timesteps=1000,shift=3.0
print(scheduler.sigmas)
scheduler.set_timesteps(1000)
print(scheduler.sigmas)

### Logs

```shell

```

### System Info

Environment
diffusers version
Python 3.13
Affected file: diffusers/schedulers/scheduling_flow_match_euler_discrete.py

### Who can help?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.