ComfyUI runs out of memory

A diffusion pipeline is several models at once, and the text encoder is usually the one to move.

From the file· fixes ordered by quality cost
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate N GiB

What's actually happening

People size an image model by its headline parameter count, which describes the denoiser alone. The pipeline you actually run also holds one or more text encoders and a VAE, and on a modern model the text encoder can be nearly as large as the denoiser itself. On top of that, peak memory during sampling depends on resolution, batch size, frame count for video, and which attention implementation is active — so a workflow that loads fine can still fail mid-generation.

Fixes, cheapest first

  1. 1
    Move the text encoder to the CPU

    It runs once per prompt rather than once per step, so the speed cost is small and the memory saving is large. This is the single biggest lever in image generation and it is why the component breakdown on our model pages marks it offloadable.

  2. 2
    Generate smaller, then upscale

    Latent memory scales with area. Dropping from 1024 to 768 is roughly a 45% reduction in the activation working set before any other change.

  3. 3
    Enable VAE tiling

    Decoding the final latent is often the peak of the whole run. Tiling trades a little speed for a large reduction at exactly that moment.

  4. 4
    Use a quantized denoiser

    GGUF builds of diffusion models quantize the denoiser only, which is still the largest single component. The text encoder and VAE are unaffected.

  5. 5
    Reduce batch or frame count

    For video especially, memory scales with frames. Generating fewer frames per pass and stitching is usually the difference between running and not.

Also worth knowing

We publish exact component sizes for image and video models but not peak memory during sampling — that depends on resolution, tiling and attention implementation, and no public source has measured it across consumer hardware. We would rather show you the component graph than invent a peak figure.

Work out what fits

Rather than guessing, pick your model and card and read the grid: every quantization at every context, with the memory each combination actually needs.