Safetensors -> GGUF (llama.cpp)
Convert Your Own LLM to GGUF Without Leaving ComfyUI
- gguf_path
- log
- help
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), anhttps://huggingface.co/owner/nameURL (downloaded for you), a local HF model folder (config.json+ tokenizer +*.safetensors), or a single.safetensorsfile (its folder is used). Windows "Copy as path" quotes are stripped.output_dir/output_name- where the.ggufgoes and its base name. Blank output_dir defaults toComfyUI/models/llm; blank name derives from the model. The precision/quant tag and.ggufare added automatically.outtype- the precision written byconvert_hf_to_gguf.py.f16is the usual base. When you're quantizing, this is the intermediate step.quantize- the optional second pass withllama-quantize(Q4_K_M, …).nonekeeps the outtype GGUF and needs no binary at all.quantize_binary/quantize_binary_path- the compiledllama-quantizeexecutable, auto-listed fromComfyUI/models/llm. Only used whenquantize != 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| source | STRING | HF 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_dir | STRING | Folder to write the .gguf into. Created if missing. Blank -> ComfyUI/models/llm. | |
| output_name | STRING | Base filename without extension. Blank -> derived from the model name. The precision/quant tag and .gguf are added automatically. | |
| outtype | COMBO | f16 | Precision written by convert_hf_to_gguf.py. f16 is the usual base to quantize from. When quantize != none this is the intermediate. |
| quantize | COMBO | none | Optional 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_binary | COMBO | llama-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_path | STRING | Full path to llama-quantize(.exe), used when the dropdown is the placeholder. | |
| llama_cpp_diropt | STRING | Path to a llama.cpp checkout (holds convert_hf_to_gguf.py). Blank -> use/auto-clone one under ComfyUI/models/llm/llama.cpp. | |
| auto_cloneopt | BOOLEAN | true | If no llama.cpp is found, git clone it automatically. Needs git on PATH. Clones source only (no compiled llama-quantize). |
| hf_tokenopt | STRING | HuggingFace token for gated/private repos. Leave blank for public models. | |
| hf_download_diropt | STRING | Where to download HF repos. Blank -> the default HuggingFace cache. Ignored for local sources. | |
| keep_intermediateopt | BOOLEAN | false | When quantizing, keep the intermediate outtype gguf as well as the quantized one. Off -> delete it after quantizing. |
| forceopt | BOOLEAN | false | Re-run even if the target .gguf already exists. Off -> return the existing file without redoing the work. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| gguf_path | STRING | — |
| log | STRING | — |
| help | STRING | — |