hpcaitech/Open-Sora · error · ValueError

downsample factor {factor} is not supported for encoder proj

Error message

downsample factor {factor} is not supported for encoder project in

What it means

build_encoder_project_in_block only supports project_in factors 1 and 2. Any other factor value in the encoder config raises this ValueError at model construction.

Source

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

    if factor == 1:
        block = ConvLayer(
            in_channels=in_channels,
            out_channels=out_channels,
            kernel_size=3,
            stride=1,
            use_bias=True,
            norm=None,
            act_func=None,
            is_video=is_video,
        )
    elif factor == 2:
        if is_video:
            raise NotImplementedError("Downsample during project_in is not supported for video")
        block = build_downsample_block(
            block_type=downsample_block_type, in_channels=in_channels, out_channels=out_channels, shortcut=None
        )
    else:
        raise ValueError(f"downsample factor {factor} is not supported for encoder project in")
    return block


def build_encoder_project_out_block(
    in_channels: int,
    out_channels: int,
    norm: Optional[str],
    act: Optional[str],
    shortcut: Optional[str],
    is_video: bool,
):
    block = OpSequential(
        [
            build_norm(norm),
            build_act(act),
            ConvLayer(
                in_channels=in_channels,
                out_channels=out_channels,

View on GitHub (pinned to 7ad6a96a13)

Solutions

  1. Set project_in_factor to 1 or 2
  2. Use a shipped config for the target checkpoint
  3. If you need another factor, implement it in build_encoder_project_in_block and contribute/patch locally

Example fix

# before
project_in_factor: 4
# after
project_in_factor: 2
Defensive patterns

Strategy: validation

Validate before calling

assert project_in_factor in (1, 2), f'unsupported project_in factor: {project_in_factor}'

Prevention

When it happens

Trigger: Setting project_in_factor to 4, 8, 0.5, or any value besides 1/2 in the DCAE encoder config.

Common situations: Trying to match a different VAE's channel/stride scheme by changing the project-in factor; hand-editing configs without checking supported values.

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/1b3e8999ee881895. Report an issue: GitHub.