Quick Start
You already have a trained model inlora_model/. Pick a target and publish.
1
Publish to Hugging Face
Merge and push FP16 weights to a Hub repo.
2
Publish a GGUF build
Write a local
.gguf — add --hf to also push it to the Hub.3
Publish to Ollama
Create and push a quantized model to
ollama.com.Ollama export ≤ PR #4239 shipped an indented
TEMPLATE. The Modelfile embedded four leading spaces on every continuation line, so the served prompt format tokenised differently from training and degraded fine-tune quality. Re-export any Ollama model built before this fix — the export itself takes seconds and does not re-train. Fixed in PraisonAI PR #4239.When to use this
You already trained a model (e.g.lora_model/ exists) and don’t want to spend an hour re-running training just to publish it to a different target, fix a chat_template, or try a different quantization. export loads the trained weights once and publishes them.
How It Works
Export skips the training-only preflight, so it runs on CPU — there’s nothing to fine-tune. The base model name drives chat-template selection so the exported model isn’t garbled.CLI flags
gguf always writes a local .gguf (so you can serve it). Add --hf me/my-model to additionally push it to the Hub. Without --hf, the GGUF is written under <model-dir>/gguf.How the base model is inferred
The base model name selects the chat template, so the exported model formats prompts correctly. Resolution order:--base-modelif passed.- else
model_namein--config. - else
_name_or_pathfrom<model-dir>/config.json. - else the model-dir name itself.
Prerequisites
Hugging Face export
Hugging Face export
HF_TOKEN env var or a cached huggingface-cli login. The token must have write scope and the repo must be under your own username.Ollama export
Ollama export
ollamaCLI installed (from https://ollama.com).- Your signing key registered at https://ollama.com/settings/keys — public key lives at
~/.ollama/id_ed25519.pub. - Enough free space on
$OLLAMA_MODELS(defaults to~/.ollama/models).
No GPU needed
No GPU needed
CUDA is not required for export-only. CPU is fine because there is nothing to fine-tune.
Valid --quant values
Any of these 35 quantization methods (from VALID_QUANTIZATION_METHODS — 24 standard plus 11 imatrix).
Standard (24)
IMatrix — large-model / laptop-fit (11)
Importance-matrix quants let a 30B model fit on a laptop. Unsloth resolves the matrix itself, downloading it fromunsloth/<base>-GGUF when none is supplied.
Failure modes → clean errors
Every known failure prints a single actionable message instead of a raw traceback.The readiness probe honours
OLLAMA_HOST and confirms GET /api/version — a healthy remote or non-default daemon is used instead of being ignored.401 / 403 translation now covers every push path. As of PraisonAI PR #4357, the same actionable 401/403 messages are raised by the LLM path, vision training, and
praisonai-train upload-vision — previously only the LLM path translated them and the vision paths surfaced a raw HfHubHTTPError traceback. See Hub Privacy & Upload Options.Plain vision runs no longer publish (PraisonAI #4879). A local vision fine-tune that omits
huggingface_save used to push to the Hub — the flag defaulted to the string "true" — or crash with KeyError: 'hf_model_name' after training completed. From #4879 the vision path skips every export stage unless the flag and its target (hf_model_name / ollama_model) are both set, matching the LLM trainer. See Vision Fine-Tuning.Python API
Script exports with theTrainModel.for_export() classmethod — it builds an export-only trainer (no dataset required) and validates the quantization up front.
Hub push options
These keys flow throughconfig.yaml (not CLI flags today) into every push_to_hub_merged / push_to_hub_gguf call. Pass them in the --config file or the for_export({...}) dict.
Best Practices
Namespace repos to your own username
Namespace repos to your own username
Set
--hf me/my-model (not a bare name). A namespaced repo id is treated as a Hub target, never a local directory to delete.Quantize at export time
Quantize at export time
Pass
--quant q4_k_m so the model is packed small. Ollama exports run ollama create --quantize, avoiding a huge FP16 intermediate.Set the base model when in doubt
Set the base model when in doubt
If the exported model’s output looks garbled, pass
--base-model explicitly (e.g. unsloth/gemma-2-2b-it-bnb-4bit) so the right chat template is used.Related
Checkpoints CLI
List what a run saved, then export the step you pick.
Infer CLI
Prompt a model you just trained and watch it stream.
Train
Full fine-tuning flow and config.yaml reference.
Train CLI
Every
praisonai train subcommand, including export.praisonai-train Package
Install matrix for the standalone trainer.
Multi-GPU Training
Fine-tune across every GPU with torchrun.
Hub Privacy & Upload Options
Private-by-default pushes, save method, commit message, and tags.
Unsloth Surface
Model access, PEFT selectors, offline merge, and the full 35-quant list.

