Skip to main content

CUDA out of memory (ComfyUI / Stable Diffusion) — how to fix

A "CUDA out of memory" error means the model needed more GPU VRAM than the card has. It is almost always a VRAM ceiling, not a bug in your workflow — the same graph runs fine on a bigger GPU.

Also seen as: "torch.cuda.OutOfMemoryError", "CUDA OOM", "GPU out of memory"

Direct answer

How do I fix "GPU Memory Exhausted"?

A "CUDA out of memory" error means the model needed more GPU VRAM than the card has. It is almost always a VRAM ceiling, not a bug in your workflow — the same graph runs fine on a bigger GPU.

Key facts

  • iThe model + activations exceed your GPU VRAM (e.g. an fp16 14B video model wanting ~28GB on a 24GB card).
  • iResolution or batch size too high — VRAM scales with pixel count and batch.
  • iA second model (upscaler, ControlNet, VAE) loaded alongside the main checkpoint.
  • iFragmentation after many generations without a flush.

Next step

  1. 1Lower resolution first (1024×1024 → 832×1216 → 768×768) and set batch size to 1 — the cheapest fix.
  2. 2Use an fp8 / GGUF (Q5/Q4) quantized checkpoint — roughly halves weight VRAM at a small quality cost.
  3. 3Add --lowvram / --medvram (or the WanVideoWrapper block-swap / offload nodes) to trade speed for VRAM.
  4. 4If it still OOMs after that, the model genuinely needs a bigger card — move to a 48GB (A6000) or 80GB (A100) GPU.

Not a fit when

  • If it OOMs at 512×512 batch 1, quantization won't save you — the base model is too big for the card.
  • Consumer 24GB cards (4090 / L4) can't hold fp16 14B video models no matter the settings.

Cheapest cloud GPU that fits

If the model genuinely needs more VRAM, the same workflow runs unchanged on a bigger GPU. Cheapest-first:

GPUVRAMPriceAction
L424 GB$0.51/hrDeploy
A600048 GB$0.64/hrDeploy
A10080 GB$1.81/hrDeploy
H10080 GB$4.28/hrDeploy

Prices include a 30% service fee. Billed per minute while running.

Not sure this workflow will run before you rent a GPU?

Paste your ComfyUI workflow JSON into the free checker — it flags missing nodes, model requirements, and the VRAM/GPU you actually need. No signup.

Other ComfyUI errors

Frequently Asked Questions

What causes "GPU Memory Exhausted" in ComfyUI?

The model + activations exceed your GPU VRAM (e.g. an fp16 14B video model wanting ~28GB on a 24GB card).

How do I fix "GPU Memory Exhausted"?

Lower resolution first (1024×1024 → 832×1216 → 768×768) and set batch size to 1 — the cheapest fix. Use an fp8 / GGUF (Q5/Q4) quantized checkpoint — roughly halves weight VRAM at a small quality cost.

Which cloud GPU fixes this without changing my workflow?

Move to a larger GPU: a A6000 (48GB) runs from $0.64/hr and holds models a 24GB card cannot. The same workflow runs unchanged.