Two training flows:
llm fine-tunes a base model on your dataset (needs the heavy ML stack), and agents improves an agent through iterative feedback loops (lightweight, no CUDA/Unsloth).Standalone Install
Training now ships as its own package (praisonai-train, import praisonai_train). Install just what you need:
The wrapper CLI
praisonai train ... still works — it now bridges into praisonai-train when the standalone package is installed (and is hidden on code-only installs). pip install "praisonai[train]" (previously an empty extra) now pulls praisonai-train[llm].Quick Start
1
LLM Fine-tuning
Fine-tune a base model on your dataset with Unsloth.
2
Agent Training
Improve an agent iteratively with LLM-as-Judge or human feedback.One
pip install praisonai-train gives you the agent, the trainer, and the grader — litellm ships as a core dependency, so live LLM-as-Judge grading works with no extra install.Runs cleanly on Windows and other non-UTF-8 consoles — the summary automatically falls back to ASCII (PASSED / NEEDS WORK) with no configuration needed. Exit codes: 0 = training persisted, 1 = training failed, 130 = interrupted. See Train CLI → Exit Codes.--iterations sets the maximum number of training loops. In LLM-as-Judge mode, training stops early when any iteration scores ≥ 9.5 (excellent), so easy prompts may finish in a single iteration. Pass --no-early-stop to force all iterations, or --verbose to see when it stops. See Train CLI → Early Stop for the full flow.How It Works
Point the trainer at a base model and dataset to fine-tune, or at a scenario to iteratively improve an agent. Real interaction — agent-training path: an agent gives so-so answers → runpraisonai-train agents --input "Explain AI" --human → review N iterations → praisonai-train apply <session_id> --run "Explain AI" bakes the improvements into the agent via hooks → the same agent answers better.
CLI Reference
Five subcommands cover both fine-tuning and agent training.
See Train CLI for full flags.
Fine-tuning Setup
Push a fine-tuned model to Hugging Face and Ollama.Hugging Face token
Initilise praisonai train
Requirements
Training dependencies are checked at startup via
unsloth package availability but only fully loaded when training commands run.praisonai-train) needs no CUDA/Unsloth — its base install already pulls litellm for live LLM-as-Judge grading — while LLM fine-tuning (praisonai-train[llm]) pulls the full torch/Unsloth stack.
Required for training:
- Huggingface token
- Base model to train on (e.g. unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit)
- Dataset to train on (e.g. yahma/alpaca-cleaned)
- Huggingface model name to upload to (e.g. mervinpraison/llama3.1-instruct) (Optional)
- Ollama model name to upload to (e.g. mervinpraison/llama3.1-instruct) (Optional)
praisonai-train llm, you’ll see one of two messages depending on what’s installed.
When praisonai-code is not installed (bare pip install praisonai-train):
praisonai-code is installed but a downstream import failed (e.g. torch/unsloth missing):
pip install "praisonai[train]" hint is no longer printed from the praisonai-train llm entrypoint (PraisonAI PR #3053).
To upload to ollama.com (Linux)
You no longer need to run
ollama serve manually. The trainer starts the Ollama daemon automatically if it isn’t already running, then creates and pushes the model. Requires the ollama CLI on PATH — install from ollama.com.PraisonAI Train is currently tested on Linux with 1 GPU and pytorch-cuda=12.1.
Config.yaml example
Drive an LLM fine-tuning run from a config file instead of flags.Weights & Biases
Track loss curves and checkpoints for each run.Get the key from here
Best Practices
Start with praisonai-train alone if you only want agent training
Start with praisonai-train alone if you only want agent training
pip install praisonai-train pulls praisonaiagents plus litellm (for LLM-as-Judge grading) — enough for agents, list, show, and apply. Add [llm] only when you need Unsloth fine-tuning.Set HF_TOKEN in the environment
Set HF_TOKEN in the environment
Export
HF_TOKEN in your shell before fine-tuning so the trainer can push to Hugging Face. Never commit the raw token.Start small, then scale
Start small, then scale
Use a low
max_steps and a small num_samples for a first run to confirm the pipeline before a full training job.Track runs with Weights & Biases
Track runs with Weights & Biases
Set
PRAISON_WANDB=True and the WANDB_* variables to log loss curves and checkpoints for each run.Related
Train CLI
Full flag reference for the five subcommands.
praisonai-train Package
Install and use training without the full wrapper.
Installation Extras
Optional dependency groups and the train install matrix.
Models
Use your fine-tuned model with an Agent.

