Comfy-Org/ComfyUI · error · ValueError
SeedVR2 VAE convolution requires an explicit MemoryState.
Error message
SeedVR2 VAE convolution requires an explicit MemoryState.
What it means
SeedVR2 VAE convolutions are streaming-aware: their forward requires an explicit MemoryState enum (ACTIVE for streaming with cache, or another state for non-streaming) because cache lifecycle management differs per state. The default parameter is MemoryState.UNSET, and any call that did not deliberately choose a state raises immediately — this is an API-contract guard, not a runtime data problem.
Source
Thrown at comfy/ldm/seedvr/vae.py:581
x[idx],
split_dim=split_dim + 1,
padding=padding,
prev_cache=cache
)
cache = next_cache
output = torch.cat(x, dim=split_dim)
return output
def forward(
self,
input,
memory_state: MemoryState = MemoryState.UNSET,
memory_cache = None,
) -> Tensor:
if memory_state == MemoryState.UNSET:
raise ValueError("SeedVR2 VAE convolution requires an explicit MemoryState.")
if memory_cache is None:
memory_cache = {}
if memory_state != MemoryState.ACTIVE:
memory_cache.pop(self, None)
if (
math.isinf(self.memory_limit)
and torch.is_tensor(input)
):
return self.basic_forward(input, memory_state, memory_cache)
return self.slicing_forward(input, memory_state, memory_cache)
def basic_forward(self, input: Tensor, memory_state: MemoryState = MemoryState.UNSET, memory_cache = None):
mem_size = self.stride[0] - self.kernel_size[0]
memory = memory_cache.get(self) if memory_cache is not None else None
if (memory is not None) and (memory_state == MemoryState.ACTIVE):
input = extend_head(input, memory=memory, times=-1)
else:
input = extend_head(input, times=self.temporal_padding * 2)View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Pass an explicit memory_state, e.g. memory_state=MemoryState.BASIC (non-cached) for a one-shot call, or ACTIVE within the VAE's own streaming loop.
- Prefer calling the VAE's public encode/decode rather than individual conv modules.
- If porting the module, thread memory_state through your call chain the same way SeedVR2 VAE code does.
- Check the MemoryState enum values in comfy/ldm/seedvr/vae.py to pick the right state.
Example fix
# before y = conv_block(x) # after from comfy.ldm.seedvr.vae import MemoryState y = conv_block(x, memory_state=MemoryState.BASIC)
Defensive patterns
Strategy: validation
Validate before calling
from comfy.ldm.seedvr.vae import MemoryState
def call_conv(conv, x, streaming=False):
state = MemoryState.ACTIVE if streaming else MemoryState.BASIC
return conv(x, memory_state=state, memory_cache={}) Type guard
def is_valid_memory_state(s) -> bool:
from comfy.ldm.seedvr.vae import MemoryState
return s in MemoryState._value2member_map_ Prevention
- Always pass an explicit memory_state when calling SeedVR2 VAE conv modules directly.
- Call the VAE's public encode/decode instead of individual conv blocks.
- Thread memory_state through custom wrappers — never rely on the default.
When it happens
Trigger: Calling SeedVR2VaeConv forward directly (custom code, ported modules) without memory_state; wrapping the VAE in a tool that re-invokes submodules with default args; calling basic_forward-adjacent paths that forget the parameter.
Common situations: Custom node or research code reusing SeedVR2 VAE blocks; copying the module into another codebase and calling conv(x) idiomatically; migration from a diffusers-style API that had no memory state concept.
Related errors
- SeedVR2 VAE cache input is too short for convolution: input_
- SeedVR2 VAE cache size {next_cache_size} exceeds split size
- SeedVR2 VAE cache size {cache_size} exceeds input length {in
- SeedVR2 upsample expected {self.channels} channels, got {hid
- SeedVR2 downsample expected {self.channels} channels, got {h
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/9c86b8be915575ad.
Report an issue: GitHub.