ComfyUI Node

Offload Model

Kick a model off the GPU when ComfyUI won't

By lokinou·Created about a year ago·Updated 11 months ago· 2
Offload Model
  • value
  • model
  • *
  • *
deviceauto
on_errorraise
enabletrue

ComfyUI's memory management is genuinely good - it loads model weights on demand and offloads them when it thinks you're done. But "thinks" is the operative word. If you're on a 6-8GB card, or you've stacked a video pipeline with a transformer, text encoder, and VAE all resident at once, the sampler can still die with a CUDA OOM that is really just "one model too many sitting in VRAM." Offload Model is the manual override: drop it in the graph and it moves a model from the GPU to CPU at exactly the point you choose, then force-releases the VRAM.

It comes from lokinou's ComfyUI-Offload-Models pack, a tiny two-node project. Before anything else, the honest warning: the pack is deprecated. Version 1.1.1 added a note redirecting users to comfyui-better-flow, the author's successor. The nodes still work as written, but if you're building a new workflow, check better-flow first.

How it works

Offload Model is a passthrough trigger, not a loader. You wire the flow of your graph through it - say, run the latent from your sampler through the node - and it runs inline when its turn comes. Under the hood it calls ComfyUI's own model-management API: it reads the model's current device, calls the model's move function to shift it to the offload device, then runs gc.collect(), cleanup_models_gc(), and soft_empty_cache() to actually get the VRAM back. Version 0.0.2 fixed the case where moving only the ModelPatcher freed nothing - the node now scans inside the patcher and moves the embedded model too.

The inputs that matter

  • value (required, any type): the passthrough. Wire whatever flows past the model - image, latent, conditioning - through this input.
  • model: the model to offload. Feed it whatever your loader outputs.
  • device (default auto): auto sends the model to ComfyUI's offload device (in practice, CPU). You can also pin cpu explicitly or pick a specific cuda:N.
  • on_error (default raise): ignore or raise. Useful for fragile workflows.
  • enable (default on): flip this off to bypass the node entirely - handy for A/B-testing whether offloading is even helping before you restructure a whole workflow.

Both outputs are pass-throughs: value and model come back unchanged, so you can keep the chain alive.

Installing it

ComfyUI Manager is the easy path - search "comfyui-offload-models" and install from the registry. Or clone manually:

cd ComfyUI/custom_nodes
git clone https://github.com/lokinou/comfyui-offload-models.git

Then restart ComfyUI. There are no model downloads and zero Python dependencies (the pyproject.toml declares an empty dependency list), so the install is as painless as this ecosystem gets.

Where it bites

Two real gotchas. First, Nunchaku-quantized Flux transformers are deliberately unsupported - the node raises (or ignores, with on_error set to ignore) because Nunchaku manages offloading inside its own binaries, and fighting it breaks things. Second, the source has a confessional comment that the passthrough "doesn't work with reroute for some reason?" - if your workflow routes everything through Reroute nodes, wire directly instead.

Honestly, most setups never need this. ComfyUI's smart memory management handles the common cases, and the KB's own guidance is to try default flags before reaching for memory hacks. Reach for Offload Model when you can name the OOM: a specific model that stays resident between stages and chokes the next one. Then it's exactly the tool you wanted - right up until the deprecation deadline.

CategoryUnload Model

Inputs (5)

NameTypeDefaultDescription
value*
modelopt*
deviceoptCOMBOautoSelect the device to offload the model to.
on_erroroptCOMBOraiseWhat to do on error: ignore or raise an exception.
enableoptBOOLEANtrueEnable offloading of the model to the offload device.

Outputs (2)

NameTypeDescription
**
**