Eric ERNIE-Image Unload
Freeing VRAM without the reload trap
- images
- images
- status
The pack's loader keeps ERNIE-Image cached in VRAM when keep_in_vram is on - which is the right default, because an 8B model plus a 3B text encoder plus a VAE is not something you want to re-load for every generation. But it does mean the model stays resident until something kicks it out, and if your next project is a different model entirely, you can end up playing VRAM Tetris.
Eric ERNIE-Image Unload is the eviction tool, and its design tells a small but instructive story. The obvious way to build an unload node is to take the pipeline as input, so ComfyUI knows what to free. The author did exactly that in the first version, and it failed: ComfyUI resolves inputs before running a node, so wiring the pipeline forced the Load node to re-execute first - reloading the whole model into VRAM so the unload node could then free it. That OOMs on most cards before Unload ever runs.
So the shipped node takes no pipeline input at all. It clears the loader's class-level cache directly, tears down accelerate offload hooks, moves every submodel to CPU, runs garbage collection twice, then torch.cuda.empty_cache() on every GPU and reports the before/after allocation in its status output. No connections, no reload, no trap.
What you set
Almost nothing, which is the point. There's a single optional images input that is passthrough only - wire the end of a workflow into it and the node triggers cleanup after generation finishes, without pulling any upstream node back into the graph. That's the intended pattern: run it standalone (it's marked as an output node, so you can just queue it with no connections), or hang it off the last image in a batch workflow.
Outputs: images (the passthrough, for keeping a graph connected) and status - a STRING telling you how many cached pipelines were cleared and the GPU allocation before/after. It's the kind of status string you'd only look at when something's wrong, but it's there.
When you'd use it
- You've been generating ERNIE all afternoon,
keep_in_vramis holding the pipeline, and you're switching to a heavier checkpoint that needs the space. - You're running batch jobs and want VRAM released between batches without restarting ComfyUI.
- You've hit an OOM after generation - often the VAE or a lingering cached pipeline - and want a clean slate.
The honest caveats
- It only clears this pack's cached pipelines. Other packs' models, LoRAs, and the base ComfyUI checkpoint are out of scope; don't expect it to be a universal VRAM nuke.
- Cached-pipeline eviction is why
keep_in_vrampairs with it: if you've disabled the cache, there may be nothing to clear (the status string will tell you "No cached pipelines found"). - It's a tool for a specific flow, not something you need in every graph. In a simple load → generate → save workflow, this node does nothing for you.
Install
It's part of the same one-time pack setup: ComfyUI Manager search "Eric ERNIE-Image", or cd ComfyUI/custom_nodes && git clone https://github.com/EricRollei/Ernie_Image_Real_Diffusers, then restart. No separate dependencies - the node just imports torch and gc and pokes the loader's cache.
A two-node memory story - Load with the cache on, Generate, Unload at the end - is the cleanest way to keep ERNIE in your toolkit without it squatting on your GPU between projects.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| imagesopt | IMAGE | Optional passthrough - does not trigger model reload. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| status | STRING | — |