ComfyUI Node

UnloadModel

Unload Model

By SeanScripts·Created 2 years ago·Updated about a year ago· 108
UnloadModel
  • value
  • model
  • *

This is the node you reach for when you want to kick a specific model out of VRAM in the middle of a run - not between runs, not at the end, but at an exact step you choose. The classic case: you've got a big text encoder that did its job encoding your prompt, and now it's just squatting on memory you'd rather hand to the sampler.

Before you install anything: ComfyUI already manages memory on its own, and for most people that's enough - the author says so flat out. Unload Model is for when the automatic behavior isn't cutting it: you're juggling models that don't all fit at once, or generations get slower after the first batch as things pile up. If neither describes you, you probably don't need this node.

Why you'd actually want it

The situation it was built for is Flux. Flux runs two text encoders - a small CLIP-L and the chunky T5-XXL - and on newer models the encoder can be a huge slice of the total footprint. But the encoder only runs once, up front, to turn your prompt into conditioning. After that it does nothing but occupy VRAM while the diffusion model grinds through 20-odd sampling steps.

So the move is: encode your prompt, unload the encoder, then sample with all that memory freed up. The author's own example is keeping a local LLM resident alongside. It's manual memory choreography, and when you're right at the edge of what your card can hold, it's the difference between a workflow that runs and one that OOMs. The other honest use cases: unloading at the very end of a workflow, or when switching models mid-graph and you want the old one gone before the new one loads.

How it works

It's a passthrough, and that's the whole trick. The node doesn't sit off to the side with a button - it sits inline on a wire. Whatever you plug into it comes straight out the other end unchanged; the unload is a side effect that happens when execution reaches the node. It leans entirely on ComfyUI's existing memory management to do the freeing, which is also why it's a tiny pack with no dependencies and nothing to download.

The inputs and output that matter

There are exactly two inputs:

  • value - the passthrough. Feed it anything the workflow was already carrying at that point (a conditioning, a latent, whatever), and it comes back out the output untouched. Its only job is to put this node on the execution path.
  • model - the model you actually want unloaded. Connect the CLIP (or whatever) here.

The single output is the value you fed in, unchanged. You route it onward to wherever that value was originally going.

Concretely, for the Flux case: drop Unload Model right after your CLIPTextEncode (or CLIPTextEncodeFlux). Wire the resulting conditioning into value, wire your CLIP model into model, and send the output on to FluxGuidance or BasicGuider - exactly where the conditioning was headed anyway. The conditioning passes through, the CLIP gets unloaded, and sampling runs with the extra room.

Installing it

Two ways. Through ComfyUI Manager, open the custom-nodes install panel and search for the pack title, ComfyUI-Unload-Model, then install and restart. Or clone it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/SeanScripts/ComfyUI-Unload-Model.git

Then restart the ComfyUI server. No models to fetch, no heavy pip dependencies.

Where people get tripped up

The number one gotcha follows straight from the passthrough design: if the node's output isn't wired into something that eventually reaches an output node, it never runs, and nothing unloads. ComfyUI executes backward from your Save/Preview nodes, pulling in only what feeds them, so a node dangling off to the side gets skipped entirely. You have to route its output through your graph, standing in for the wire it replaced. People routinely add an unload node, see nothing happen, and conclude it's broken when really it's just not on the path.

The author's own caveat: these nodes are experimental. The one known rough edge is GGUF - changes in the GGUF loader nodes have at times caused the unload command to not actually free GGUF-quantized models. It may be patched by the time you read this, but if you're running a GGUF checkpoint or a GGUF text encoder and the memory doesn't drop, that's the first thing to suspect.

Last thing: if you just want to clear VRAM between runs rather than mid-workflow, you don't need this at all. ComfyUI Manager has an unload button for exactly that, and there are dedicated "purge VRAM" nodes floating around too. Unload Model earns its place specifically when the freeing has to happen at a chosen point inside a single execution.

CategoryUnload Model

Inputs (2)

NameTypeDefaultDescription
value*
modelopt*

Outputs (1)

NameTypeDescription
**