Skip to content

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

@Akash504-ai

Description

@Akash504-ai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions