sgl-project/sglang · error · ValueError
Unknown time_shift_type: {self.config.time_shift_type}
Error message
Unknown time_shift_type: {self.config.time_shift_type} What it means
time_shift() dispatches on config.time_shift_type and raises for any value other than the two supported branches. It runs during set_timesteps, so a bad value can slip past the constructor if the config was mutated after construction.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py:249
while len(sigma.shape) < len(sample.shape):
sigma = sigma.unsqueeze(-1)
sample = sigma * noise + (1.0 - sigma) * sample
return sample
def _sigma_to_t(self, sigma: float) -> float:
return sigma * self.config.num_train_timesteps
def time_shift(
self, mu: float, sigma: float, t: torch.Tensor | np.ndarray
) -> torch.Tensor | np.ndarray:
if self.config.time_shift_type == "exponential":
return self._time_shift_exponential(mu, sigma, t)
elif self.config.time_shift_type == "linear":
return self._time_shift_linear(mu, sigma, t)
else:
raise ValueError(f"Unknown time_shift_type: {self.config.time_shift_type}")
def stretch_shift_to_terminal(self, t: torch.Tensor) -> torch.Tensor:
r"""
Stretches and shifts the timestep schedule to ensure it terminates at the configured `shift_terminal` config
value.
Reference:
https://github.com/Lightricks/LTX-Video/blob/a01a171f8fe3d99dce2728d60a73fecf4d4238ae/ltx_video/schedulers/rf.py#L51
Args:
t (`torch.Tensor`):
A tensor of timesteps to be stretched and shifted.
Returns:
`torch.Tensor`:
A tensor of adjusted timesteps such that the final value equals `self.config.shift_terminal`.
"""
one_minus_z = 1 - tView on GitHub (pinned to 0132848349)
Solutions
- Reset time_shift_type to 'exponential' or 'linear' before set_timesteps
- Re-instantiate the scheduler with a valid type so constructor validation runs
- Avoid mutating scheduler.config after construction
Example fix
# before scheduler.config.time_shift_type = "sigmoid" # later set_timesteps -> error # after scheduler.config.time_shift_type = "linear"
Defensive patterns
Strategy: validation
Validate before calling
assert scheduler.config.time_shift_type in {"exponential", "linear"}
scheduler.set_timesteps(steps, mu=mu) Prevention
- Don't mutate scheduler.config after construction
- Re-validate config before set_timesteps if mutation is unavoidable
When it happens
Trigger: Constructing the scheduler, then setting scheduler.config.time_shift_type = 'custom' before set_timesteps; bypassing the constructor check by mutating a loaded config dict.
Common situations: Runtime config overrides, patches applied by pipelines, or config deserialization paths that skip __init__ validation.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- `time_shift_type` must either be 'exponential' or 'linear'.
- {response.error}
- action policy returned no output
- Could not connect to remote scheduler at {self.server_args.s
- {output_batch.error}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/2627dba252f3f808.
Report an issue: GitHub.