sgl-project/sglang · error · ValueError
Cosmos3 AVAE dec_strides product must equal hop_size: produc
Error message
Cosmos3 AVAE dec_strides product must equal hop_size: product={stride_product}, hop_size={self.hop_size}. What it means
The Cosmos3 audio VAE decodes latents back to audio frames, so the product of its decoder strides must exactly equal hop_size (frames per latent step, default prod(dec_strides)). If the config explicitly overrides hop_size inconsistently with dec_strides, decode would produce the wrong number of frames, so __init__ fails fast.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/cosmos3_avae.py:169
default=2 if bool(config.get("stereo", True)) else 1,
)
)
self.latent_channels = int(
_cfg(config, "vocoder_input_dim", "io_channels", "latent_ch", default=64)
)
dec_strides = [
int(s) for s in _cfg(config, "dec_strides", default=[2, 4, 5, 6, 8])
]
self.hop_size = int(
_cfg(
config,
"hop_size",
default=math.prod(dec_strides) if dec_strides else 1920,
)
)
stride_product = math.prod(dec_strides)
if stride_product != self.hop_size:
raise ValueError(
"Cosmos3 AVAE dec_strides product must equal hop_size: "
f"product={stride_product}, hop_size={self.hop_size}."
)
norm = str(_cfg(config, "normalization_type", default="none"))
if bool(_cfg(config, "normalize_latents", default=False)) and norm == "none":
norm = "tanh"
self.normalization_type = norm
self.tanh_input_scale = float(_cfg(config, "tanh_input_scale", default=1.5))
self.tanh_output_scale = float(_cfg(config, "tanh_output_scale", default=3.5))
self.tanh_clamp = float(_cfg(config, "tanh_clamp", default=0.995))
self.decoder = OobleckDecoder(
channels=int(_cfg(config, "dec_dim", default=320)),
input_channels=self.latent_channels,
audio_channels=self.audio_channels,
upsampling_ratios=list(reversed(dec_strides)),
channel_multiples=list(View on GitHub (pinned to 0132848349)
Solutions
- Remove the explicit hop_size override so it defaults to prod(dec_strides)
- Or fix hop_size to equal math.prod(dec_strides) exactly
- Verify the dec_strides list parsed correctly (non-empty, expected values) from the config file
Example fix
# before
config = {"dec_strides": [4, 4, 120], "hop_size": 960}
# after
config = {"dec_strides": [4, 4, 120]} # hop_size defaults to 1920
# or config = {"dec_strides": [4, 4, 60], "hop_size": 960} Defensive patterns
Strategy: validation
Validate before calling
import math
stride_product = math.prod(dec_strides)
if hop_size is None:
hop_size = stride_product
assert math.prod(dec_strides) == hop_size, "dec_strides must multiply to hop_size" Prevention
- Never override hop_size independently of dec_strides
- Add a config linter that recomputes prod(dec_strides) and compares against hop_size
When it happens
Trigger: Loading a Cosmos3 AVAE config where hop_size (default 1920 when dec_strides is empty) disagrees with math.prod(dec_strides), e.g. setting hop_size=960 while dec_strides multiply to 1920, or providing dec_strides whose product differs from an inherited default hop_size.
Common situations: Editing a config to halve hop_size for shorter latents without adjusting strides; merging configs from different Cosmos3 checkpoints; checkpoint whose dec_strides list is parsed as empty (falling back to 1920) due to a schema/name change.
Related errors
- Either spatial_upsample or temporal_upsample must be True
- Invalid threshold_type for topk: {threshold_type}. Choose 'q
- Invalid threshold_type: {threshold_type}. Choose 'query_head
- SGLANG_DIFFUSION_ATTENTION_CONFIG is not set
- Cosmos3CausalAttention requires num_attention_heads divisibl
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5fd167d7551452c8.
Report an issue: GitHub.