FL Unload Model
Free VRAM mid-workflow, in the right order
- value
- model
- *
Big multi-stage workflows run out of VRAM not because any single step is too heavy, but because ComfyUI keeps everything resident. You loaded a checkpoint for the generation, an upscale model for the upscale, maybe a video model after that - and they're all still sitting in memory when you hit the last stage, which OOMs. FL_UnloadModel is the eject button: it removes a model from memory and clears the CUDA cache at a specific point in your graph, so the heavy thing that runs next has room.
The clever part is how it fires at the right time. ComfyUI executes nodes based on data dependencies, so a node that just "does a thing" with no wires would run whenever - useless for freeing memory at a precise moment. This node solves that with a passthrough: it takes a value of wildcard type (*) and returns it unchanged, so you splice it onto a wire between two stages. The unload happens as that value flows through, which pins it to exactly the point in the graph you want. That's the mental model: it's a pass-through you put on the wire where you need the memory freed.
The inputs and output
value(*, required) - anything. This is the passthrough that gives the node its place in the execution order. Wire your stage-1 output into it and its output onward into stage 2; the memory clear happens in between.model(*, optional) - the model to unload. Connect the specific model you're done with.- Output
*- the samevalueyou put in, untouched.
The wildcard typing is what makes it flexible: value can be a latent, an image, conditioning - whatever your two stages happen to hand off. You're not converting anything, just giving the unload a hook into the timeline.
Installing it
Part of ComfyUI_Fill-Nodes. ComfyUI Manager: search Fill-Nodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart ComfyUI. Nothing to download - it just calls into ComfyUI's own model management.
When to use it (and the nuclear option)
Reach for FL_UnloadModel when a workflow that has plenty of VRAM for any single stage still dies partway through - that's the signature of models piling up. Drop it after the stage whose model you no longer need, before the stage that's starving.
If you don't care about surgical precision and just want everything gone between two heavy phases, the pack also has FL_UnloadAllModels, which triggers ComfyUI's full unload_all_models() plus a garbage-collect and cache empty. That's the sledgehammer; FL_UnloadModel is the scalpel. One caveat for both: unloading means the model has to be reloaded if you use it again later in the same run, and reloading from disk isn't free. So don't unload something you're about to need again - put the unload between stages that genuinely don't share a model, or you'll trade an OOM for a slowdown.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — | |
| modelopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |