sgl-project/sglang · error · ValueError

Unsupported up_block_type: {up_block_type}

Error message

Unsupported up_block_type: {up_block_type}

What it means

Mirroring the encoder check, the decoder loop in HunyuanVideoVAE.__init__ only accepts the literal up_block_type 'HunyuanVideoUpBlock3D'. Any other string in up_block_types raises this ValueError because no alternative upsampling block is implemented.

Source

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

        )
        self.up_blocks = nn.ModuleList([])

        # mid
        self.mid_block = HunyuanVideoMidBlock3D(
            in_channels=block_out_channels[-1],
            resnet_eps=1e-6,
            resnet_act_fn=act_fn,
            attention_head_dim=block_out_channels[-1],
            resnet_groups=norm_num_groups,
            add_attention=mid_block_add_attention,
        )

        # up
        reversed_block_out_channels = list(reversed(block_out_channels))
        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}"
                )

View on GitHub (pinned to 0132848349)

Solutions

  1. Set every entry of up_block_types in the config to "HunyuanVideoUpBlock3D"
  2. Use an official checkpoint whose config matches this VAE implementation
  3. Implement the extra block class and extend the branch if a new architecture is truly required

Example fix

// before
"up_block_types": ["UpBlock3D", "UpBlock3D"]

// after
"up_block_types": ["HunyuanVideoUpBlock3D", "HunyuanVideoUpBlock3D"]
Defensive patterns

Strategy: validation

Validate before calling

assert set(cfg["up_block_types"]) == {"HunyuanVideoUpBlock3D"}, f'bad up_block_types: {cfg["up_block_types"]}'

Type guard

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

Prevention

When it happens

Trigger: Instantiating the VAE with a config whose up_block_types contains anything but "HunyuanVideoUpBlock3D" — e.g. diffusers-style names like 'UpBlock3D' or 'CrossAttnUpBlock3D'.

Common situations: Loading converted or community VAE checkpoints whose config.json retained block names from another library; typos or partial edits of up_block_types in a hand-written config.

Related errors


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