Nodes/Kinburg-Nodes/Safetensors -> GGUF (llama.cpp)
ComfyUI Node

Safetensors -> GGUF (llama.cpp)

Convert Your Own LLM to GGUF Without Leaving ComfyUI

By Kinburg·Created 3 months ago·Updated 6 days ago· 1
Safetensors -> GGUF (llama.cpp)
    • gguf_path
    • log
    • help
    source
    output_dir
    output_name
    outtypef16
    quantizenone
    quantize_binary
    quantize_binary_path
    llama_cpp_dir
    auto_clonetrue
    hf_token
    hf_download_dir
    keep_intermediatefalse
    forcefalse

    GGUF is how a chat LLM shares a consumer card with the diffusion model - quantized weights in one file, from Q8 down to Q4_K_M, the accepted compromise for a 12GB card. But not every model you want to run ships as GGUF; plenty of HuggingFace checkpoints come as .safetensors, and until now converting them meant a terminal session and a llama.cpp checkout. Safetensors → GGUF (llama.cpp) does the conversion from inside ComfyUI - and it's the pack's language-model converter, so it turns a Qwen or Llama HF model into a GGUF you can load straight into the pack's Local LLM (GGUF) nodes.

    What it takes

    • source - a HuggingFace repo id (Qwen/Qwen2.5-0.5B-Instruct), an https://huggingface.co/owner/name URL (downloaded for you), a local HF model folder (config.json + tokenizer + *.safetensors), or a single .safetensors file (its folder is used). Windows "Copy as path" quotes are stripped.
    • output_dir / output_name - where the .gguf goes and its base name. Blank output_dir defaults to ComfyUI/models/llm; blank name derives from the model. The precision/quant tag and .gguf are added automatically.
    • outtype - the precision written by convert_hf_to_gguf.py. f16 is the usual base. When you're quantizing, this is the intermediate step.
    • quantize - the optional second pass with llama-quantize (Q4_K_M, …). none keeps the outtype GGUF and needs no binary at all.
    • quantize_binary / quantize_binary_path - the compiled llama-quantize executable, auto-listed from ComfyUI/models/llm. Only used when quantize != none.

    Optional: llama_cpp_dir (a llama.cpp checkout holding the convert script), auto_clone (git-clone llama.cpp under ComfyUI/models/llm automatically - needs git on PATH; clones source only, no compiled binary), hf_token (for gated repos), hf_download_dir, keep_intermediate (keep the intermediate outtype GGUF when quantizing), and force (re-run even if the target exists - off returns the existing file, which is a nice idempotence touch).

    Outputs: gguf_path (the finished file, ready to wire into a loader), log (the conversion tail), and help.

    The honest caveats

    The dependencies are already in ComfyUI (huggingface_hub, gguf, torch, safetensors) and the scripts are fetched for you, so the friction is low - but the quantization pass needs an external llama-quantize binary you compile yourself. Leaving quantize = none needs nothing extra and is the easy first run. Also: this node is for language/multimodal LLMs only. It can't read diffusion weights - that's the pack's separate Diffusion Safetensors → GGUF (city96) node, which drives city96's ComfyUI-GGUF tooling (and its Q ladder is exactly the GGUF story: Q8 ≈ fp16 at half the size, Q5 the last stop before visible loss).

    Install

    Part of the Kinburg-Nodes pack - ComfyUI Manager (search "Kinburg-Nodes") or cd ComfyUI/custom_nodes && git clone https://github.com/Kinburg/Kinburg-Nodes, restart. No heavy dependencies beyond what ComfyUI ships. If you only ever run pre-quantized models, you don't need this node - but the moment a model you want only comes as safetensors, it beats fighting llama.cpp's scripts by hand.

    CategoryKinburg-Nodes/LLM/GGUF

    Inputs (13)

    NameTypeDefaultDescription
    sourceSTRINGHF repo id ('owner/name'), a https://huggingface.co/owner/name URL, a local HF model folder, or a single .safetensors file. Windows 'Copy as path' quotes are stripped.
    output_dirSTRINGFolder to write the .gguf into. Created if missing. Blank -> ComfyUI/models/llm.
    output_nameSTRINGBase filename without extension. Blank -> derived from the model name. The precision/quant tag and .gguf are added automatically.
    outtypeCOMBOf16Precision written by convert_hf_to_gguf.py. f16 is the usual base to quantize from. When quantize != none this is the intermediate.
    quantizeCOMBOnoneOptional 2nd pass with llama-quantize to shrink the model (e.g. Q4_K_M). none = keep the outtype gguf. Needs a compiled llama-quantize binary.
    quantize_binaryCOMBOllama-quantize executable (auto-listed from ComfyUI/models/llm). Choose the placeholder to type a path in quantize_binary_path. Only used when quantize != none.
    quantize_binary_pathSTRINGFull path to llama-quantize(.exe), used when the dropdown is the placeholder.
    llama_cpp_diroptSTRINGPath to a llama.cpp checkout (holds convert_hf_to_gguf.py). Blank -> use/auto-clone one under ComfyUI/models/llm/llama.cpp.
    auto_cloneoptBOOLEANtrueIf no llama.cpp is found, git clone it automatically. Needs git on PATH. Clones source only (no compiled llama-quantize).
    hf_tokenoptSTRINGHuggingFace token for gated/private repos. Leave blank for public models.
    hf_download_diroptSTRINGWhere to download HF repos. Blank -> the default HuggingFace cache. Ignored for local sources.
    keep_intermediateoptBOOLEANfalseWhen quantizing, keep the intermediate outtype gguf as well as the quantized one. Off -> delete it after quantizing.
    forceoptBOOLEANfalseRe-run even if the target .gguf already exists. Off -> return the existing file without redoing the work.

    Outputs (3)

    NameTypeDescription
    gguf_pathSTRING
    logSTRING
    helpSTRING