Nodes/Comfy_HunyuanImage3/Hunyuan Emergency Cleanup
ComfyUI Node

Hunyuan Emergency Cleanup

The 'are you sure?' button for a full VRAM reset

By EricRollei·Created 10 months ago·Updated 4 months ago· 65
Hunyuan Emergency Cleanup
    • result
    confirmfalse

    Running an 80B image model in ComfyUI means eventually your VRAM fills up in a way that shouldn't have happened, and you need the big red button. Hunyuan Emergency Cleanup (class HunyuanEmergencyCleanup) is exactly that button, with a safety catch: it refuses to do anything until you explicitly flip confirm to True. It's the V2-family sibling of the pack's Hunyuan 3 Force Unload (Nuclear) node - same idea, fewer knobs, and an intentional confirmation gate so you don't nuke your cache by accident on a normal run.

    The tooltip says it plainly: "This will unload all cached models!" Not just Hunyuan - everything the pack (and ComfyUI's model cache) is holding. That's the point of an emergency reset: you've hit an OOM, a stuck allocation, or the mysterious "VRAM full but the node says the model is unloaded" state, and you want a clean slate before the next load.

    How it works

    The node runs garbage collection and clears the cached Hunyuan model(s), then returns a short text report. The confirm gate is the whole UX: the node's default is false, so as long as you leave it alone it's a no-op. Set it to True and the cleanup actually executes. Because it's an output node with no mandatory inputs, you can drop it into any workflow as a manual panic button - select it and hit queue, or connect a trigger so it fires at the right moment.

    The inputs and outputs

    • confirm (BOOLEAN, default false) - the only input that matters. Set to True to authorize the cleanup. Nothing happens while it's False.
    • result (STRING) - a text confirmation of what was cleared.

    That's it. Two fields, one of which you're only meant to touch when you mean it.

    How to install it

    Same as every node in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EricRollei/Comfy_HunyuanImage3
    cd Comfy_HunyuanImage3
    pip install -r requirements.txt
    

    Restart ComfyUI, hard-refresh the browser, and it's under the Hunyuan/V2 category. ComfyUI Manager users can search HunyuanImage and install from there instead.

    Common issues & troubleshooting

    The main "gotcha" is really the design: if you click queue expecting cleanup and nothing happens, check confirm - the whole point of the gate is that you have to turn it on. That's not a bug, it's the safety feature working as intended.

    Also worth knowing the boundary: this clears cached models. If you're seeing VRAM that stays stuck even after cleanup - orphaned CUDA allocations the cache doesn't know about - escalate to Hunyuan 3 Force Unload (Nuclear) with reset_cuda_allocator and nuke_orphaned_tensors enabled. Emergency Cleanup is the polite version; Nuclear is the one that hunts allocations down.

    CategoryHunyuan/V2

    Inputs (1)

    NameTypeDefaultDescription
    confirmBOOLEANfalseSet to True to confirm cleanup. This will unload all cached models!

    Outputs (1)

    NameTypeDescription
    resultSTRING