huggingface / huggingface/diffusers
DDPMScheduler allows num_inference_steps=0 without validation (inconsistent with DDIMScheduler)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
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
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.
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.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100