Export fine-tuned models to GGUF and deploy on Ollama

After training with Soup CLI, export your model to GGUF format and serve it locally with Ollama in three commands.

0. Build llama.cpp first, if you want a quantized GGUF

Soup auto-clones llama.cpp (pinned at tag b5270) into ~/.soup/llama.cpp on first use, but it does not build it. Converting to f16 or f32 works from the Python script alone. Every quantized type additionally needs the llama-quantize binary, so build it once:

bash
cd ~/.soup/llama.cpp
cmake -B build -DGGML_NATIVE=OFF -DLLAMA_CURL=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --target llama-quantize -j 4

Soup finds the binary in both the single-config layout (build/bin/llama-quantize, from Make or Ninja) and the multi-config one (build/bin/Release/llama-quantize.exe, from MSVC or Xcode), or on your PATH. To use a checkout you already have, pass --llama-cpp /path/to/llama.cpp or set LLAMA_CPP_PATH.

On Windows the validated toolchain is Visual Studio 2022 Build Tools with the "Desktop development with C++" workload plus CMake 3.14 or newer, CPU-only. Linux and macOS need only a C++ toolchain and CMake. CUDA builds of llama.cpp are untested.

Do not run pip install -r ~/.soup/llama.cpp/requirements.txt. It pins torch~=2.2.1 against the CPU wheel index, so it will downgrade a CUDA PyTorch and break training. Soup deliberately installs only the convert script's own extras (gguf, sentencepiece, protobuf), unpinned.

1. Export to GGUF

bash
soup export --model ./runs/my-model/latest \
            --format gguf \
            --quant q4_k_m \
            --output ./my-model.gguf

Quantization levels:

QuantSize (7B)QualityUse case
q4_k_m~4.1 GBGoodDefault — best size/quality balance
q5_k_m~4.8 GBBetterWhen you need higher accuracy
q8_0~7.5 GBNear-losslessBenchmarks, eval
q2_k~2.6 GBLowerTiny devices, RPi

2. Deploy to Ollama

Soup CLI ships with Ollama integration (v0.18.0+):

bash
soup deploy ollama \
    --model ./my-model.gguf \
    --name my-model \
    --template chat

This creates an Ollama Modelfile, imports the GGUF, and registers your model.

3. Chat

bash
ollama run my-model

Or via the API:

bash
curl http://localhost:11434/api/generate -d '{
  "model": "my-model",
  "prompt": "Hello!"
}'

One-liner: train → export → deploy

bash
soup train --config soup.yaml && \
soup export --model ./runs/latest --format gguf --quant q4_k_m && \
soup deploy ollama --model ./runs/latest/model.gguf --name my-model

Other export formats

Soup CLI also supports:

  • ONNX--format onnx for cross-platform inference
  • TensorRT-LLM--format tensorrt for NVIDIA optimized serving
  • AWQ / GPTQ--format awq or --format gptq for quantized GPU inference
  • Hugging Face — not an export format. A merged checkpoint comes from soup merge --adapter <path> --output <dir>. The formats soup export accepts are gguf, gguf-ud, onnx, tensorrt, awq, gptq, bitnet, tq1_0 and torchao.

Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.