sgl-project/sglang · error · ValueError
{name} must be a floating point tensor
Error message
{name} must be a floating point tensor What it means
The unit-timestep validator requires a floating-point dtype tensor (float32/float16/bfloat16). Integer-dtype timesteps — the diffusers convention (e.g. 700, 250 as long tensors) — are rejected because the flow-matching math treats timestep as a continuous value in [0,1].
Source
Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_minimax_h3_euler_ancestral.py:19
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
from typing import Any
import torch
def _require_finite_tensor(tensor: torch.Tensor, name: str) -> None:
if not bool(torch.isfinite(tensor).all().item()):
raise ValueError(f"{name} must be finite")
def _validate_unit_timestep(timestep: torch.Tensor, name: str) -> None:
if not isinstance(timestep, torch.Tensor):
raise ValueError(f"{name} must be a torch.Tensor")
if not torch.is_floating_point(timestep):
raise ValueError(f"{name} must be a floating point tensor")
_require_finite_tensor(timestep, name)
out_of_range = (timestep < 0) | (timestep > 1)
if bool(out_of_range.any().item()):
raise ValueError(f"{name} must be in [0, 1]")
def _validate_sigma(value: float, name: str) -> float:
sigma = float(value)
if not math.isfinite(sigma):
raise ValueError(f"{name} must be finite")
if sigma < 0.0:
raise ValueError(f"{name} must be non-negative")
return sigma
def _validate_timestep_sigma_pair(
timestep: torch.Tensor,
sigma_curr: float,View on GitHub (pinned to 0132848349)
Solutions
- Convert the discrete timestep to the unit scale the scheduler expects: t_unit = timestep.float() / num_train_timesteps (e.g. /1000), yielding a float in [0,1]
- Or use the scheduler's own generated schedule (sigma/timestep pairs) instead of hand-built integer timesteps
Example fix
# before x0 = minimax_h3_rf_v_to_x0(xt, v, torch.tensor(700)) # ValueError: not floating point # after t_unit = torch.tensor(700, dtype=torch.float32) / 1000.0 # 0.7 x0 = minimax_h3_rf_v_to_x0(xt, v, t_unit)
Defensive patterns
Strategy: type-guard
Validate before calling
assert isinstance(timestep, torch.Tensor) and torch.is_floating_point(timestep)
Type guard
def is_float_unit_timestep(t) -> bool:
return isinstance(t, torch.Tensor) and torch.is_floating_point(t) Prevention
- Never feed int64 diffusion timesteps directly; normalize with .float() / 1000
- Build schedules in float32 from the start
When it happens
Trigger: Passing timestep as an int/long tensor such as torch.tensor(700) or a timesteps schedule of dtype torch.int64 from a standard diffusion pipeline.
Common situations: Reusing a discrete diffusion timestep schedule (ints in [1,1000]) with the minimax_h3 normalized flow scheduler without converting to unit-scale floats.
Related errors
- {name} must be a torch.Tensor
- unsupported dtype for causal Conv3D cat/pad: {x.dtype}
- Validate failed: unsupported dtype: {t.dtype}
- {output_batch.error}
- action policy returned no output
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/d2ab428a2dfc2775.
Report an issue: GitHub.