Thanks to visit codestin.com
Credit goes to trysoup.dev

Model Export

Export fine-tuned models to various formats for deployment.

Merge LoRA Adapter

Merge a LoRA adapter with its base model into a standalone model:

bash
# Auto-detect base model from adapter_config.json
soup merge --adapter ./output --output ./merged

# Specify base model and dtype
soup merge --adapter ./output --base meta-llama/Llama-3.1-8B --dtype bfloat16

GGUF (llama.cpp / Ollama)

bash
# Export LoRA adapter (auto-merges with base, then converts)
soup export --model ./output --format gguf --quant q4_k_m

# Different quantizations
soup export --model ./output --format gguf --quant q8_0
soup export --model ./output --format gguf --quant f16

# Export a full (already merged) model
soup export --model ./merged --format gguf

Supported quantizations: q4_0, q4_k_m, q5_k_m, q8_0, f16, f32

Use with Ollama:

bash
echo 'FROM ./my-model.q4_k_m.gguf' > Modelfile
ollama create my-model -f Modelfile
ollama run my-model

ONNX

bash
pip install "soup-cli[onnx]"
soup export --model ./output --format onnx
soup export --model ./output --format onnx --output ./model_onnx

TensorRT-LLM

bash
pip install "soup-cli[tensorrt]"
soup export --model ./output --format tensorrt
soup export --model ./output --format tensorrt --output ./model_trt

This path now checks itself before it does any work, and on a current TensorRT-LLM it stops there (v0.74.0). Soup shelled out to python -m tensorrt_llm.commands.convert_checkpoint, a module absent from every current TensorRT-LLM release: that package ships only bench, build, eval, prune, refit and serve, and checkpoint conversion now lives as a per-architecture examples/<arch>/convert_checkpoint.py script in NVIDIA's source tree instead. Before v0.74.0 the export silently produced zero artifact bytes; it now fails immediately with a message naming the missing entry point, before the LoRA merge and the output directory are touched. If you exported to TensorRT on an earlier release, check the directory actually holds an engine. Installing tensorrt_llm can also downgrade a training environment's torch, transformers, numpy and datasets pins, so keep it out of the environment you train in.

AWQ Quantization (v0.23.0+)

bash
pip install "soup-cli[awq]"
soup export --model ./output --format awq --calibration-data calib.jsonl
soup export --model ./output --format awq --calibration-data calib.jsonl --output ./model_awq

GPTQ Quantization (v0.23.0+)

bash
pip install "soup-cli[gptq]"
soup export --model ./output --format gptq --calibration-data calib.jsonl
soup export --model ./output --format gptq --calibration-data calib.jsonl --output ./model_gptq

--bits (4 or 8, default 4) and --group-size (default 128) set the AWQ and GPTQ quantization width, and they are what the output shard name records.

--calibration-data is required for BOTH formats, and it arrived as a breaking change in each. GPTQ first, in v0.74.0: the flagless form used to be accepted and then died inside auto-gptq with object is not iterable, because quantize() wants tokenized examples and was handed a bare tokenizer. AWQ followed in v0.75.0, for the opposite reason: AWQ *did* have a fallback, and that was the problem. A flagless AWQ export silently downloaded AutoAWQ's large default calibration dataset, so the calibration inputs behind a shipped artifact were whatever that download happened to contain. Both formats now refuse a missing or unusable JSONL before the quantizer is imported and before the model is loaded, so the refusal costs nothing. A file with zero usable samples is refused up front too, and --calibration-samples caps how many rows are read (default 128).

The same release repaired the exported directory. save_quantized writes its own gptq_model-<bits>bit-<group>g.safetensors shard, which AutoModelForCausalLM.from_pretrained does not look for, so a GPTQ export written before v0.74.0 does not reload by the standard path. The directory now also carries a standard model.safetensors.

Deploy to Ollama (v0.18.0+)

Deploy a GGUF model directly to your local Ollama instance:

bash
# Deploy a GGUF model
soup deploy ollama --model ./output/model.q4_k_m.gguf --name soup-my-model

# Deploy with system prompt and parameters
soup deploy ollama --model ./model.gguf --name soup-chat \
  --system "You are a helpful assistant." \
  --template chatml \
  --parameter temperature=0.7 \
  --parameter top_p=0.9

# Export + deploy in one command
soup export --model ./output --format gguf --deploy ollama

# List Soup-deployed models
soup deploy ollama --list

# Remove a model
soup deploy ollama --remove soup-my-model

Auto-detected chat templates: chatml, llama, mistral, vicuna, zephyr (or auto to infer from soup.yaml).

Push to HuggingFace Hub

bash
soup push --model ./output --repo your-username/my-model
soup push --model ./output --repo your-username/my-model --private

Auto-generates a model card with training details.

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.