Most local AI apps run models in GGUF format, but a brand-new release, a fine-tune you made yourself, or a niche model may only exist as the original Hugging Face safetensors. The fix is to convert it yourself with llama.cpp: turn the Hugging Face folder into a 16-bit GGUF file, which you can then run with llama.cpp, Ollama, or LM Studio. This guide covers the conversion only — shrinking that 16-bit file to a smaller size is a separate step.
Set up llama.cpp
Clone the repository and install its Python requirements. A conversion guide that follows the official llama.cpp README gives these commands:
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
python3 -m pip install -r requirements.txt
You also need the model folder from Hugging Face, with its config.json, tokenizer files, and safetensors. The converter reads config.json to detect the architecture, and very new architectures need an up-to-date llama.cpp. Plan for roughly three times the original model’s size in disk space during the process: the original model, the 16-bit GGUF, and the quantized file you may make later.
Run the converter
Point the converter at the local model folder, name the output file, and pick the output type:
python convert_hf_to_gguf.py ./my-model --outfile my-model-bf16.gguf --outtype bf16
Or let it download straight from Hugging Face with --remote:
python convert_hf_to_gguf.py --outfile gemma-4-E2B-it-bf16.gguf --outtype bf16 --remote google/gemma-4-E2B-it
| –outtype | When to use it |
|---|---|
bf16 |
Most modern models, which are trained in bfloat16 |
f16 |
Older models released in float16 |
auto (or omit it) |
Also works well for 16-bit models |
f32 |
Rarely needed; very large files |
Vision models need one extra step: convert the projector separately with --mmproj, keeping it at bf16 or q8_0.
Check the GGUF file
When the command finishes, check that the output file exists and is a single GGUF file:
ls -lh my-model-bf16.gguf
| Check | What you should see | If you do not see it |
|---|---|---|
| Converted | my-model-bf16.gguf exists as one file |
The converter stopped early — read its error output |
| Architecture | No “architecture not supported” error | Update llama.cpp with git pull and retry |
| Tokenizer | No tokenizer error during the run | The download is incomplete — fetch the full repo, including tokenizer files |
Expected result. We checked a conversion guide that follows the official llama.cpp README for the clone, install, and convert commands. We did not run the converter.
Limits
Conversion runs on the CPU — no GPU is needed for it — but a large model still needs enough RAM and disk space, roughly three times the original size while you work. The my-model folder and the gemma-4-E2B-it example are the guide’s own; use your own model folder and name. The 16-bit GGUF is a full-precision file, so it is large: shrinking it with llama-quantize is a separate step, not covered here. We did not run the converter, so no file here is a recorded result.
