hpcaitech/Open-Sora · error · ValueError

shortcut {shortcut} is not supported for downsample

Error message

shortcut {shortcut} is not supported for downsample

What it means

The downsample block supports only two shortcut modes: None (no shortcut) and 'averaging' (PixelUnshuffleChannelAveragingDownSampleLayer wrapped in a ResidualBlock). Any other shortcut string in the config raises this ValueError at construction.

Source

Thrown at opensora/models/dc_ae/models/dc_ae.py:212

            is_video=is_video,
        )
    elif block_type == "ConvPixelUnshuffle":
        if is_video:
            raise NotImplementedError("ConvPixelUnshuffle downsample is not supported for video")
        block = ConvPixelUnshuffleDownSampleLayer(
            in_channels=in_channels, out_channels=out_channels, kernel_size=3, factor=2
        )
    else:
        raise ValueError(f"block_type {block_type} is not supported for downsampling")
    if shortcut is None:
        pass
    elif shortcut == "averaging":
        shortcut_block = PixelUnshuffleChannelAveragingDownSampleLayer(
            in_channels=in_channels, out_channels=out_channels, factor=2, temporal_downsample=temporal_downsample
        )
        block = ResidualBlock(block, shortcut_block)
    else:
        raise ValueError(f"shortcut {shortcut} is not supported for downsample")
    return block


def build_upsample_block(
    block_type: str,
    in_channels: int,
    out_channels: int,
    shortcut: Optional[str],
    is_video: bool,
    temporal_upsample: bool = False,
) -> nn.Module:
    if block_type == "ConvPixelShuffle":
        if is_video:
            raise NotImplementedError("ConvPixelShuffle upsample is not supported for video")
        block = ConvPixelShuffleUpSampleLayer(
            in_channels=in_channels, out_channels=out_channels, kernel_size=3, factor=2
        )
    elif block_type == "InterpolateConv":

View on GitHub (pinned to 7ad6a96a13)

Solutions

  1. Set shortcut to null/None or 'averaging' in the downsample stage config
  2. Copy an unmodified repo config for the model you want

Example fix

# before
shortcut: identity
# after
shortcut: averaging
Defensive patterns

Strategy: validation

Validate before calling

assert shortcut in (None, 'averaging'), f'unsupported downsample shortcut: {shortcut}'

Prevention

When it happens

Trigger: Setting shortcut: 'identity' (or any string other than 'averaging') on a downsample stage in the DCAE config; build_downsample_block is called from Encoder __init__ and project-in building.

Common situations: Modifying stage configs by hand; assuming identity shortcuts are available because other blocks use them.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of hpcaitech/Open-Sora@7ad6a96a13 (2026-08-28). Data as JSON: /api/errors/1130c7e9387d6cd0. Report an issue: GitHub.