sgl-project/sglang · error · ValueError

Unsupported down_block_type: {down_block_type}

Error message

Unsupported down_block_type: {down_block_type}

What it means

HunyuanVideoVAE's encoder construction iterates over down_block_types and only accepts the literal string 'HunyuanVideoDownBlock3D'. Any other block type name in the model config raises this ValueError, because no other downsampling block implementation exists in this VAE.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py:638

        norm_num_groups: int = 32,
        act_fn: str = "silu",
        double_z: bool = True,
        mid_block_add_attention=True,
        temporal_compression_ratio: int = 4,
        spatial_compression_ratio: int = 8,
    ) -> None:
        super().__init__()

        self.conv_in = HunyuanVideoCausalConv3d(
            in_channels, block_out_channels[0], kernel_size=3, stride=1
        )
        self.mid_block: HunyuanVideoMidBlock3D | None = None
        self.down_blocks = nn.ModuleList([])

        output_channel = block_out_channels[0]
        for i, down_block_type in enumerate(down_block_types):
            if down_block_type != "HunyuanVideoDownBlock3D":
                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(

View on GitHub (pinned to 0132848349)

Solutions

  1. Open the checkpoint's config.json and set every entry of down_block_types to "HunyuanVideoDownBlock3D"
  2. Use an official HunyuanVideo/Hunyuan3D VAE checkpoint whose config matches this implementation
  3. If you genuinely need another block architecture, implement the block class and extend the branch in __init__

Example fix

// before
"down_block_types": ["DownBlock3D", "DownBlock3D"]

// after
"down_block_types": ["HunyuanVideoDownBlock3D", "HunyuanVideoDownBlock3D"]
Defensive patterns

Strategy: validation

Validate before calling

cfg = json.load(open(vae_config_path))
allowed = {"HunyuanVideoDownBlock3D"}
assert set(cfg["down_block_types"]) <= allowed, f'bad down_block_types: {cfg["down_block_types"]}'

Type guard

def is_supported_down_blocks(types: list) -> bool:
    return all(t == 'HunyuanVideoDownBlock3D' for t in types)

Prevention

When it happens

Trigger: Instantiating the VAE (e.g. via from_pretrained / config load) whose config JSON has down_block_types containing anything other than "HunyuanVideoDownBlock3D", such as values ported from diffusers-style configs ('DownBlock3D', 'CrossAttnDownBlock3D').

Common situations: Loading a community-finetuned or converted VAE checkpoint whose config.json was edited or generated by a different toolchain; typos in a hand-written config; diffusers-to-sglang config conversion that left incompatible block names.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/89399e516484d2c3. Report an issue: GitHub.