đ§č FMJ Unload All LLM
FMJ Unload All LLM kicks Ollama out of memory on demand
- status
Ollama is a polite house guest that never leaves. After it answers a prompt, it keeps the model sitting in memory for a while - this pack's own nodes use a 5-minute keep_alive by default - so if you bounce between an LLM call and a heavy generation on a card with limited VRAM, the two end up fighting over the same tens of GB. đ§č FMJ Unload All LLM is the "please leave" button.
It's the smallest node in the FMJ-LLM pack, and it does exactly one thing well: it asks Ollama to unload every currently-loaded model. If that sounds mundane, try doing it by hand from the terminal sometime.
How it works
The mechanism is straight out of Ollama's own API docs, which is reassuring. When you trigger the node it:
- Calls
GET /api/psto list the models Ollama currently has loaded. - For each one, sends
POST /api/generatewithkeep_alive: 0.
That keep_alive: 0 is Ollama's documented "unload this right now" flag (the opposite of -1, which pins a model in memory forever). Community threads on r/comfyui confirm the pain this solves - people hunting for ways to force Ollama to release VRAM after generation, either with an OLLAMA_KEEP_ALIVE=0 environment variable or per-call keep_alive: 0. This node is the per-call version, on demand and inside your graph.
The inputs and outputs
There's one input and one output, so this is a two-minute read:
trigger- aBOOLEANthat defaults to False. You have to flip it on for anything to happen. That's deliberate: it stops the node from firing on every queue run.status- aSTRINGoutput telling you what happened: which models were unloaded, "no models loaded", or an error if Ollama couldn't be reached.
Wire the status output to a text display or just read it in the node. There's nothing to connect upstream unless you want to trigger it programmatically - a Reroute or any boolean works.
Installing it
Same pack, same steps as the rest of FMJ-LLM: ComfyUI Manager â search "ComfyUI_FMJ_LLM", or cd ComfyUI/custom_nodes && git clone https://github.com/bulldog68/ComfyUI_FMJ_LLM, then restart ComfyUI. The only dependency is the ollama Python package, which Manager handles. You need the Ollama runtime installed and running, naturally.
Gotchas
- The URL is hardcoded. Unlike the pack's other nodes, FMJ Unload All LLM has no
ollama_urlfield - it always talks tohttp://localhost:11434. If your Ollama runs on another machine, this node can't see it. - Trigger defaults to False, and that trips people up constantly. You flip it, run, and read the status string. Nothing happens silently otherwise.
- If no model is loaded, it just tells you so. Not an error - a feature.
Reach for it before a long generation or before swapping in a big model, and you won't be watching your sampler OOM on a model Ollama still had parked in VRAM.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| trigger | BOOLEAN | false | â |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| status | STRING | â |