posttrain
v0.1.11
Published
PostTrain: run and track post-training (data, RL environments, SFT, preference tuning, RL, evals, deploy) from the terminal or the browser.
Maintainers
Readme
posttrain
Run and track post-training from the terminal or the browser: datasets and RL environments with checks before you train, SFT, preference tuning (DPO) and RL (GRPO), evals with standard errors, and promoting the checkpoint you keep, on your laptop, a Slurm cluster, Prime Intellect, Hugging Face Jobs, Fireworks or Baseten.
- Guide: https://app.posttrain.com/docs
- Console with example projects (read-only): https://app.posttrain.com
Install
npm install -g posttrain
posttrain --versionOr run it without installing: npx posttrain --help.
PostTrain needs Python 3.9 or later on your PATH. It runs with POSTTRAIN_PYTHON when you set it, else with the newest of python3.13, python3.12, python3.11, python3.10 and python3.9 on your PATH, then python3 or python: so a Homebrew python3.13 is picked over an Anaconda python3 that is 3.12. The CLI itself uses only Python's standard library. The first command that needs more (the console needs FastAPI and uvicorn; Hugging Face Jobs targets need huggingface_hub) sets up a private virtual environment in ~/.posttrain/npm/venv, once per user; commands that need only the standard library (status, runs ls, whoami, …) never set it up, and use it once it exists. Nothing is installed into your own Python. The first training run on this machine installs what the TRL recipes need (PyTorch, Transformers, TRL, Datasets, Accelerate, PEFT) into that environment by itself: 1 to 3 GB, once.
Start
posttrain serverThe console runs on http://localhost:7880 and fetches the example projects on first start. In another terminal:
posttrain login --url http://localhost:7880
posttrain init --org acme --name tiny-chat --base HuggingFaceTB/SmolLM2-135M-Instruct
posttrain data add ./train.jsonl --kind sft
posttrain train sft --data train --steps 30 --on local
posttrain statusposttrain status lists every stage, what's done and what's next.
The guide's quickstarts walk through this in full, in the terminal or in the browser: https://app.posttrain.com/docs. The example files they use ship with this package: posttrain paths --examples prints where. To import the SDK (import posttrain) in your own Python, put the bundled library on its path: export PYTHONPATH="$(posttrain paths --lib)".
Where things live
| What | Where | Moved by |
|---|---|---|
| Your settings and token | ~/.posttrain/config.toml | POSTTRAIN_HOME, or POSTTRAIN_CONFIG for the file alone |
| Job directories, fixed datasets, offline records | ~/.posttrain/jobs, datasets, offline | POSTTRAIN_HOME |
| Your projects (the console's workspace, workspace.sqlite) | ~/.posttrain/console | POSTTRAIN_HOME (to $POSTTRAIN_HOME/console), posttrain server --data DIR, or POSTTRAIN_WORKSPACE_DIR |
| The example projects (demo.sqlite, fetched on the first posttrain server) | ~/.posttrain/console, one copy per user | VIEWER_DATA |
| The private Python environment, with the training libraries the first training run installs | ~/.posttrain/npm/venv, one per user | POSTTRAIN_VENV |
So a separate POSTTRAIN_HOME for trying things (export POSTTRAIN_HOME=/tmp/pt-try) gets its own settings, jobs and projects, and still uses the Python environment and the example projects you already have: it sets up nothing and downloads nothing. To keep everything inside one folder instead (a sandbox, CI), set POSTTRAIN_VENV and VIEWER_DATA to paths inside it too, and the two caches the first training run fills: PIP_CACHE_DIR (pip's downloads of the training libraries, about 230 MB) and HF_HUB_CACHE (the models and datasets jobs download). Move the Hugging Face downloads with HF_HUB_CACHE, not HF_HOME, which also holds your Hugging Face login. posttrain paths prints every location for the current settings.
License
AGPL-3.0. Built by BenchFlow.
