sgl-project/sglang · error · ValueError
Unsupported time_compression_ratio: {temporal_compression_ra
Error message
Unsupported time_compression_ratio: {temporal_compression_ratio} What it means
The HunyuanVideoVAE encoder supports only temporal_compression_ratio values of 4 (implicit in the earlier branch) and 8 when deciding which down blocks add time downsampling. Any other ratio raises this ValueError during __init__.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py:656
raise ValueError(f"Unsupported down_block_type: {down_block_type}")
input_channel = output_channel
output_channel = block_out_channels[i]
is_final_block = i == len(block_out_channels) - 1
num_spatial_downsample_layers = int(np.log2(spatial_compression_ratio))
num_time_downsample_layers = int(np.log2(temporal_compression_ratio))
if temporal_compression_ratio == 4:
add_spatial_downsample = bool(i < num_spatial_downsample_layers)
add_time_downsample = bool(
i >= (len(block_out_channels) - 1 - num_time_downsample_layers)
and not is_final_block
)
elif temporal_compression_ratio == 8:
add_spatial_downsample = bool(i < num_spatial_downsample_layers)
add_time_downsample = bool(i < num_time_downsample_layers)
else:
raise ValueError(
f"Unsupported time_compression_ratio: {temporal_compression_ratio}"
)
downsample_stride_HW = (2, 2) if add_spatial_downsample else (1, 1)
downsample_stride_T = (2,) if add_time_downsample else (1,)
downsample_stride = tuple(downsample_stride_T + downsample_stride_HW)
down_block = HunyuanVideoDownBlock3D(
num_layers=layers_per_block,
in_channels=input_channel,
out_channels=output_channel,
add_downsample=bool(add_spatial_downsample or add_time_downsample),
resnet_eps=1e-6,
resnet_act_fn=act_fn,
resnet_groups=norm_num_groups,
downsample_stride=downsample_stride,
downsample_padding=0,
)View on GitHub (pinned to 0132848349)
Solutions
- Set temporal_compression_ratio to 4 or 8 in the VAE config to match the checkpoint
- Check the checkpoint's true temporal stride (compare latent length vs video frame count) and use that value, which must be 4 or 8
- If you need another ratio, extend the branch chain in HunyuanVideoVAE.__init__ with the new add_time_downsample rule
Example fix
// before "temporal_compression_ratio": 2 // after "temporal_compression_ratio": 4
Defensive patterns
Strategy: validation
Validate before calling
assert cfg["temporal_compression_ratio"] in (4, 8), 'temporal_compression_ratio must be 4 or 8'
Type guard
def is_supported_temporal_ratio(r) -> bool:
return r in (4, 8) Prevention
- Verify the checkpoint's real temporal stride before writing the config
- Keep temporal and time compression ratios consistent across encoder/decoder configs
- Only load checkpoints validated for this VAE implementation
When it happens
Trigger: Loading/constructing the VAE with temporal_compression_ratio set to anything other than 4 or 8 — e.g. 2, 16, or a float like 4.0 that fails the ==8 comparison path — in the config.
Common situations: Custom VAE checkpoints with different temporal stride (e.g. image-only or aggressively compressed variants); hand-edited configs; mismatch between a checkpoint's actual temporal stride and the config value copied from another model.
Related errors
- Unsupported time_compression_ratio: {time_compression_ratio}
- Unsupported down_block_type: {down_block_type}
- Unsupported up_block_type: {up_block_type}
- Unsupported LTX-2.3 encoder block: {block_name}
- Unsupported latent_log_var: {latent_log_var}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5d7ce96ece3b96ac.
Report an issue: GitHub.