Easy Clear GPU and Cache
A 'free the VRAM' button you can drop in any graph
- anything
- output
Every ComfyUI user eventually hits the wall where a workflow used to fit in VRAM and suddenly doesn't - usually because a previous run left models parked on the card. This node is that classic fix wrapped in a clickable box: a graph node whose only job is to clear the GPU and free ComfyUI's internal cache when you run it.
That's the whole value proposition, and it's a real one. EasyClearGpuAndCache calls gc.collect(), then ComfyUI's own model_management.unload_all_models() and soft_empty_cache() - the same cleanup that happens between jobs, forced on demand. It's the equivalent of opening a terminal and manually dropping your VRAM, except you can wire it into the graph itself.
How it works
The input is a wildcard (*) - it accepts literally anything, and it passes whatever you give it straight through on the output, untouched. That's the clever bit: you don't need to break your graph to use it. Drop it at the end of a workflow and feed it any convenient wire (a preview image, a string, even a latent); when the workflow finishes, the node fires, frees the models and cache, and hands the same value back so downstream nodes don't notice a thing. It's also flagged as an output node (OUTPUT_NODE = True), so ComfyUI always executes it even if nothing downstream depends on it.
Inputs: anything (any type). Output: output (same value, unchanged).
When you actually reach for it
Two honest use cases. First, the "clean slate" node at the tail of a workflow you run right before loading something heavy - you finish a batch, the cache gets emptied, and the next workflow starts with a clean card. Second, as a debugging aid when a workflow mysteriously OOMs after being run once: put it on the canvas, run it, and re-try.
Where people get confused: this doesn't make your current workflow less VRAM-hungry. The models need to be resident while you're sampling; clearing happens between runs, not mid-sampling. And it won't fix a graph that genuinely needs more memory than your card has - it just gives you back whatever was parked from earlier work. Also worth saying: it's a blunt instrument. unload_all_models() unloads everything, so in a workflow that loads and re-loads models in sequence (say, an img2vid pass), firing this in the middle means the next node re-loads from disk and you eat the loading cost. End-of-workflow is the right spot.
Install
ComfyUI Manager: search ComfyUI_Gayrat. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/gayratv/ComfyUI_Gayrat
cd ComfyUI_Gayrat
pip install -r requirements.txt
Restart ComfyUI; find it under Gayrat/cache. It has no dependencies beyond what ComfyUI ships - the whole thing is a thin wrapper over built-in model_management. Small personal pack, small node: exactly the kind of utility that's easier to build than to search for.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| anything | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |