Nodes/ComfyUI-Prompt-MZ/MinusZone - LLamaCPPOptions
ComfyUI Node

MinusZone - LLamaCPPOptions

The sampler kitchen-sink for every local-LLM node in this pack

By MinusZoneAI·Created 2 years ago·Updated about a year ago· 137
MinusZone - LLamaCPPOptions
    • llama_cpp_options
    ◄n_ctx2048►
    ◄n_batch2048►
    ◄n_threads0►
    ◄n_threads_batch0►
    ◄split_modeLLAMA_SPLIT_MODE_NONE►
    ◄main_gpu0►
    ◄n_gpu_layers-1►
    ◄max_tokens4096►
    ◄temperature1.60►
    ◄top_p0.95►
    ◄min_p0.05►
    ◄typical_p1.00►
    ◄stop►
    ◄frequency_penalty0.00►
    ◄presence_penalty0.00►
    ◄repeat_penalty1.10►
    ◄top_k50►
    ◄tfs_z1.00►
    ◄mirostat_modenone►
    ◄mirostat_tau5.00►
    ◄mirostat_eta0.10►

    LLamaCPPOptions is a pass-through config node: every field it exposes is an argument handed straight to llama.cpp when the pack's prompt nodes run the local model. It's not a node that does anything on its own - it's a bag of settings you plug into the llama_cpp_options input on CLIPTextEncode(LLamaCPP Universal), the image interrogators, or the deprecated v1 text-encode nodes. Think of it as the sampler settings panel for your LLM, except the defaults are already tuned for prompt generation, so you can ignore it entirely and still get good results.

    The inputs that actually matter

    There are twenty of them and you will touch maybe five:

    • n_gpu_layers - default -1 (offload everything to GPU). Drop it to 0 for pure CPU, or to a number of layers to fit VRAM. This is the single most useful knob in the whole node when the LLM is competing with your diffusion model for memory.
    • temperature - default 1.6, which is hot for a reason: you want the LLM to get creative with your prompt, not play it safe. Lower it toward 0.7 if outputs feel rambling; raise it if every prompt comes back the same.
    • max_tokens - default 4096, the ceiling on how long the beautified prompt can get. Drop it to 1024 if you're on CPU and waiting forever.
    • top_p / min_p - defaults 0.95 / 0.05. Standard nucleus/min-p sampling; you can leave them alone.
    • split_mode - LLAMA_SPLIT_MODE_NONE, LAYER, or ROW for multi-GPU setups. On a single card leave it at NONE.

    The rest - n_ctx (2048), n_batch (2048), n_threads (0 = auto), top_k (50), repeat_penalty (1.1), tfs_z, the two mirostat modes, and the frequency/presence penalties - are straight llama.cpp sampler parameters. If you've ever tuned a local LLM in llama.cpp, nothing here is new. If you haven't, don't go poking; the defaults are sane for this use case.

    One output, many destinations

    It returns a single llama_cpp_options object. That's the whole node. Wire it into any MZ node that accepts llama_cpp_options, and it applies to every LLM call that node makes. Leave it disconnected and the nodes run with the same default values internally - so this is purely for when you need control.

    Installing and gotchas

    No separate install: it ships with ComfyUI-Prompt-MZ, which you get from ComfyUI Manager (search "MinusZone") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MinusZoneAI/ComfyUI-Prompt-MZ
    

    The pack needs llama-cpp-python and diskcache from its requirements.txt. And this node is where the single most-reported pack error lives: if you see module 'llama_cpp' has no attribute 'LLAMA_SPLIT_MODE_LAYER', your llama-cpp-python is too old to expose the split_mode enum that this node's dropdown feeds in. The fix is in the pack's own FAQ: upgrade llama-cpp-python to the latest release from the abetlen/llama-cpp-python releases page. A related Windows trap is LLama.dll failing to load, which the author pins on CUDA version - switch your ComfyUI PyTorch build to CUDA 12.1 (in the "秋叶" launcher: Advanced settings → environment maintenance → install PyTorch → pick CUDA 12.1).

    One fair warning: because every option has an extreme min/max range exposed in the UI, it's easy to set something like a 100k n_ctx and wonder why the LLM node suddenly takes a minute to start. Context size costs real memory. If the pack's nodes get slow, check here before blaming the model.

    CategoryMinusZone - Prompt/others

    Inputs (21)

    NameTypeDefaultDescription
    n_ctxINT2048-18446744073709550000–18446744073709550000—
    n_batchINT2048-18446744073709550000–18446744073709550000—
    n_threadsINT0-18446744073709550000–18446744073709550000—
    n_threads_batchINT0-18446744073709550000–18446744073709550000—
    split_modeCOMBOLLAMA_SPLIT_MODE_NONE3 options: LLAMA_SPLIT_MODE_NONE, LLAMA_SPLIT_MODE_LAYER, LLAMA_SPLIT_MODE_ROW
    main_gpuINT0-18446744073709550000–18446744073709550000—
    n_gpu_layersINT-1-18446744073709550000–18446744073709550000—
    max_tokensINT4096-18446744073709550000–18446744073709550000—
    temperatureFLOAT1.60-18446744073709550000–18446744073709550000—
    top_pFLOAT0.95-18446744073709550000–18446744073709550000—
    min_pFLOAT0.05-18446744073709550000–18446744073709550000—
    typical_pFLOAT1.00-18446744073709550000–18446744073709550000—
    stopSTRING—
    frequency_penaltyFLOAT0.00-18446744073709550000–18446744073709550000—
    presence_penaltyFLOAT0.00-18446744073709550000–18446744073709550000—
    repeat_penaltyFLOAT1.10-18446744073709550000–18446744073709550000—
    top_kINT50-18446744073709550000–18446744073709550000—
    tfs_zFLOAT1.00-18446744073709550000–18446744073709550000—
    mirostat_modeCOMBOnone3 options: none, mirostat, mirostat_v2
    mirostat_tauFLOAT5.00-18446744073709550000–18446744073709550000—
    mirostat_etaFLOAT0.10-18446744073709550000–18446744073709550000—

    Outputs (1)

    NameTypeDescription
    llama_cpp_optionsLLamaCPPOptions—