{"record":{"id":"8896cba3ead947ec","repo":"Comfy-Org/ComfyUI","slug":"seedvr2-upsample-expected-self-channels-channels","errorCode":null,"errorMessage":"SeedVR2 upsample expected {self.channels} channels, got {hidden_states.shape[1]}.","messagePattern":"SeedVR2 upsample expected (.+?) channels, got (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/seedvr/vae.py","lineNumber":712,"sourceCode":"        self.spatial_up = spatial_up\n        self.temporal_ratio = 2 if temporal_up else 1\n        self.spatial_ratio = 2 if spatial_up else 1\n\n        upscale_ratio = (self.spatial_ratio**2) * self.temporal_ratio\n        self.upscale_conv = ops.Conv3d(\n            self.channels, self.channels * upscale_ratio, kernel_size=1, padding=0\n        )\n\n        self.conv = conv\n\n    def forward(\n        self,\n        hidden_states: torch.FloatTensor,\n        memory_state=None,\n        memory_cache=None,\n    ) -> torch.FloatTensor:\n        if hidden_states.shape[1] != self.channels:\n            raise ValueError(f\"SeedVR2 upsample expected {self.channels} channels, got {hidden_states.shape[1]}.\")\n\n        hidden_states = self.upscale_conv(hidden_states)\n        b, channels, f, h, w = hidden_states.shape\n        c = channels // (self.spatial_ratio * self.spatial_ratio * self.temporal_ratio)\n        hidden_states = hidden_states.view(b, self.spatial_ratio, self.spatial_ratio, self.temporal_ratio, c, f, h, w)\n        hidden_states = hidden_states.permute(0, 4, 5, 3, 6, 1, 7, 2).reshape(\n            b,\n            c,\n            f * self.temporal_ratio,\n            h * self.spatial_ratio,\n            w * self.spatial_ratio,\n        )\n\n        if self.temporal_up and memory_state != MemoryState.ACTIVE:\n            hidden_states = remove_head(hidden_states)\n\n        hidden_states = self.conv(hidden_states, memory_state=memory_state, memory_cache=memory_cache)\n","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/seedvr/vae.py#L694-L730","documentation":"SeedVR2VaeUpsample first projects with a 1x1 conv sized for exactly self.channels inputs, then pixel-shuffles. If the incoming hidden_states channel count differs from the block's configured channels, the projection would fail with a confusing shape error, so the block pre-checks and raises with both numbers. In a correctly built VAE this never fires; it indicates a config mismatch or a manually mis-wired block graph.","triggerScenarios":"Instantiating SeedVR2VaeUpsample with one channel count but feeding it a tensor from a block with a different count; editing block_out_channels inconsistently; inserting/removing a block in the encoder/decoder without updating channels.","commonSituations":"Hand-modified VAE configs where in_channels of the upsample does not match the previous block's out_channels; conversion scripts that miscalculate channel transitions when porting checkpoints.","solutions":["Make the upsample's channels equal the preceding block's output channels in the VAE config.","Diff your VAE config against the official SeedVR2 VAE config for channel progression.","If porting weights, verify each block's expected channel count from the state dict shapes and fix the config accordingly.","Avoid manually inserting upsample blocks; use the standard encoder/decoder builders."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def validate_upsample_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":["Keep VAE configs canonical — derive channel transitions programmatically from block_out_channels.","After any config edit, run a 1-frame dummy tensor through the VAE to catch wiring errors.","Validate checkpoint weight shapes against block channels before loading."],"tags":["seedvr2","vae","channels","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}