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 timestep schedules. Please check whether you are using the correct scheduler. What it means
When you pass a custom timesteps array, retrieve_timesteps introspects scheduler.set_timesteps and requires it to accept a timesteps parameter. Some schedulers (notably sigma/flow-matching schedulers like FlowMatchEulerDiscreteScheduler) only accept sigmas, so a custom timestep schedule is unsupported and rejected.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/qwen_image_layered.py:133
`num_inference_steps` and `sigmas` must be `None`.
sigmas (`List[float]`, *optional*):
Custom sigmas used to override the timestep spacing strategy of the scheduler. If `sigmas` is passed,
`num_inference_steps` and `timesteps` must be `None`.
Returns:
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
second element is the number of inference steps.
"""
if timesteps is not None and sigmas is not None:
raise ValueError(
"Only one of `timesteps` or `sigmas` can be passed. Please choose one to set custom values"
)
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)View on GitHub (pinned to 0132848349)
Solutions
- Switch to sigmas=[...] for flow-matching schedulers (compute sigmas from timesteps via the scheduler's sigma formula if needed).
- Or configure a scheduler that supports timesteps (e.g. DDIMScheduler / DPMSolverMultistepScheduler) if the model permits.
- Drop the custom schedule and use num_inference_steps.
Example fix
# before stage(..., timesteps=[1000, 500, 100]) # after stage(..., sigmas=[14.6146, 5.0, 0.0]) # flow-matching schedule
Defensive patterns
Strategy: validation
Validate before calling
import inspect
if timesteps is not None:
assert "timesteps" in inspect.signature(scheduler.set_timesteps).parameters, "scheduler lacks timesteps support; use sigmas" Type guard
def scheduler_accepts_timesteps(scheduler) -> bool:
return "timesteps" in inspect.signature(scheduler.set_timesteps).parameters Prevention
- Know your scheduler family (flow-matching -> sigmas; DDPM/DDIM -> timesteps).
- Centralize schedule construction in one helper keyed by scheduler type.
When it happens
Trigger: Passing timesteps=[...] to a pipeline whose scheduler's set_timesteps signature has no timesteps parameter — common when the default scheduler for Qwen-Image (a flow-matching scheduler) is configured.
Common situations: Reusing DDPM/DDIM-style custom-schedule code with a flow-matching model; swapping schedulers in config while keeping timesteps-based call sites; version changes that alter scheduler signatures.
Related errors
- Only one of `timesteps` or `sigmas` can be passed. Please ch
- The current scheduler class {scheduler.__class__}'s `set_tim
- {self.config.timestep_spacing} is not supported. Please make
- Ideogram4DenoisingStage applies its custom scheduler step
- Cannot duplicate `image` of batch size {image_latents.shape[
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e8a45cac2ecd66b0.
Report an issue: GitHub.