{"record":{"id":"4b7ef75c38decb33","repo":"Comfy-Org/ComfyUI","slug":"seedvr2postprocessing-color-correction-oom-at-one","errorCode":null,"errorMessage":"SeedVR2PostProcessing: color correction OOM at one frame; color_correction_method={color_correction_method}, shape={tuple(decoded_flat.shape)}.","messagePattern":"SeedVR2PostProcessing: color correction OOM at one frame; color_correction_method=(.+?), shape=(.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":290,"sourceCode":"                    dtype=output.dtype,\n                )\n            result[start:start + 1].copy_(output)\n        if result is None:\n            raise ValueError(\"SeedVR2PostProcessing: LAB color correction requires at least one frame.\")\n        return result\n\n    @classmethod\n    def _color_transfer_chunked(cls, decoded_flat, reference_flat, output_device, color_correction_method):\n        chunk_size = cls._estimate_color_correction_chunk_size(decoded_flat, color_correction_method)\n        while True:\n            try:\n                return cls._run_color_transfer_chunks(\n                    decoded_flat, reference_flat, output_device, color_correction_method, chunk_size,\n                )\n            except Exception as e:\n                comfy.model_management.raise_non_oom(e)\n                if chunk_size <= 1:\n                    raise RuntimeError(\n                        \"SeedVR2PostProcessing: color correction OOM at one frame; \"\n                        f\"color_correction_method={color_correction_method}, shape={tuple(decoded_flat.shape)}.\"\n                    ) from e\n                chunk_size = max(1, chunk_size // SEEDVR2_OOM_BACKOFF_DIVISOR)\n\n    @classmethod\n    def _run_color_transfer_chunks(cls, decoded_flat, reference_flat, output_device, color_correction_method, chunk_size):\n        result = None\n        for start in range(0, decoded_flat.shape[0], chunk_size):\n            end = min(start + chunk_size, decoded_flat.shape[0])\n            decoded_chunk = decoded_flat[start:end]\n            reference_chunk = reference_flat[start:end]\n            if color_correction_method == \"lab\":\n                output = cls._lab_color_transfer_on_vae_device(decoded_chunk, reference_chunk, output_device)\n            elif color_correction_method == \"wavelet\":\n                output = cls._color_transfer_on_vae_device(\n                    decoded_chunk, reference_chunk, output_device, wavelet_color_transfer,\n                )","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L272-L308","documentation":"_color_transfer_chunked sizes its chunk by free VRAM and halves it on OOM (via raise_non_oom re-raising non-OOM errors). If the transfer still OOMs with chunk_size == 1, no further reduction is possible and this RuntimeError is raised, naming the method and tensor shape for diagnosis.","triggerScenarios":"Color correction (lab/wavelet/adain) on a very large frame while VRAM is nearly exhausted: even one frame's transfer (which allocates several intermediate buffers per the method's memory multiplier) cannot fit in the free memory on the VAE device.","commonSituations":"Long-video workflows where the decoded frames already occupy most of VRAM; small-GPU machines (e.g. 6-8 GB) with 4K frames; another process (browser, second Comfy run) consuming VRAM; fragmentation after a long session.","solutions":["Free VRAM: restart the run, close other GPU processes, or set color_correction_method='none' to skip the transfer entirely.","Reduce frame resolution or process the video in shorter temporal chunks so fewer/smaller frames are resident.","Move other stages (VAE decode of unrelated tensors) off the GPU first, or run color correction on CPU by unloading the model between stages.","If it recurs, report the shape/method from the message to help tune SEEDVR2_COLOR_MEM_HEADROOM."],"exampleFix":"# before\n{\"color_correction_method\": \"lab\"}  # OOM at one frame on 4K video\n\n# after\n{\"color_correction_method\": \"none\"}  # or chunk the video before postprocessing","handlingStrategy":"fallback","validationCode":"free = comfy.model_management.get_free_memory('cuda') if torch.cuda.is_available() else None\n# rough guard: a frame's lab transfer needs several full-size buffers\nneed = h * w * 3 * 4 * 8\nif free is not None and free < need:\n    # unload models or choose 'none' before running","typeGuard":null,"tryCatchPattern":"try:\n    out = node.execute(...)\nexcept RuntimeError as e:\n    if 'OOM at one frame' in str(e):\n        out = node_with_method_none.execute(...)  # degrade gracefully\n    else:\n        raise","preventionTips":["Run color correction on shorter temporal chunks so peak VRAM stays low.","Unload the diffusion model before postprocessing (comfy.model_management.unload_all_models).","Close other GPU processes before long video jobs.","Prefer 'adain' or 'none' over 'lab' on low-VRAM GPUs."],"tags":["seedvr","oom","vram","color-correction","retry-backoff"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}