Pin Model Residency
Tell ComfyUI which model is worth keeping in VRAM
- model
- MODEL
ComfyUI's VRAM reclamation is polite to a fault. When something new needs memory, it unloads models in roughly the order they were loaded - oldest first - with no idea which ones you're going to need again in ten seconds. Pin Model Residency is your way to say "no, this one stays." It marks a tracked model as sticky and optionally changes its priority, so the pack's patched free_memory() protects it when VRAM pressure comes calling.
Here's the mechanism. The GPU Resident Loader pack patches comfy.model_management.free_memory() at startup. Under the sticky_gpu policy, that patched version considers sticky tracked entries first when it needs to reclaim VRAM: higher-priority sticky entries are protected first, lower-priority or older sticky entries yield first, and a transient protection floor stops ComfyUI from tearing down high-value residents for small requests. This node is the manual control for that system - set the sticky flag, set the priority, done.
The inputs are exactly three:
model- theMODELyou want to mark. It has to be a tracked native entry, which means it needs to have come through a patched load path (this pack's resident loaders, or a stock ComfyUI checkpoint/diffusion-model load).sticky-truemarks it sticky (protected),falseun-pins it. Defaulttrue.priority- an integer from-100to100, default0. Higher numbers are protected first when VRAM gets tight. This is how you rank which pinned models win if everything can't stay.
Output is the same MODEL, passed through unchanged, so you can drop this node inline in a model chain without rerouting anything.
Why bother? If you're doing a workflow where one big model is the workhorse and another is loaded occasionally - say, a Flux model you generate with constantly plus a ControlNet or a smaller model for a side pass - you pin the workhorse and let the occasional stuff churn in and out. Without a pin, ComfyUI may evict your expensive model right before you need it again, and you eat a multi-second reload. With the sticky_gpu policy active, models and CLIPs are actually auto-pinned on load anyway, so this node is for the cases where you want to pin something the policy wouldn't, adjust its priority, or un-pin something it would have kept.
One honest caveat: pins are a process-lifetime thing. Close ComfyUI and the VRAM is gone - the pack is explicit that cross-process persistence is out of scope. Also, a pin only matters if the object is actually tracked in the residency registry; a model loaded through some third-party node's private code path may never become a tracked entry, and then this node has nothing to pin. If you're already running this pack and keeping models resident, this is the knob that makes the policy behave.
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, or search "comfyui-gpu-resident-loader" in ComfyUI Manager.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| sticky | BOOLEAN | true | — |
| priority | INT | 0-100–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |