TCDScheduler ignores set_alpha_to_one in the terminal update
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #15292 by @twojian — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 18/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- ai, machine-learning
Research direction
The terminal-step alpha is read from alphas_cumprod[0] in the TCDScheduler step logic, not from final_alpha_cumprod, so set_alpha_to_one has no effect there. Run the reproduction snippet on CPU to confirm both flags return about 0.0292. Done means the True case returns 0 while the False case is unchanged, and this needs a maintainer decision on the intended semantics. Linked PR #15292 already proposes a fix, so check it before starting.
Written by the indexing model from the issue text.
Description
Describe the bug
TCDScheduler documents that set_alpha_to_one=True sets the final alpha cumulative product to 1. However, the terminal update currently uses alphas_cumprod[0], regardless of that setting.
As a result, set_alpha_to_one=True and False produce the same terminal output in the following CPU reproduction.
The terminal update uses alphas_cumprod[0] instead of final_alpha_cumprod, bypassing the set_alpha_to_one configuration.
The TCD reference implementation also uses index 0 at the endpoint, so this may be an intentional compatibility choice rather than an implementation oversight. However, it differs from the documented behavior.
I have submitted PR #15292 with a proposed fix and CPU regression tests. Maintainer guidance on the intended terminal-alpha semantics would be appreciated.
Reproduction
import torch
from diffusers import TCDScheduler
for flag in (True, False):
scheduler = TCDScheduler(
prediction_type="sample",
set_alpha_to_one=flag,
)
scheduler.set_timesteps(1, device="cpu")
sample = torch.ones(1, 1)
result = scheduler.step(
torch.zeros_like(sample),
scheduler.timesteps[0],
sample,
)
print(flag, result.prev_sample.item())
Observed behavior: both settings return approximately 0.0292233.
Expected behavior under the documented terminal-alpha semantics: the True case returns 0, while the False case retains the existing output.
Context
While investigating TCDScheduler's terminal-step behavior and validating scheduler correctness on CPU, I found that changing set_alpha_to_one had no effect on the terminal output.
This matters for users relying on the documented scheduler configuration and for reproducibility when comparing different terminal-alpha settings.
Logs
System Info
- OS: Windows
- Diffusers: 0.44.0.dev0 (development version)
- Device: CPU
- PyTorch: 2.9.0+cu126
- Python: 3.12.8
The minimal reproduction uses CPU only and does not require CUDA.
Who can help?
No response
- Dominant language
- Python
- Stars
- 35k
- Forks
- 7.5k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 58
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from huggingface/diffusers
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
huggingface/diffusers#15436 · 1 comment ·
Maintainers usually reply within 1 day
-
InpaintProcessor crashes when padding_mask_crop is set and a dimension is omittedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
huggingface/diffusers#15433 ·
Maintainers usually reply within 1 day
-
LTXEulerAncestralRFScheduler skips signal scaling with s_noise=0Possibly taken @hparik11 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
huggingface/diffusers#15423 · 2 comments ·
Maintainers usually reply within 1 day
-
Docs: 13 docstrings document parameters their functions don't havePossibly taken @M-Colley claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
huggingface/diffusers#15363 · 2 comments ·
Maintainers usually reply within 1 day
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorPossibly taken @chessing234 claimed this 11 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
huggingface/diffusers#15337 · 3 comments ·
Maintainers usually reply within 1 day
All issues in huggingface/diffusers
Similar issues
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-connect#1266 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
biosustain/growthcurves_app#89 ·
Maintainers usually reply within 1 day
-
`LogProxyConsumer._on_relation_departed` raises `APIError` when the promtail service does not existOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
canonical/loki-k8s-operator#695 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day