{"record":{"id":"8c2d7a013fd938d5","repo":"Comfy-Org/ComfyUI","slug":"seedvr2-downsample-expected-self-channels-channe","errorCode":null,"errorMessage":"SeedVR2 downsample expected {self.channels} channels, got {hidden_states.shape[1]}.","messagePattern":"SeedVR2 downsample expected (.+?) channels, got (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/seedvr/vae.py","lineNumber":773,"sourceCode":"        self.conv = InflatedCausalConv3d(\n            self.channels,\n            self.out_channels,\n            kernel_size=(self.temporal_kernel, self.spatial_kernel, self.spatial_kernel),\n            stride=(self.temporal_ratio, self.spatial_ratio, self.spatial_ratio),\n            padding=(1 if self.temporal_down else 0, 0, 0),\n            inflation_mode=inflation_mode,\n        )\n\n\n    def forward(\n        self,\n        hidden_states: torch.FloatTensor,\n        memory_state = None,\n        memory_cache = None,\n    ) -> torch.FloatTensor:\n\n        if hidden_states.shape[1] != self.channels:\n            raise ValueError(f\"SeedVR2 downsample expected {self.channels} channels, got {hidden_states.shape[1]}.\")\n\n        if self.spatial_down:\n            pad = (0, 1, 0, 1)\n            hidden_states = F.pad(hidden_states, pad, mode=\"constant\", value=0)\n\n        if hidden_states.shape[1] != self.channels:\n            raise ValueError(f\"SeedVR2 downsample expected {self.channels} channels after padding, got {hidden_states.shape[1]}.\")\n\n        hidden_states = self.conv(hidden_states, memory_state=memory_state, memory_cache=memory_cache)\n\n        return hidden_states\n\n\nclass ResnetBlock3D(nn.Module):\n    def __init__(\n        self,\n        in_channels: int,\n        out_channels: Optional[int] = None,","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/seedvr/vae.py#L755-L791","documentation":"SeedVR2VaeDownsample validates that the input channel count equals self.channels before its strided conv, which is weight-shaped for exactly that count. A mismatch means the block graph or config is inconsistent (previous block's out_channels != this block's channels). Like the upsample check, this is a construction/config error surfaced early with exact numbers.","triggerScenarios":"Building an encoder where DownEncoderBlock3D output channels do not match the following downsample's channels; editing block_out_channels lists of different lengths; mismatched checkpoint weights loaded into a config with different channel widths.","commonSituations":"Custom VAE configurations with inconsistent channel progressions; state-dict/config mismatches after checkpoint conversion; experimental architecture edits.","solutions":["Align the downsample's channels with the previous block's output channels in the config.","Validate the whole block_out_channels progression in the encoder/decoder config matches the official SeedVR2 VAE.","When loading fails oddly after config edits, re-derive channels from the checkpoint's conv weight shapes.","Prefer using SeedVR2Encoder/SeedVR2Decoder constructors, which compute channels consistently."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def validate_downsample_input(block, hidden_states):\n    if hidden_states.shape[1] != block.channels:\n        raise ValueError(f\"block expects {block.channels} channels, got {hidden_states.shape[1]}; fix VAE config\")\n    return hidden_states","typeGuard":"def channels_match_block(x, block) -> bool:\n    return x.dim() >= 2 and x.shape[1] == block.channels","tryCatchPattern":null,"preventionTips":["Ensure each downsample's channels equals the previous block's output channels.","Use the official SeedVR2 encoder/decoder constructors rather than manual block assembly.","Cross-check block_out_channels lists against the official config after edits."],"tags":["seedvr2","vae","channels","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}