Prerequisites
Before you begin, ensure you have:- Baseten account: Sign up at app.baseten.co.
-
Truss: Install Truss:
- uv (recommended)
- pip (macOS/Linux)
- pip (Windows)
uv is a fast Python package manager.
Create your training project
To create a new training project, use thetruss train init command.
Write your configuration file
Define your training job in a Python configuration file, typically namedconfig.py.
This file specifies your TrainingProject and TrainingJob. The configuration uses classes like Image, Compute, Runtime, and SecretReference:
config.py
pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime base image. You can use other base images to support your framework:
| Framework | Base image |
|---|---|
| PyTorch | pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime |
| Axolotl | axolotlai/axolotl:main-20250811-py3.11-cu126-2.7.1 |
| Unsloth | unsloth/unsloth:2025.10.9-pt2.8.0-cu12.8-updates-fixes |
| VeRL | verlai/verl:verl0.3.0.post1 |
| Megatron | baseten/megatron:py3.11.11-cuda12.8.1-torch2.8.0-fa2.8.1-megatron0.14.1-msswift3.10.3 |
- Local artifacts: Place scripts (
train.py,run.sh), config files, and data in the same directory asconfig.py. Truss packages everything and uploads it to the container’s working directory. - Ignore files: Create a
.truss_ignorefile to exclude files from upload, using.gitignoresyntax. For more information, see the Training reference. - Secrets: Store secrets in your Baseten workspace and reference them with
SecretReference.
Create your training scripts
Baseten Training is framework-agnostic. Typically, you use arun.sh script to install dependencies and launch training.
For example:
run.sh
train.py:
train.py
Submit your training job
With yourconfig.py and training scripts ready, submit the job:
config.py file, packages local files in the directory
alongside config.py, creates or updates the TrainingProject, and submits the
TrainingJob.
On successful submission, you’ll see:
job_id from this output to use in the monitoring commands below.
Monitor your training job
Use the job ID from the submission output to monitor your training job:Deploy your trained model
Once you see the model saved successfully in your logs, you’re ready to deploy. For example, you might see:- CLI
- Dashboard
Deploy your fine-tuned model directly to Baseten’s inference platform:The interactive wizard guides you through deployment:
Test your deployment
After deployment, call your model using the OpenAI-compatible chat format:- CLI
- Python
- cURL
Training framework examples
| Framework | Example | Description |
|---|---|---|
| TRL | oss-gpt-20b-lora-trl | LoRA fine-tuning |
| TRL | qwen3-8b-lora-dpo-trl | DPO training |
| Axolotl | oss-gpt-20b-axolotl | Axolotl fine-tuning |
| Axolotl | gemma-27b-axolotl | Multi-node fine-tuning |
| Unsloth | llama-8b-lora-unsloth | Fast LoRA fine-tuning |
| VeRL | qwen3-8b-fft-verl | RL with custom rewards |
| MS-Swift | glm-4-7-msswift | GLM-4 fine-tuning |
| MS-Swift | qwen3-235b-mswift | Large model training |