Nodes/ComfyUI-llamacpp-helper/Load llama.cpp Model
ComfyUI Node

Load llama.cpp Model

The llama.cpp loader that actually starts the server — point it at a GGUF and walk away

By bbaudio-2025·Created 2 months ago·Updated 11 days ago· 1
Load llama.cpp Model
    • model
    ◄server_exeC:\Users\bbaudio\MyApps\AItemp\llama-bin-win-cuda-13.3-x64\llama-server.exe►
    ◄model_path►
    ◄model_path_override►
    ◄mmproj_pathnone►
    ◄mmproj_path_override►
    ◄lora_pathnone►
    ◄lora_path_override►
    ◄lora_scale1.00►
    ◄host127.0.0.1►
    ◄port8080►
    ◄n_gpu_layers-1►
    ◄context_size4096►
    ◄auto_starttrue►
    ◄mmproj_gpu_offloadtrue►
    ◄advanced_launch_args►
    ◄model_namellamacpp-helper►

    Every other node in this pack exists because of this one. "Load llama.cpp Model" doesn't load a model into ComfyUI at all - it configures and launches the external llama-server process the whole pack is built around, then hands you a handle to feed into the "LLM (llama.cpp server)" node. Get this node right and the rest is easy; get it wrong and you'll stare at a FileNotFoundError for a while.

    How it works. Behind the scenes it assembles a llama-server command line - -m <model> --host <host> --port <port> -ngl <layers> -c <context> --alias <name>, plus --mmproj if you gave a multimodal projector - spawns it as a separate process, and polls the /health endpoint for up to 180 seconds until the server reports ready. ComfyUI never touches the model weights; the server owns them. That's also why the pack needs zero Python dependencies - just the standard library and urllib.

    The inputs that actually matter. Only a few of these are things you'll touch:

    • server_exe - the full path to your llama-server binary. This is the trap. The default is the author's own Windows path (C:\Users\bbaudio\...\llama-server.exe), which doesn't exist on your machine. You will change this, and on Linux or macOS you'll be pasting a path like /home/you/llama.cpp/build/bin/llama-server.
    • model_path - a dropdown of every .gguf it finds under the folders in config.json's model_roots. If the dropdown is empty, that config is wrong (more below). You can also paste a full path manually.
    • mmproj_path - only for multimodal models. The dropdown only lists .gguf files with "mmproj" in the filename, so name your projector file sensibly.
    • n_gpu_layers - 99 (the default) means "offload every layer to GPU"; 0 is pure CPU. For a big model on a small card, dropping this is how you stay in VRAM instead of crashing.
    • context_size - 4096 default; raise it if the model's context is bigger and you're doing long prompts or history. Each token of context costs memory, so don't just max it out.
    • host / port - 127.0.0.1:8080 by default. Change the port if something else squats on 8080; the LLM node must use the same one.
    • auto_start (default on) launches the server on load. advanced_launch_args lets you bolt on extra llama-server flags, one per line - e.g. --no-mmap or a grammar file.
    • model_name is cosmetic-ish: it's passed as --alias and shows up as the model name in server responses.

    Output: one model output of the custom LLAMACPP_MODEL type. It carries the whole launch config through, so the LLM node can restart or stop the server later.

    Install, the real way. Two downloads, one edit:

    1. Get the model loader itself: ComfyUI Manager → search "ComfyUI-llamacpp-helper", or cd ComfyUI/custom_nodes && git clone https://github.com/bbaudio-2025/ComfyUI-llamacpp-helper, then restart ComfyUI.
    2. Download llama-server from the llama.cpp releases - pick the CUDA build if you're on an NVIDIA card, the CPU build if not. It's a standalone binary; unzip it anywhere.
    3. Open config.json in the pack folder and set model_roots (and mmproj_roots) to real directories holding your .gguf files. The shipped defaults are paths from the author's machine, so treat them as examples.

    Troubleshooting. llama-server executable not found - check server_exe, and note the shipped default is a Windows path. "Did not become healthy within 180s" means the server crashed on startup; read llama_server.log in the pack folder for the real reason (usually a wrong model path, an out-of-memory context size, or a CPU build choking on -ngl). Models must be GGUF - llama-server cannot load safetensors, full stop. And the quantization matters: Q8 is basically fp16 at half the size, Q4_K_M is the accepted compromise for a 12GB card. If your card can take Q8 without swapping, just use it.

    CategoryLLM/llama.cpp

    Inputs (16)

    NameTypeDefaultDescription
    server_exeSTRINGC:\Users\bbaudio\MyApps\AItemp\llama-bin-win-cuda-13.3-x64\llama-server.exe—
    model_pathCOMBO1 options:
    model_path_overrideSTRING手动指定扫描目录之外的 .gguf 模型路径(填了优先于下拉框)。填 'none' 可不加载模型。
    mmproj_pathCOMBOnone1 options: none
    mmproj_path_overrideSTRING手动指定扫描目录之外的 mmproj 路径(填了优先于下拉框);填 'none' 可关闭 mmproj,即使上面选中了也无效。
    lora_pathCOMBOnone可选的 LoRA 适配器(必须是 .gguf,llama.cpp 只读 GGUF 格式的 adapter)。'none' = 不加载;选中后随服务器启动通过 --lora 生效。
    lora_path_overrideSTRING手动指定扫描目录之外的 adapter .gguf 路径(填了优先于下拉框);填 'none' 可关闭。
    lora_scaleFLOAT1.00-4–4adapter 的作用强度(--lora-scaled)。1.0(默认)等价于 --lora;0.0 = 加载但不应用;大于 1 放大,负值反向推离 adapter 学到的方向。修改会触发服务器重启。
    hostSTRING127.0.0.1—
    portINT80801–65535—
    n_gpu_layersINT-1-1–9999放到 GPU 上的层数(-ngl)。-1(默认)= 全部层在 GPU 上,llama.cpp 把 -1、99、999 都当同一回事;0 = 纯 CPU,慢 10-40 倍;中间值是混合模式,只要有一层在 CPU 每个 token 都要传输一次,建议要么全上要么全不上。
    context_sizeINT4096256–131072—
    auto_startoptBOOLEANtrue—
    mmproj_gpu_offloadoptBOOLEANtrue—
    advanced_launch_argsoptSTRING—
    model_nameoptSTRINGllamacpp-helper—

    Outputs (1)

    NameTypeDescription
    modelLLAMACPP_MODEL—