Genfocus Unload Models
The eject button for a 23GB pipeline that won't leave VRAM
- trigger
- status
If you've run a Genfocus workflow, you know the situation: the loaders cache the entire FLUX pipeline at class level, keyed on their config, so it stays in memory even after the graph finishes - and it's a 23GB pipeline. GenfocusUnloadModels is the manual eject button. It clears the cached Genfocus pipelines (from the Native loader, the component loader, and the deblur-only loader), attempts to clear DepthPro's global state, runs garbage collection, and empties the CUDA cache. What comes out the status STRING output is a report of everything it just freed, including current VRAM usage.
Why this node has to exist
Two ComfyUI realities collide here. First, custom nodes share one Python environment and one GPU - nothing gets isolated or auto-freed when a workflow finishes. Second, this pack's loaders deliberately cache pipelines so re-running a workflow doesn't reload 23GB every time. That's a great trade while you're actively working, and a trap the moment you want to run anything else - a stale FLUX pipeline can block a smaller model you actually need, or just sit there eating VRAM and making your GPU fans spin. This node is the workaround, and it's also the fix for "models get orphaned from reloading workflows".
The knobs
- unload_genfocus (true) - clears the cached FLUX pipelines from every Genfocus loader.
- unload_depthpro (true) - tries to clear DepthPro's globals. The honest caveat: DepthPro doesn't use a class-level cache - the reference lives in your graph's wire. The node will tell you this in the status and, if needed, suggest disconnecting the depth model output so garbage collection can claim it.
- trigger (optional, any type) - connect anything here to force execution. The node has
IS_CHANGEDset to always run when triggered, because a node with no changing inputs would otherwise execute once and then be cached as "unchanged" forever.
Output: status (STRING), and it's an output node - wire it to a text/primitive preview to read the report.
How to wire it
This is the rare node you want in a graph you run, then delete. Two patterns that work:
- At the end of a Genfocus workflow - connect its
triggerto anything that fires, run, read the status, then remove it. It runs after the workflow and leaves you with clean VRAM. - As a cache-buster - if you changed models and the loader hands you stale state, run this once to clear the cache so the loader rebuilds fresh.
Install
It's part of the Refocus pack - ComfyUI Manager ("Refocus - Generative Refocusing") or clone into custom_nodes/. It only matters if you've loaded native Genfocus models, so the diffusers stack (pip install diffusers transformers accelerate peft) and a FLUX pipeline are implied prerequisites. No model files of its own. It's not a node you build around - it's the one you reach for when the pack's own caching starts being the problem.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| unload_genfocus | BOOLEAN | true | Unload Genfocus FLUX pipeline from memory |
| unload_depthpro | BOOLEAN | true | Unload DepthPro depth model from memory |
| triggeropt | * | Connect anything here to trigger unload |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |