Nodes/VLM_nodes/LLaVA (Managed Cache)
ComfyUI Node Runs on cloud

LLaVA (Managed Cache)

One node, both LLaVA files, self-cleaning

By gokayfem·Created 3 years ago·Updated 18 days ago· 587
LLaVA (Managed Cache)
  • image
  • STRING
ckpt_name
clip_name
max_ctx4096
gpu_layers-1
n_threads12
prompt
temperature0.10
unloadfalse
handlerAuto (GGUF chat template)
n_batch512
n_ubatch512
flash_attentionAuto
use_mmaptrue
split_modeLayer
main_gpu0
tensor_split

The classic LLaVA flow in this pack is a three-node dance: load the projector, load the GGUF, run the sampler. LLavaOptionalMemoryFreeSimple collapses that into a single node that loads both files itself, caches the model, and can free it the moment the run finishes. The "Optional Memory Free" in the name isn't marketing - it's the feature: turn on unload and the node hands the VRAM back after each queue instead of letting the model squat in memory.

What it's for

When you want LLaVA captioning in a graph without the loader boilerplate, or you're running a LLaVA node next to a big diffusion model and you need the VRAM back between runs. It's the same engine as the split loader path - GGUF + mmproj through llama.cpp - just self-contained.

How it works

It takes a ckpt_name (the GGUF) and a clip_name (the matching mmproj), both picked from your models/LLavacheckpoints folder, and builds a llama.cpp model handle internally. It keeps that handle cached per node instance so repeated queues are fast, and it keys the cache on every relevant setting - change any input and it rebuilds. The unload boolean is the memory-free switch: false keeps the model resident (fast repeats), true tears it down after each execution and requests a ComfyUI cache cleanup.

The inputs that matter

  • ckpt_name / clip_name - the two files. The recurring warning applies: the projector must match the GGUF's model family, or you'll get noise.
  • gpu_layers - how many layers to offload to the GPU. 27 is the default and works for 7B-class models; if it crashes or crawls, raise it (it defaults differently per build - -1 means "all" in the loader nodes).
  • max_ctx - context window; 4096 default is plenty for single-shot captioning.
  • image / prompt - the actual ask.
  • temperature - 0.1 default; low is right for description work.
  • unload - the namesake switch, explained above.

Output: a single STRING description.

Install

Standard for the pack - and remember this rides llama.cpp:

cd ComfyUI/custom_nodes
git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
python -m pip install -r ComfyUI/custom_nodes/ComfyUI_VLM_nodes/requirements.txt

If you're hitting llama-cpp-python install or GPU-offload problems, that's the pack's #1 support issue: install a wheel built for your backend (CUDA/Metal/ROCm) instead of the default CPU build.

Where it sits

Compared to the split-loading LLava Loader + Llava Clip Loader path, this is the "I just want a caption" option - fewer nodes, less graph ceremony, same output. The tradeoff is flexibility: it doesn't hand you a reusable model handle for other samplers, and the newer Advanced variant in the pack adds the full sampling controls if you outgrow this one. For a beginner who just wants a LLaVA caption node that doesn't hog memory, this is the one.

CategoryVLM Nodes/LLava

Inputs (17)

NameTypeDefaultDescription
ckpt_nameCOMBO0 options:
clip_nameCOMBO0 options:
max_ctxINT4096128–131072
gpu_layersINT-1-1–1000
n_threadsINT121–256
imageIMAGE
promptSTRING
temperatureFLOAT0.100–2
unloadBOOLEANfalse
handleroptCOMBOAuto (GGUF chat template)10 options: Auto (GGUF chat template), LLaVA 1.5, LLaVA 1.6, MiniCPM-V 2.6, Moondream2, NanoLLaVA, +4
n_batchoptINT5121–8192Logical prompt batch. Lower this if context loading runs out of memory.
n_ubatchoptINT5121–8192Physical prompt micro-batch. Never exceeds n_batch.
flash_attentionoptCOMBOAutoAuto enables llama.cpp flash attention only with accelerator offload and safely retries without it when unsupported.
use_mmapoptBOOLEANtrueMemory-map GGUF weights when the installed backend supports it.
split_modeoptCOMBOLayerHow llama.cpp distributes tensors across multiple accelerators.
main_gpuoptINT00–31
tensor_splitoptSTRINGOptional comma-separated accelerator proportions, for example 0.6,0.4.

Outputs (1)

NameTypeDescription
STRINGSTRING