Unload Models By Type
Free VRAM exactly where you need it, then keep the wire flowing
- trigger
- model
- clip
- vae
- conditioning
- trigger
- model
- clip
- vae
- conditioning
- status
VRAM is the real bottleneck in most ComfyUI setups, and the classic fix is to unload models you're done with at the right moment in the graph. Unload Models By Type is WorkflowX's explicit version of that: it inspects what ComfyUI currently has resident and releases models of the type you pick - text encoder, diffusion model, VAE, CLIP vision, other, or everything - right at the point in the execution order where you drop it.
The mechanism is worth understanding because it's smarter than "clear everything." The node walks ComfyUI's loaded-model cache, classifies each entry by peeking at the underlying model (clip vs diffusion model vs VAE vs clip-vision, with fallback heuristics), and unloads only what matches your model_type. Then, if you've got empty_cache on (default true), it requests a device-cache cleanup on top. You choose the moment by placement: the author's own description says it best - run it inline before a CLIP Text Encode to unload the diffusion model, or after encoding to unload the text encoder before sampling.
The deliberate design detail: it always runs. The node's IS_CHANGED returns NaN, the ComfyUI idiom that forces a node to execute every single pass instead of being skipped by the cache (the plumbing-layer trick that's usually a footgun, here used on purpose - unloads can't be "cached away"). And because it doubles as a passthrough, you can wire it inline without breaking your graph.
The inputs that matter
model_type- what to release:Text Encoder,Diffusion Model / UNet,VAE,CLIP Vision,Other Loaded Models, orAll Loaded Models.device_scope-Current DeviceorAll Devices. Matters if you're on a multi-GPU rig; most people never touch it.empty_cache(defaulttrue) - request CUDA/device cache cleanup after unloading.trigger(*) - optional. Any connection here establishes when unloading runs; you don't even need a real value, the execution dependency is the point.
Optional model, clip, vae, conditioning inputs pass straight through to matching outputs so the node can sit inline in a real chain without breaking links. Outputs mirror them plus a status string reporting what was requested and released.
Install
One pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/haroonaslam/WorkflowX-Configurator
or search WorkflowX Configurator in ComfyUI Manager, restart ComfyUI, refresh the browser. No pip deps, no model downloads.
Where it pays off and where it bites
- Best for the handoff stage. The pack's own example workflow uses the generated batch as the trigger to unload models before encoding video - freeing VRAM for the video encoder is the canonical use.
- Unload too early and you reload. If you free the text encoder and then a later node needs it, ComfyUI just reloads it - you've added time, not saved it. Place unloads after the last consumer of a component, not "just before something big."
All Loaded Modelsis a hammer. It works, but it nukes everything resident; a typed unload is usually the right tool.- It reports, it doesn't guess. The
statusoutput tells you what was actually released - read it once or twice to confirm your mental model of what was resident matches reality.
A genuinely useful VRAM-management node that earns its place in any workflow that generates, then encodes.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model_type | COMBO | Text Encoder | 6 options: Text Encoder, Diffusion Model / UNet, VAE, CLIP Vision, Other Loaded Models, All Loaded Models |
| device_scope | COMBO | Current Device | 2 options: Current Device, All Devices |
| empty_cache | BOOLEAN | true | — |
| triggeropt | * | — | |
| modelopt | MODEL | — | |
| clipopt | CLIP | — | |
| vaeopt | VAE | — | |
| conditioningopt | CONDITIONING | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| trigger | * | — |
| model | MODEL | — |
| clip | CLIP | — |
| vae | VAE | — |
| conditioning | CONDITIONING | — |
| status | STRING | — |