sgl-project/sglang · error · ValueError
Unsupported time_compression_ratio: {time_compression_ratio}
Error message
Unsupported time_compression_ratio: {time_compression_ratio} What it means
The decoder counterpart of the encoder's temporal-ratio check: only time_compression_ratio of 4 or 8 are supported when computing which up blocks upsample along time. Other values raise this ValueError in HunyuanVideoVAE.__init__.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py:786
output_channel = reversed_block_out_channels[0]
for i, up_block_type in enumerate(up_block_types):
if up_block_type != "HunyuanVideoUpBlock3D":
raise ValueError(f"Unsupported up_block_type: {up_block_type}")
prev_output_channel = output_channel
output_channel = reversed_block_out_channels[i]
is_final_block = i == len(block_out_channels) - 1
num_spatial_upsample_layers = int(np.log2(spatial_compression_ratio))
num_time_upsample_layers = int(np.log2(time_compression_ratio))
if time_compression_ratio == 4:
add_spatial_upsample = bool(i < num_spatial_upsample_layers)
add_time_upsample = bool(
i >= len(block_out_channels) - 1 - num_time_upsample_layers
and not is_final_block
)
else:
raise ValueError(
f"Unsupported time_compression_ratio: {time_compression_ratio}"
)
upsample_scale_factor_HW = (2, 2) if add_spatial_upsample else (1, 1)
upsample_scale_factor_T = (2,) if add_time_upsample else (1,)
upsample_scale_factor = tuple(
upsample_scale_factor_T + upsample_scale_factor_HW
)
up_block = HunyuanVideoUpBlock3D(
num_layers=self.layers_per_block + 1,
in_channels=prev_output_channel,
out_channels=output_channel,
add_upsample=bool(add_spatial_upsample or add_time_upsample),
upsample_scale_factor=upsample_scale_factor,
resnet_eps=1e-6,
resnet_act_fn=act_fn,
resnet_groups=norm_num_groups,View on GitHub (pinned to 0132848349)
Solutions
- Set time_compression_ratio to 4 or 8, matching the checkpoint's actual temporal upsampling factor
- Keep time_compression_ratio and temporal_compression_ratio consistent within one config
- Extend the branch chain in the decoder __init__ if a genuinely new ratio is needed
Example fix
// before "time_compression_ratio": 2 // after "time_compression_ratio": 4
Defensive patterns
Strategy: validation
Validate before calling
assert cfg["time_compression_ratio"] in (4, 8), 'time_compression_ratio must be 4 or 8'
assert cfg.get("time_compression_ratio") == cfg.get("temporal_compression_ratio", cfg["time_compression_ratio"]), 'encoder/decoder temporal ratios should match' Type guard
def is_supported_time_ratio(r) -> bool:
return r in (4, 8) Prevention
- Keep time_compression_ratio (decoder) and temporal_compression_ratio (encoder) consistent
- Validate both ratio fields in a config sanity check before model load
When it happens
Trigger: Constructing the VAE with time_compression_ratio set to a value other than 4 or 8 in the config (note the decoder config key is spelled time_compression_ratio, distinct from the encoder's temporal_compression_ratio).
Common situations: Config conversions where time_compression_ratio/temporal_compression_ratio got renamed or diverged between the two halves of the config; custom checkpoints with unusual temporal strides; inconsistent hand-edited configs.
Related errors
- Unsupported time_compression_ratio: {temporal_compression_ra
- 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/585d0bb634bfddf5.
Report an issue: GitHub.