DDPMScheduler allows num_inference_steps=0 without validation (inconsistent with DDIMScheduler)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python, pytorch
- Domain
- machine-learning, testing-qa
Research direction
Start with DDPMScheduler.set_timesteps and compare its handling of num_inference_steps with DDIMScheduler. Reproduce the zero-step case, then add validation and a regression test confirming that zero raises the expected ValueError. Done means the invalid input is rejected consistently with DDIMScheduler.
Written by the indexing model from the issue text.
Description
Describe the bug
Bug description
The DDPMScheduler.set_timesteps method does not validate the value of num_inference_steps.
Passing num_inference_steps=0 does not raise an error and can lead to invalid internal state or unexpected behavior.
This is inconsistent with DDIMScheduler, which already validates this case and raises a ValueError.
I plan to submit a PR to fix this by adding proper validation and tests.
Reproduction
Reproduction
from diffusers import DDPMScheduler
scheduler = DDPMScheduler()
scheduler.set_timesteps(num_inference_steps=0)
Current behavior
No error is raised.
Expected behavior
ValueError: num_inference_steps must be > 0
Logs
No logs - issue is silent (no exception raised).
System Info
-
Diffusers version: 0.38.0.dev0
-
Platform: Windows-11
-
Python version: 3.13.9
-
PyTorch version (GPU?): 2.11.0+cpu (False)
-
Huggingface_hub version: 1.8.0
-
Safetensors version: 0.7.0
-
Accelerator: NVIDIA GeForce RTX 2050 (4GB)
-
Using GPU in script?: No
-
Using distributed or parallel set-up in script?: No
Who can help?
@yiyixuxu
- Dominant language
- Python
- Stars
- 34.6k
- Forks
- 7.3k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 74
Contributor 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
-
bug needs-env-info pipelines
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
huggingface/diffusers#14794 ·
-
bug needs-code-example needs-env-info pipelines
Difficulty 1/5 Under an hour Newbie friendliness 86/100
huggingface/diffusers#14780 · 1 comment ·
-
bug pipelines
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/diffusers#14769 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
huggingface/diffusers#14639 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
huggingface/diffusers#14616 ·
All issues in huggingface/diffusers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100