Comfy-Org/ComfyUI · error · ValueError

SeedVR2 VAE cache size {next_cache_size} exceeds split size

Error message

SeedVR2 VAE cache size {next_cache_size} exceeds split size {x[idx].size(split_dim)}.

What it means

In the slicing path of the SeedVR2 VAE conv, the number of frames that must be carried into the next slice (next_cache_size, derived from kernel/stride/dilation overlap plus remainder) is compared against the current slice length. If the cache the conv wants to keep is larger than the slice itself, the slicing scheme cannot make progress and raises. Effectively the slice size is too small for this conv's receptive field/stride combination.

Source

Thrown at comfy/ldm/seedvr/vae.py:555

            lpad_dim = (x[idx].ndim - split_dim - 1) * 2
            rpad_dim = lpad_dim + 1
            padding = list(padding)
            padding[lpad_dim] = self.padding[split_dim - 2] if idx == 0 else 0
            padding[rpad_dim] = self.padding[split_dim - 2] if idx == len(x) - 1 else 0
            pad_len = padding[lpad_dim] + padding[rpad_dim]
            padding = tuple(padding)

            next_cache = None
            cache_len = cache.size(split_dim) if cache is not None else 0
            next_cache_size = get_cache_size(
                conv_module=self,
                input_len=x[idx].size(split_dim) + cache_len,
                pad_len=pad_len,
                dim=split_dim - 2,
            )
            if next_cache_size != 0:
                if next_cache_size > x[idx].size(split_dim):
                    raise ValueError(
                        f"SeedVR2 VAE cache size {next_cache_size} exceeds split size {x[idx].size(split_dim)}."
                    )
                next_cache = (
                    x[idx].transpose(0, split_dim)[-next_cache_size:].transpose(0, split_dim)
                )

            x[idx] = self.memory_limit_conv(
                x[idx],
                split_dim=split_dim + 1,
                padding=padding,
                prev_cache=cache
            )

            cache = next_cache

        output = torch.cat(x, dim=split_dim)
        return output

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Increase the slice/chunk size for the affected dimension (larger tile, larger split).
  2. Relax the memory limit so fewer, larger slices are used.
  3. Avoid splitting the affected dimension at all (e.g. split spatially instead of temporally for temporal-heavy convs).
  4. Compute minimum slice length from conv params before choosing a split: slice >= dilated_kernel - stride + 1.
Defensive patterns

Strategy: validation

Validate before calling

def min_chunk_for_conv(kernel, stride, dilation):
    dilated = dilation * (kernel - 1) + 1
    return dilated - stride + 1

# before splitting a dim for SeedVR2 VAE convs:
# assert chunk >= min_chunk_for_conv(k, s, d)

Prevention

When it happens

Trigger: memory_limit-driven splitting that produces slices shorter than the conv's overlap (dilated_kernel - stride) plus remainder; stride > 1 temporal convs with small slices; user-configured split sizes below kernel size.

Common situations: Very low memory_limit forcing tiny spatial/temporal chunks; decoding small videos with large-kernel 3D convs; custom tiling code that chunks arbitrarily.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/16e18fc0a91e4b6f. Report an issue: GitHub.