sgl-project/sglang · error · ValueError
`mu` must be passed when `use_dynamic_shifting` is set to…
Error message
`mu` must be passed when `use_dynamic_shifting` is set to be `True`
What it means
Raised when use_dynamic_shifting=True but the required mu parameter is not passed to set_timesteps. Dynamic shifting rescales sigmas based on sequence resolution, which needs mu. Pass mu (typically computed from image/token resolution) or disable use_dynamic_shifting.
Solutions
- Pass mu to set_timesteps (compute from sequence length / shift as the pipeline does)
- Disable use_dynamic_shifting if static shifting suffices
- Ensure mu is recomputed whenever resolution or token count changes
Example fix
# before scheduler.set_timesteps(num_inference_steps=steps) # after scheduler.set_timesteps(num_inference_steps=steps, mu=calculate_shift(seqlen, shift))
Defensive patterns
Strategy: validation
Validate before calling
if scheduler.config.use_dynamic_shifting:
assert mu is not None, "mu required for dynamic shifting"
scheduler.set_timesteps(num_inference_steps=steps, mu=mu) Prevention
- Compute mu from sequence length before every set_timesteps
- Centralize scheduler setup in one helper that handles mu
When it happens
Trigger: scheduler.set_timesteps(50) with use_dynamic_shifting=True and no mu; pipelines that compute mu but skip passing it for cached/short paths.
Common situations: Standalone scheduler use; upgrading configs that turned dynamic shifting on; latent resolution changes without recomputing mu.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Must pass a value for `mu` when `use_dynamic_shifting` is…
- action policy returned no output
- is not implemented for
- denoising_strength must be positive
- Expected outputs, got from scheduler
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a04e3486a7d7e62e.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py:302
Args:
num_inference_steps (`int`, *optional*):
The number of diffusion steps used when generating samples with a pre-trained model.
device (`str` or `torch.device`, *optional*):
The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
sigmas (`List[float]`, *optional*):
Custom values for sigmas to be used for each diffusion step. If `None`, the sigmas are computed
automatically.
mu (`float`, *optional*):
Determines the amount of shifting applied to sigmas when performing resolution-dependent timestep
shifting.
timesteps (`List[float]`, *optional*):
Custom values for timesteps to be used for each diffusion step. If `None`, the timesteps are computed
automatically.
"""
if self.config.use_dynamic_shifting and mu is None:
raise ValueError(
"`mu` must be passed when `use_dynamic_shifting` is set to be `True`"
)
if (
sigmas is not None
and timesteps is not None
and len(sigmas) != len(timesteps)
):
raise ValueError("`sigmas` and `timesteps` should have the same length")
if num_inference_steps is not None:
if (sigmas is not None and len(sigmas) != num_inference_steps) or (
timesteps is not None and len(timesteps) != num_inference_steps
):
raise ValueError(
"`sigmas` and `timesteps` should have the same length as num_inference_steps, if `num_inference_steps` is provided"
)
else:View on GitHub (pinned to 0132848349)