DDPMScheduler allows num_inference_steps=0 without validation (inconsistent with DDIMScheduler)

Open Beginner friendly
#13,394 2 comments 0 reactions 0 assignees View on GitHub

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

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

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/diffusers

All issues in huggingface/diffusers

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.