sgl-project/sglang · error · ValueError
MiniMax H3 shift_scale must be > 0
Error message
MiniMax H3 shift_scale must be > 0
What it means
minimax_h3_time_shift_sigmas computes rectified-flow sigma timesteps for MiniMax H3 and requires a positive shift_scale (default 6.0). Non-positive shift_scale would produce degenerate sigmas, so it fails fast before touching torch.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/time_request.py:38
if out_t == 1:
return 1
if out_t < 2 or (out_t - 2) % 5 != 0:
raise ValueError("MiniMax H3 video latent T must be 1 or match 5n+2")
return 17 * ((int(out_t) - 2) // 5) + 5
def minimax_h3_audio_latent_t(duration_seconds: float) -> int:
# Rounding happens at the 40 Hz audio latent boundary.
return int(round(float(duration_seconds) * 40.0))
def minimax_h3_time_shift_sigmas(
*,
num_steps: int = 50,
shift_scale: float = 6.0,
) -> list[float]:
if shift_scale <= 0:
raise ValueError("MiniMax H3 shift_scale must be > 0")
if num_steps <= 0:
raise ValueError("MiniMax H3 num_steps must be > 0")
import torch
# The rectified-flow sigma range is fixed at [1.0, 0.0].
base = torch.linspace(
1.0,
0.0,
int(num_steps),
device="cpu",
dtype=torch.float32,
)
shifted = float(shift_scale) * base / (1 + (float(shift_scale) - 1) * base)
shifted, _ = torch.unique_consecutive(shifted, return_counts=True)
# A one-point request is still exactly one point. Normal serving uses
# multiple points, but preserving the requested cardinality keeps
# ``num_inference_steps`` the sole schedule-size control.View on GitHub (pinned to 0132848349)
Solutions
- Use a positive shift_scale (the default 6.0 is standard for MiniMax H3)
- If you intended fewer/less aggressive shift steps, tune shift_scale upward/downward but keep it > 0
- Validate sampling params via validate_sampling_params before submitting the request
Example fix
# before minimax_h3_time_shift_sigmas(num_steps=50, shift_scale=0) # after minimax_h3_time_shift_sigmas(num_steps=50, shift_scale=6.0)
Defensive patterns
Strategy: validation
Validate before calling
shift_scale = float(params.get("shift_scale", 6.0))
if shift_scale <= 0:
raise ValueError("shift_scale must be > 0")
sigmas = minimax_h3_time_shift_sigmas(num_steps=steps, shift_scale=shift_scale) Type guard
def is_valid_shift_scale(x: Any) -> bool:
return isinstance(x, (int, float)) and x > 0 Try / catch
catch ValueError and fall back to the default shift_scale=6.0 with a warning
Prevention
- Clamp/validate sampling params at request intake
- Don't use 0 to mean 'disabled' for shift_scale
When it happens
Trigger: Calling minimax_h3_time_shift_sigmas(shift_scale=0) or with a negative value; or a sampling-params/config path that reads shift_scale from user settings without validating, feeding it into _generate_sigmas_from_plan / _cache_timestep_plans.
Common situations: Setting --shift-scale 0 in CLI flags thinking it disables shifting; YAML config with shift_scale: 0.0 or a negative typo; programmatically deriving shift_scale from another parameter that can go non-positive.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- MiniMax H3 num_steps must be > 0
- Invalid filter_apply_order: {filter_apply_order}
- MiniMax H3 task must be a non-empty string
- Unsupported content type ${header.content_type}
- Unknown serve backend {name!r}. Available values: {available
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/707de45a9d1299fb.
Report an issue: GitHub.