ComfyUI Node

VLM Unload

ComfyUI's /free Can't Reach It — VLMUnload Is the Manual Eject

By phobod·Created 3 months ago·Updated 2 days ago· 0
VLM Unload
  • any

    A vision-language model is a hungry roommate. VLMJudge loads an 8B Qwen onto your GPU and, by default, leaves it there so the next call doesn't pay the load cost again. That's great for a loop of fifty images and terrible for the moment you want your VRAM back to sample a diffusion model. ComfyUI's own /free endpoint can't help - it has no idea a custom node is holding the model. VLMUnload is the eject button.

    It's about as simple as a node gets. Run it, and it clears the resident model that VLMJudge keeps in memory - the model and processor objects are dropped, Python garbage-collects, and the CUDA cache is emptied so the freed memory actually returns to the pool. If nothing was loaded, it prints nothing was loaded and moves on. No inputs required, no outputs, one optional any socket that exists purely so you can hang it in a workflow and control when it fires.

    How to use it

    If you set keep_loaded = false on VLMJudge, each judge run already unloads after answering, and VLMUnload is a redundant safety net. Where it earns its place is the default setup: VLMJudge with keep_loaded left on, so a batch of questions is fast, and then VLMUnload at the end to hand the VRAM back before the sampling half of your workflow runs.

    Two ways to place it:

    • Sequence it after your last judge call. Since ComfyUI executes output nodes by dependency order, hang VLMUnload off the tail of your QA section and it runs once everything upstream has finished.
    • Bypass-toggle it manually. Keep it in the graph, mute or unmute it when you want to keep or drop the model between experiments.

    Watch the console either way. VLMJudge logs how much memory it's holding on load (resident: 9.1 of 12.0 GB), and VLMUnload reports what it unloaded. That pair of lines tells you whether your VRAM actually went where you think it did.

    Gotchas

    • It unloads at the end of its own run, not when you click it. If you want the model gone before something else executes, the wiring has to make that ordering explicit.
    • If VRAM still looks full afterwards, look elsewhere. This only frees the VLM. Your diffusion checkpoint, VAE, and text encoders are managed by ComfyUI's normal model management, not by this node.
    • It won't fix a mid-run OOM. The unload happens at a node boundary; if your sampler runs out of memory while the judge is resident, you need keep_loaded = false on the judge instead, not a VLMUnload downstream.

    It ships in the same pack as VLMJudge - phobod's ComfyUI_Face_similarity, which despite the name now carries a whole QA toolkit:

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

    or search ComfyUI_Face_similarity in ComfyUI Manager. No extra dependencies for this node; the work happens in the pack's shared VLM module.

    CategoryQA

    Inputs (1)

    NameTypeDefaultDescription
    anyopt*

    Outputs (0)

    No outputs