Nodes/TrentNodes/Unload MiniCPM
ComfyUI Node

Unload MiniCPM

The VRAM janitor that never forgets

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Unload MiniCPM
  • trigger
  • status

Here's the VRAM problem nobody warns you about with vision-language nodes: they hold their model resident in memory after the run, and the moment you queue a diffusion job, you OOM. The pack's VidScribe MiniCPM node auto-unloads its model after 60 seconds idle, but 60 seconds of idleness is an eternity when the sampler is about to start. Unload MiniCPM exists to make that cleanup immediate and explicit.

It's a tiny node with a simple contract: connect anything to its trigger input, and when the graph reaches it, the MiniCPM (and Mage-VL) backend is unloaded from VRAM right then. One status STRING comes out so you can see what happened. That's the whole node - and it's exactly the kind of chore-node you're grateful for when it's there.

How it fits the bigger picture

This is the manual flip side of VidScribe MiniCPM's automatic behavior. The VLM backend (MiniCPM-V 4.5 int4, ~6-8GB VRAM) stays loaded between runs so the next caption doesn't re-load it - that's the point of keep_model_loaded-style caching. But a resident 6-8GB VLM sharing a card with a video diffusion model is a collision waiting to happen. Unload MiniCPM is the release valve: place it right before the heavy model loaders in your graph, and the VRAM is free before the diffusion model starts.

The pack takes the same pattern further with its "VRAM Gated" loaders - checkpoint/VAE/UNET/LoRA loaders that wait for a vram_cleared signal before loading. If you're using those, Unload MiniCPM is the other half of the handshake. If you're not, you can still just put this node on the wire before the sampler and get the same benefit with zero ceremony.

Using it

trigger is a wildcard * input, so you can connect any output - a string from a text encode, an image from a preview, a signal from anywhere upstream. When the node executes, it unloads. Wire it so it's guaranteed to run before the memory-hungry step, which in practice means placing it on a path that executes just before the model loader or sampler.

One output, status (STRING), which reports the unload result. Wire it to a display or log node if you want to confirm, or just leave it hanging - the node's job is the side effect.

Gotchas

  • It only unloads this pack's MiniCPM/Mage-VL backend. If you've got a different VLM (Ollama, a GGUF loader, a separate MiniCPM node from another pack) resident, this node can't see it - check which model is actually eating your VRAM before you blame the unload.
  • The 60-second auto-unload still applies as a backstop, so this node is for immediacy, not a replacement for the timeout.
  • Connect trigger to something that actually runs every queue. If it's on a dead branch, it won't fire - which is why the * wildcard and lazy placement matter.

Install

One of ~69 nodes in TrentNodes:

# ComfyUI Manager: search "Trent Nodes"

# or:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes && pip install -r requirements.txt

No extra dependencies beyond what VidScribe MiniCPM already needs (transformers + accelerate from the pack requirements). It's the kind of node that reads as pointless until your first OOM between a caption and a render, at which point it's the most valuable three nodes you've added all week.

CategoryTrent/VLM

Inputs (1)

NameTypeDefaultDescription
triggeropt*Connect any output to trigger unload

Outputs (1)

NameTypeDescription
statusSTRING