Nodes/ComfyUI-WepeNerd/Unload Local AI Model
ComfyUI Node

Unload Local AI Model

Give the VRAM back before a heavy generation

By WepeNerd·Created 5 months ago·Updated about 17 hours ago· 0
Unload Local AI Model
    • status
    trigger

    Unload Local AI Model is a one-button emergency brake for the Local AI stack: it stops the managed llama-server process and releases its VRAM. No inputs that matter - there's an optional trigger string socket for wiring sequencing - and one status output that tells you what happened, e.g. Released llama-server PID 1234. or No managed llama-server process is running.

    Why does a node whose whole job is "stop the thing" exist? Because of a nasty asymmetry in how this pack runs local LLMs. ComfyUI doesn't load the GGUF as a Comfy model - a separate llama-server process holds it, and ComfyUI can't see that process's VRAM usage. With the defaults (release_after_generate = true), the server spawns, answers, and dies per call, so the problem never comes up. But the speed options - release_after_generate = false for consecutive calls, or a keep_alive_seconds resident server - leave llama.cpp holding VRAM that ComfyUI's memory manager believes is free. Queue a heavy diffusion or video job into that and you get a CUDA out-of-memory crash that points nowhere helpful.

    So the pattern the README prescribes, and this node exists to execute:

    1. Run your LLM calls with keep-alive for speed.
    2. Run Unload Local AI Model (optionally check Local AI Status first).
    3. Queue the heavy generation with the VRAM actually free.

    The optional trigger input exists because execution order is otherwise non-obvious. ComfyUI runs the graph's data dependencies, not your reading order, so if you want the unload to happen before the diffusion node runs, you create an actual STRING dependency edge - feed the release node's status output (or the trigger wire) into something the heavy branch depends on. That forces the sequencing explicitly; the README calls it out as required "when sequencing matters."

    One design note in its favor: cancellation safety. The pack's server manager preserves a healthy resident server if a request is cancelled mid-stream, so you don't lose your keep-alive state to a stray interrupt - the release is deliberate, not incidental.

    It's also just a handy maintenance node: server misbehaving after a long session? Kill it here instead of hunting for a stray process, since the pack tracks the PID for you. Note it can only unload the pack's own managed server - a llama-server you launched manually is outside its reach.

    Install with the pack: ComfyUI Manager, search WepeNerd, or git clone https://github.com/WepeNerd/ComfyUI-WepeNerd.git into custom_nodes, pip install -r requirements.txt, restart. This node itself loads with no model or llama-server present - it's pure process management.

    CategoryWepeNerd/Local AI/Advanced

    Inputs (1)

    NameTypeDefaultDescription
    triggeroptSTRING

    Outputs (1)

    NameTypeDescription
    statusSTRING