FL Unload All Models
Dump everything from VRAM mid-workflow to dodge OOM
- value
- *
Big workflows OOM in a predictable place: the handoff between two heavy stages. You finish a diffusion pass, then try to load an upscaler or a vision-LLM captioner, and there just isn't room because the first model is still camped in VRAM. FL_UnloadAllModels is the sledgehammer for that moment - drop it between the stages and it flushes everything so the second model has a clean field to load into.
It's blunt on purpose. This isn't surgical model management; it unloads all of them. When you know stage two doesn't need anything from stage one, that bluntness is exactly what you want.
How it works
When it fires, the node calls ComfyUI's unload_all_models() to evict loaded models, then follows up with gc.collect() to sweep Python garbage, torch.cuda.empty_cache() to hand freed memory back to the allocator, and torch.cuda.ipc_collect() to clean up cross-process handles. That combination is why it frees more than a casual unload - it's clearing the caches that otherwise keep VRAM "used" even after a model is nominally gone.
The one thing to internalize: it's a passthrough. It has a single value input of any type and passes that same value straight to its output. That's not a quirk, it's the mechanism - ComfyUI decides execution order from the graph's connections, so you route some real signal through the node to pin when the unload happens. Wire it so the thing it passes is needed by stage two, and the flush lands exactly at the boundary.
The inputs and outputs that matter
value(any type, required) - the signal you pass through. Route the output of stage one (or anything that stage two consumes) into here, so the node sits in the execution path at the right spot.
Output is a single * - the same value, untouched. Connect it onward to stage two. The data isn't the point; the side effect of clearing VRAM as the value passes is.
When you'd reach for it
Multi-model pipelines on limited VRAM. Diffusion → SeedVR/upscale. Diffusion → local LLM caption. Video generation → frame interpolation. Anywhere you've watched the console throw "CUDA out of memory" right as the second model tries to load. If you need to unload one specific model and keep others, use the pack's FL_UnloadModel instead - this one takes no prisoners.
Installing it
ComfyUI Manager → ComfyUI_Fill-Nodes → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. No dependency beyond the pack; it uses PyTorch's own memory calls, which you already have.
Common issues & troubleshooting
It "does nothing." Almost always a placement problem. If nothing downstream consumes its output, ComfyUI may schedule it anywhere - or the graph runs the unload before the model you wanted gone was even loaded. Put it firmly between the two stages by passing a value that stage two actually needs.
Stage two is slow now. Expected. You threw everything out, so anything stage two shares with stage one has to reload from disk. That's the trade: a few seconds of reload versus an OOM crash. Only unload when the next stage genuinely doesn't reuse the previous models.
Still OOMing. Some memory is held by references the node can't reach (a custom node clinging to a tensor). Unloading helps but isn't magic; you may still need tiling, a smaller model, or lower resolution for the heavy stage.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |