Pin VAE Residency
Pinning the VAE so your encode/decode path stays warm
- vae
- VAE
Pin VAE Residency marks a tracked VAE object as sticky so ComfyUI's patched free_memory() protects it under VRAM pressure, with a priority knob to rank it against other pinned entries. VAE in, sticky flag set, same VAE out - it's the smallest of the pin nodes because the VAE is usually the smallest component, but it exists for a real reason.
That reason is churn. In a workflow that loads a big UNet between encode and decode, ComfyUI's stock unload logic can evict the VAE just because it was loaded earlier in the graph. Then your decode step re-loads it, and on a machine already at its VRAM limit that's not just a stall - it can cascade into the UNet getting shuffled around too. Pinning the VAE makes it the thing that survives, so the encode/decode path stays warm while the big model churns around it.
The inputs are the same three as every pin node:
vae- theVAEto mark. Needs to be a tracked native entry (loaded through this pack's loaders or a stock ComfyUI load path).sticky-truepins,falseunpins. Defaulttrue.priority--100to100, default0. Higher priority is protected first.
Output is the same VAE, passed through unchanged, so you can drop it inline before your VAE Encode or VAE Decode.
Under the pack's sticky_gpu policy (auto-selected when ComfyUI starts with --highvram or --gpu_only), the VAE's offload side stays on the GPU, and the patched VAE.encode/VAE.decode path works to preserve that residency - capping the working batch when needed and retrying with tiled encode/decode on OOM rather than letting a spike tear everything down. This node is the manual override on top: pin the VAE explicitly, or un-pin something the policy auto-pinned.
The honest framing: a VAE is usually a few hundred megabytes, so pinning one rarely saves you the way pinning a multi-gigabyte UNet does. This node is about predictability more than memory. If you've ever watched ComfyUI evict and reload the same VAE three times in one run, you'll appreciate the knob even if the raw numbers are small. And the usual caveats apply - pins are process-lifetime (no cross-process persistence), and a VAE loaded through an untracked third-party path can't be pinned.
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 (3)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — | |
| sticky | BOOLEAN | true | — |
| priority | INT | 0-100–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| VAE | VAE | — |