sgl-project/sglang · error · ValueError
latent_window_size must be positive, got {latent_window_size
Error message
latent_window_size must be positive, got {latent_window_size} What it means
latent_window_size_to_pixel_window_size converts a latent-space window to pixel space by multiplying by downsample_factor; it validates both are positive integers first. A non-positive latent window would produce a zero/negative pixel window, which is meaningless for memory slotting, so it fails fast.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/memory.py:43
LTX2AVDecodingStage,
)
from sglang.multimodal_gen.runtime.server_args import ServerArgs
from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger
logger = init_logger(__name__)
# --- Audio peak-window helpers ---
def latent_window_size_to_pixel_window_size(
latent_window_size: int,
*,
downsample_factor: int,
is_causal: bool = True,
) -> int:
if latent_window_size <= 0:
raise ValueError(
f"latent_window_size must be positive, got {latent_window_size}"
)
if downsample_factor <= 0:
raise ValueError(f"downsample_factor must be positive, got {downsample_factor}")
pixel_window_size = int(latent_window_size) * int(downsample_factor)
if is_causal:
pixel_window_size = max(pixel_window_size - (int(downsample_factor) - 1), 1)
return pixel_window_size
def select_max_response_audio_window_with_bounds(
segment: Tensor,
window_size: int,
) -> tuple[Tensor, Tensor, Tensor]:
if segment.dim() != 4:
raise ValueError(
f"Expected segment shape [B, C, T, F], got {tuple(segment.shape)}"View on GitHub (pinned to 0132848349)
Solutions
- Fix the caller to compute a positive latent window (clamp to at least 1)
- Correct the config value to a positive integer
- Sanity-assert window sizes before saving memory slots
Example fix
# before lws = max(0, num_latent_frames - overlap) slot = save_memory_slot(latent_window_size_to_pixel_window_size(lws, downsample_factor=8)) # after lws = max(1, num_latent_frames - overlap) slot = save_memory_slot(latent_window_size_to_pixel_window_size(lws, downsample_factor=8))
Defensive patterns
Strategy: validation
Validate before calling
if latent_window_size <= 0:
latent_window_size = 1 # or reject with a clear message before calling Prevention
- Clamp computed windows with max(1, value)
- Validate memory-slot config values at load time
When it happens
Trigger: Calling the helper with latent_window_size <= 0 (0 or negative), commonly from save_memory_slot with a computed window of 0 — e.g. an empty clip or miscomputed frame chunk.
Common situations: Computing the window as ceil(frames/threshold) which rounds to 0 for short clips; config files with latent_window_size: 0; off-by-one or inversion when deriving the window from pixel sizes.
Related errors
- SP DMD renoise requires packed video `batch.raw_latent_shape
- SP DMD renoise requires `batch.sp_audio_orig_num_frames`.
- v_cache must be provided
- q can only be None when only_qv=True
- q must be provided unless qv is provided with only_qv=True
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/2559a84332313635.
Report an issue: GitHub.