Back to Trl

Trackio Integration

docs/source/trackio_integration.md

1.3.02.1 KB
Original Source

Trackio Integration

Trackio is a lightweight, free experiment tracking library built on top of 🤗 Datasets and 🤗 Spaces. It is the recommended tracking solution for TRL and comes natively integrated with all trainers.

To enable logging, simply set report_to="trackio" in your training config:

python
from trl import SFTConfig  # works with any trainer config (e.g. DPOConfig, GRPOConfig, etc.)

training_args = SFTConfig(
    ...,
    report_to="trackio",  # enable Trackio logging
)

Organizing Your Experiments with Run Names and Projects

By default, Trackio will generate a name to identify each run. However, we highly recommend setting a descriptive run_name to make it easier to organize experiments. For example:

python
from trl import SFTConfig

training_args = SFTConfig(
    ...,
    report_to="trackio",
    run_name="sft_qwen3-4b_lr2e-5_bs128",  # descriptive run name
)

You can also group related experiments by project by setting the following environment variable:

bash
export TRACKIO_PROJECT="my_project"

Hosting Your Logs on 🤗 Spaces

Trackio has local-first design, meaning your logs stay on your machine. If you’d like to host them and deploy a dashboard on 🤗 Spaces, set:

bash
export TRACKIO_SPACE_ID="username/space_id"

Running the following example:

python
import os
from trl import SFTConfig, SFTTrainer
from datasets import load_dataset

os.environ["TRACKIO_SPACE_ID"] = "trl-lib/trackio"
os.environ["TRACKIO_PROJECT"] = "trl-documentation"

trainer = SFTTrainer(
    model="Qwen/Qwen3-0.6B",
    train_dataset=load_dataset("trl-lib/Capybara", split="train"),
    args=SFTConfig(
        report_to="trackio",
        run_name="sft_qwen3-0.6b_capybara",
    ),
)
trainer.train()

will give you a hosted dashboard at https://huggingface.co/spaces/trl-lib/trackio.

<iframe src="https://trl-lib-trackio.hf.space/?project=trl-documentation&sidebar=hidden&runs=sft_qwen3-0.6B_capybara" style="width: 100%; min-width: 300px; max-width: 800px;" height="830" frameBorder="0"></iframe>