Nodes/OmniNodes/Smart Unloader 🧹
ComfyUI Node

Smart Unloader 🧹

Forget the VRAM panic β€” put an unloader in your graph

By TensorVizionΒ·Created 3 months agoΒ·Updated about 8 hours agoΒ· 0
Smart Unloader 🧹
  • passthrough
  • output
  • summary
β—„unload_alltrueβ–Ί
β—„empty_cachetrueβ–Ί
β—„run_gctrueβ–Ί

If you've ever watched a long workflow die at the second heavy stage - the sampler fine, then the upscale pass OOMs - you've felt the exact problem the Smart Unloader exists to solve. ComfyUI is lazy about holding onto loaded models, and when one graph wants a checkpoint and an upscaler and a second sampler, VRAM can run out even though nothing's using the first model anymore.

The Smart Unloader from TensorVizion/OmniNodes is a cleanup node you drop into the middle of that graph. It unloads models, empties the CUDA cache, runs Python garbage collection, and passes whatever you connected to it straight through unchanged - so it slots into a workflow without breaking the data flow.

How it works

The mechanism is the clever part. It accepts any type on its passthrough socket (the * wildcard marker), and the output returns that same value untouched. The passthrough isn't the point - it's the dependency. By wiring whatever output you want to gate on into passthrough, you force ComfyUI to run the unload at exactly that point in the graph, because the node's result is what feeds the rest. Same trick the pack's Timer nodes use, and a standard one in the ecosystem.

Inside, with unload_all on (the default), it calls ComfyUI's unload_all_models() - every loaded MODEL, CLIP, and VAE gets dropped from memory. run_gc fires Python's garbage collector, and empty_cache empties the CUDA cache. On a CUDA box it also records VRAM usage before and after and reports the delta in the summary output, so you can see whether it actually bought you anything.

Where to put it

Between two heavy, unrelated stages - say, right after the base checkpoint finishes its job and before the upscaler takes over. The trap is the mirror image: if a downstream node still needs the model you just unloaded, ComfyUI will simply reload it, which costs more time than the unload saved. Place it after the last use of whatever it's shedding.

On a CPU-only machine the unload/GC calls still run, but the summary reports "CUDA not available" and skips the VRAM accounting - there's nothing to measure, and that's fine.

Inputs and outputs

Inputs: passthrough (any type), unload_all, empty_cache, run_gc (all booleans, all default true). Outputs: output (your data, untouched) and summary (a string listing which actions ran and the VRAM before/after).

Install

Ships with OmniNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes

Or ComfyUI Manager β†’ OmniNodes β†’ restart. No extra dependencies. It lives under TensorVizion/Model Utilities.

Troubleshooting

  • "It didn't free anything" - check the summary. If it says "CUDA not available," you're on CPU and the accounting is skipped by design. If VRAM dropped but a later node OOMs anyway, you placed it before something that reloads the model - move it.
  • Workflow got slower - almost certainly a reload: some node downstream re-imported the model you dumped. This node is surgical, not magical.
  • Node missing - restart fully; look for [OmniNodes] in the terminal log.

Reach for it when a single long workflow is juggling multiple models on a modest card. It's the difference between a workflow that crashes at 60% and one that just works.

CategoryTensorVizion/Model Utilities

Inputs (4)

NameTypeDefaultDescription
passthrough*β€”
unload_allBOOLEANtrueβ€”
empty_cacheBOOLEANtrueβ€”
run_gcBOOLEANtrueβ€”

Outputs (2)

NameTypeDescription
output*β€”
summarySTRINGβ€”