ComfyUI Node

Evict CLIP From GPU

Unload the text encoder when you're done with it

By xmarre·Created 5 months ago·Updated 5 months ago· 2
Evict CLIP From GPU
  • clip
  • clip
  • eviction_status
unpatch_weightstrue

Evict CLIP From GPU unloads a CLIP from the current loaded-model set on purpose, and reports whether it worked. CLIP in, same CLIP out, plus a STRING status: evicted when the unload succeeded, not_loaded when the CLIP wasn't in the loaded set to begin with.

The text encoder is a good candidate for deliberate eviction because it's used in a burst and then idle for the rest of the run. Prompt encoding happens early - often once - and after that the CLIP just sits there occupying VRAM while the UNet does the heavy lifting. On a card where every gigabyte counts, letting a text encoder you've finished with hang around while a video model loads is pure waste. This node is how you reclaim it at exactly the right moment: after the last encode, before the big load.

The inputs:

  • clip - the CLIP to evict.
  • unpatch_weights - default true. Full unload path, including unpatching weights. The pack's patched unload/detach path redirects through a CPU offload target when a plain unload wouldn't reclaim VRAM, so leaving this on gets you the complete teardown.

Outputs: the same clip and eviction_status (evicted / not_loaded).

The status string is genuinely useful for automation: not_loaded isn't a failure, it just means there was nothing to evict - which can happen when the CLIP was already unloaded, or when it was never tracked as loaded (loaded through a private third-party path the registry doesn't see). Reading the status lets your workflow react instead of assuming.

The calibration is worth stating plainly: on a big card, evicting a CLIP saves you maybe a few hundred MB - nice, not transformative. On a tight card trying to fit a huge UNet alongside everything else, freeing the encoder at the right moment can be exactly the difference between an OOM and a clean load. The pack's own philosophy is sticky residency (keep the hot stuff), so this node is the deliberate counter-move: when the CLIP's burst is done, give the memory back.

The trap: evict a CLIP that gets used again downstream and you just pay the reload. Sequence matters - evict after the last encode, not before a second one. And as with all the evict nodes, this operates on the live process only; nothing persists across restarts.

Install with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-GPU-Resident-Loader
cd ComfyUI-GPU-Resident-Loader
pip install -r requirements.txt

Restart ComfyUI, or search "comfyui-gpu-resident-loader" in ComfyUI Manager.

CategoryGPU Resident Loader/residency

Inputs (2)

NameTypeDefaultDescription
clipCLIP
unpatch_weightsBOOLEANtrue

Outputs (2)

NameTypeDescription
clipCLIP
eviction_statusSTRING