sgl-project/sglang · error · ValueError

The current scheduler class {scheduler.__class__}'s `set_tim

Error message

The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom sigmas schedules. Please check whether you are using the correct scheduler.

What it means

Mirror of the timesteps check: when a custom sigmas array is passed, the scheduler's set_timesteps must accept a sigmas parameter. Classic timestep-based schedulers (DDPM/DDIM) do not, so custom sigma schedules are rejected with this error.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/qwen_image_layered.py:145

        )
    if timesteps is not None:
        accepts_timesteps = "timesteps" in set(
            inspect.signature(scheduler.set_timesteps).parameters.keys()
        )
        if not accepts_timesteps:
            raise ValueError(
                f"The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom"
                f" timestep schedules. Please check whether you are using the correct scheduler."
            )
        scheduler.set_timesteps(timesteps=timesteps, device=device, **kwargs)
        timesteps = scheduler.timesteps
        num_inference_steps = len(timesteps)
    elif sigmas is not None:
        accept_sigmas = "sigmas" in set(
            inspect.signature(scheduler.set_timesteps).parameters.keys()
        )
        if not accept_sigmas:
            raise ValueError(
                f"The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom"
                f" sigmas schedules. Please check whether you are using the correct scheduler."
            )
        scheduler.set_timesteps(sigmas=sigmas, device=device, **kwargs)
        timesteps = scheduler.timesteps
        num_inference_steps = len(timesteps)
    else:
        scheduler.set_timesteps(num_inference_steps, device=device, **kwargs)
        timesteps = scheduler.timesteps
    return timesteps, num_inference_steps


class QwenImageLayeredBeforeDenoisingStage(PipelineStage):
    def __init__(
        self,
        vae,
        text_encoder,
        tokenizer,

View on GitHub (pinned to 0132848349)

Solutions

  1. Use timesteps=[...] instead for timestep-based schedulers.
  2. Or set a sigma-capable scheduler (FlowMatchEulerDiscreteScheduler etc.) in the pipeline config.
  3. Use num_inference_steps and let the scheduler build its own schedule.

Example fix

# before
stage(..., sigmas=[14.6, 5.0, 0.0])  # scheduler is DDPM

# after
stage(..., timesteps=[999, 500, 100])
Defensive patterns

Strategy: validation

Validate before calling

import inspect
if sigmas is not None:
    assert "sigmas" in inspect.signature(scheduler.set_timesteps).parameters, "scheduler lacks sigmas support; use timesteps"

Type guard

def scheduler_accepts_sigmas(scheduler) -> bool:
    return "sigmas" in inspect.signature(scheduler.set_timesteps).parameters

Prevention

When it happens

Trigger: Passing sigmas=[...] while the pipeline is configured with a scheduler whose set_timesteps only takes num_inference_steps/timesteps (e.g. DDPMScheduler, LMSDiscreteScheduler variants without sigma support).

Common situations: Copy-pasting flow-matching inference code (Qwen-Image, SD3-style) into a pipeline with a DDIM/DDPM scheduler; scheduler swap via config without updating call sites.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/17be7c50d3ee2e59. Report an issue: GitHub.