Evict Model From GPU
Kick a model off the GPU when you want it gone
- model
- model
- eviction_status
Evict Model From GPU is the deliberate opposite of pinning: it unloads a model from the GPU's current loaded-model set, on purpose, and tells you whether it actually succeeded. Pass in a MODEL, get the same MODEL back plus a STRING status that reads evicted or not_loaded.
Why would you want to evict something? Residency management isn't just "keep everything forever" - sometimes you know a model is done for this run and you want its VRAM back before the next stage, or you want to stop the pack's pinning policy from holding onto something you've finished with. ComfyUI's automatic eviction is reactive (it happens when memory pressure demands it); this node is proactive. You control exactly when the memory is released instead of hoping the unload path does it cleanly.
The inputs are just two:
model- theMODELto evict.unpatch_weights- defaulttrue. With it on, eviction runs the full unload path, including unpatching the model's weights. Leave it on unless you have a specific reason not to; the pack hardens this path so unloads that wouldn't otherwise reclaim VRAM get redirected through a CPU offload target first.
Outputs: the same model (still a valid object - it just may no longer be loaded) and eviction_status, a STRING that's evicted when the unload succeeded and not_loaded when the model wasn't in the current loaded-model set to begin with.
That status string is the useful bit. not_loaded isn't an error - it just means the model had already been unloaded, or was never tracked as loaded, so there was nothing to evict. If you're building an automated workflow, you can wire the status somewhere it's actually read (a text display, or logic that decides what to do next) rather than guessing.
The context worth keeping in mind: this node only operates on the native loaded-model set ComfyUI tracks, and it's the counterpart to the pack's pinning - evicting a sticky entry will unload it, but under sticky_gpu the next load may re-pin it. And like everything in this pack, eviction is process-lifetime; you're freeing VRAM in the running ComfyUI, not deleting anything from disk.
The trap is the obvious one: evict a model you still need downstream and the next step just reloads it, slower than if you'd left it alone. Use this when a stage is genuinely finished, or when you're about to load something big and want to control which model pays for it. If you're constantly fighting VRAM in one direction (models being evicted when you don't want them to), you actually want the pin/preload nodes, not this one.
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.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| unpatch_weights | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| eviction_status | STRING | — |