{"record":{"id":"585d0bb634bfddf5","repo":"sgl-project/sglang","slug":"unsupported-time-compression-ratio-time-compress","errorCode":null,"errorMessage":"Unsupported time_compression_ratio: {time_compression_ratio}","messagePattern":"Unsupported time_compression_ratio: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py","lineNumber":786,"sourceCode":"        output_channel = reversed_block_out_channels[0]\n        for i, up_block_type in enumerate(up_block_types):\n            if up_block_type != \"HunyuanVideoUpBlock3D\":\n                raise ValueError(f\"Unsupported up_block_type: {up_block_type}\")\n\n            prev_output_channel = output_channel\n            output_channel = reversed_block_out_channels[i]\n            is_final_block = i == len(block_out_channels) - 1\n            num_spatial_upsample_layers = int(np.log2(spatial_compression_ratio))\n            num_time_upsample_layers = int(np.log2(time_compression_ratio))\n\n            if time_compression_ratio == 4:\n                add_spatial_upsample = bool(i < num_spatial_upsample_layers)\n                add_time_upsample = bool(\n                    i >= len(block_out_channels) - 1 - num_time_upsample_layers\n                    and not is_final_block\n                )\n            else:\n                raise ValueError(\n                    f\"Unsupported time_compression_ratio: {time_compression_ratio}\"\n                )\n\n            upsample_scale_factor_HW = (2, 2) if add_spatial_upsample else (1, 1)\n            upsample_scale_factor_T = (2,) if add_time_upsample else (1,)\n            upsample_scale_factor = tuple(\n                upsample_scale_factor_T + upsample_scale_factor_HW\n            )\n\n            up_block = HunyuanVideoUpBlock3D(\n                num_layers=self.layers_per_block + 1,\n                in_channels=prev_output_channel,\n                out_channels=output_channel,\n                add_upsample=bool(add_spatial_upsample or add_time_upsample),\n                upsample_scale_factor=upsample_scale_factor,\n                resnet_eps=1e-6,\n                resnet_act_fn=act_fn,\n                resnet_groups=norm_num_groups,","sourceCodeStart":768,"sourceCodeEnd":804,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py#L768-L804","documentation":"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__.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\n\"time_compression_ratio\": 2\n\n// after\n\"time_compression_ratio\": 4","handlingStrategy":"validation","validationCode":"assert cfg[\"time_compression_ratio\"] in (4, 8), 'time_compression_ratio must be 4 or 8'\nassert cfg.get(\"time_compression_ratio\") == cfg.get(\"temporal_compression_ratio\", cfg[\"time_compression_ratio\"]), 'encoder/decoder temporal ratios should match'","typeGuard":"def is_supported_time_ratio(r) -> bool:\n    return r in (4, 8)","tryCatchPattern":null,"preventionTips":["Keep time_compression_ratio (decoder) and temporal_compression_ratio (encoder) consistent","Validate both ratio fields in a config sanity check before model load"],"tags":["python","value-error","model-config","hunyuan-vae","compression-ratio"],"backgroundTag":"unsupported-config-option","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}