Skip to main content
Publish a model you already trained to Hugging Face, GGUF, or Ollama — no re-training, one command.
Discover the model-dir first. List the checkpoints a run saved, pick a step, then point --model-dir at it — no ls needed.
See List Checkpoints.

Quick Start

You already have a trained model in lora_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:
  1. --base-model if passed.
  2. else model_name in --config.
  3. else _name_or_path from <model-dir>/config.json.
  4. else the model-dir name itself.

Prerequisites

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.
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 from unsloth/<base>-GGUF when none is supplied.
A typo like q4km fails fast with the full list of valid choices — no long run wasted.
See Unsloth Surface for the “which quant should I pick” decision guide.

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 the TrainModel.for_export() classmethod — it builds an export-only trainer (no dataset required) and validates the quantization up front.

Hub push options

These keys flow through config.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.
Every push is now private by default. Add hf_private: false to publish publicly — see Hub Privacy & Upload Options.

Best Practices

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.
Pass --quant q4_k_m so the model is packed small. Ollama exports run ollama create --quantize, avoiding a huge FP16 intermediate.
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.

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.