Nodes/comfyui-gpu-resident-loader/Preload Model To GPU
ComfyUI Node

Preload Model To GPU

Warm the model up before the run, not during it

By xmarre·Created 5 months ago·Updated 5 months ago· 2
Preload Model To GPU
  • model
  • MODEL
stickytrue
priority0

Preload Model To GPU is the "get it on the card now" node. You hand it a MODEL and it forces a full load onto the GPU immediately - calling ComfyUI's load_models_gpu(..., force_full_load=True) - then marks the result sticky in the residency registry with a priority you choose. It returns the same model, now resident, so the next thing in the graph doesn't pay the load cost mid-run.

Why would you preload a model you already have in the graph? Timing. In ComfyUI, nodes execute in dependency order, so if your model loads lazily the first time a sampler touches it, that load happens inside your generation run - and on a big model, that's a several-second stall right where you're trying to measure iteration time. Preload it as an earlier step and the run starts with the weights already on the GPU. It's the classic "warm-up before you start timing" move, and it doubles as the way you combine load-time residency control with the rest of this pack's pinning system.

The inputs:

  • model - the MODEL to force onto the GPU.
  • sticky - marks it sticky after preloading, so free_memory() protects it under the sticky_gpu policy. Default true.
  • priority - -100 to 100, default 0. Higher priority is protected first when VRAM is reclaimed.

Output is the same MODEL, passed through.

Mechanically it's two steps under the hood: load_models_gpu([patcher], force_full_load=True) does the actual full load, then the registry's set_sticky applies your sticky/priority settings. The patched load_models_gpu in this pack also handles the clone-replacement hardening - fully unloading conflicting wrappers before swapping instead of relying on a shallow detach that can leave base weights patched.

The trap to watch: this is a force full load. On a small card, preloading something big can itself trigger the very VRAM pressure you were trying to avoid - the pack's patched paths will unload lower-priority residents to make room, but that's a shuffle you're deliberately causing. Preload the models you know you'll reuse, pin the important ones, and let the occasional stuff stay lazy. Also remember this is process-lifetime: preload once, and it stays resident until ComfyUI evicts it or the process exits - there's no persistence 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 (3)

NameTypeDefaultDescription
modelMODEL
stickyBOOLEANtrue
priorityINT0-100–100

Outputs (1)

NameTypeDescription
MODELMODEL