Nodes/ComfyUI-988/LM Unload 988
ComfyUI Node

LM Unload 988

The passthrough node that frees your VRAM on its way through

By kajan988·Created 3 months ago·Updated about a month ago· 1
LM Unload 988
  • trigger
  • output
unload_llmtrue
unload_all_modelstrue
empty_cuda_cachefalse

LLM and diffusion model in the same graph means two things fighting over one GPU. LM Unload 988 is the cleanup crew: a passthrough node whose side effect - not its data flow - is the point. Wire anything into it, and the value passes through unchanged while, as the pack describes it, it unloads LLM models from LM Studio and/or clears ComfyUI's VRAM.

It's the quiet partner to LM Studio 988, and it solves a real asymmetry: the LLM node can free ComfyUI's models before it runs (via its unload_all_models toggle), but after generation your VRAM is still holding the LLM you no longer need. Drop this at the end of the workflow - or at the point where you switch from an LLM-heavy pass back to pure generation - and the GPU gets a fresh start instead of you restarting ComfyUI.

How it works

It's a pipe node: trigger accepts any type (the * wildcard) and returns it as output unchanged. What it does on the way is governed by three toggles:

  • unload_llm (default on) - asks LM Studio to unload all loaded LLM models.
  • unload_all_models (default on) - unloads ComfyUI's own models (checkpoint, VAE, etc.) from VRAM.
  • empty_cuda_cache (default off) - calls torch.cuda.empty_cache() on top. Turn it on when you want the fragment-packed leftovers gone too; it costs a little time.

The reason it's a passthrough rather than a dead-end node is ComfyUI's execution model: nodes only run when they're on the path to an output. A passthrough guarantees the unload actually fires when the workflow runs, and it means you can splice it anywhere without breaking a data chain. If you want the unload to happen before the next big generation, wire it so it sits upstream of whatever runs next - order in the graph is order of execution.

The input that matters

Just trigger - and it's really about what you wire into it, not a value. Wire the final image, the last string, anything, purely so the node is forced to execute. The toggles do the real work.

Gotchas

  • "Nothing happened" - if the node isn't on an executed path (bypassed, or not connected toward an output), the side effect never fires. It's also worth knowing that this side effect is fire once per run; if you need an unload mid-workflow, place it correctly rather than hoping.
  • Unload is heavy - unloading and reloading models costs seconds each way. Don't sprinkle these everywhere; one at the end of the LLM phase is usually enough.
  • It needs the pack's lmstudio dependency installed (same requirements as LM Studio 988) to talk to the LM Studio server for unload_llm. The ComfyUI-side toggles work regardless.

Install

Part of ComfyUI-988: Manager (search "ComfyUI-988") or:

cd ComfyUI/custom_nodes
git clone https://github.com/kajan988/ComfyUI-988
cd ComfyUI-988
pip install -r requirements.txt

Then restart. One-line summary: feed it anything, let it clean up, take your value back unchanged.

Category🦇988/LM Studio

Inputs (4)

NameTypeDefaultDescription
trigger*Any input value — passes through unchanged.
unload_llmBOOLEANtrueUnload all LLM models from LM Studio.
unload_all_modelsBOOLEANtrueUnloads all ComfyUI models from VRAM.
empty_cuda_cacheBOOLEANfalseClears the CUDA cache.

Outputs (1)

NameTypeDescription
output*