Trackio Experiment Tracking

Track experiments locally with Trackio

What

Use Trackio when you want simple experiment tracking that feels like wandb but stays local by default and can sync to a Hugging Face Space when you need a shared dashboard.

Context

Steps / Snippet

# 1) Install Trackio in your environment
pip install trackio

# 2) Save this as trackio_demo.py (see below)

# 3) Run the script
python trackio_demo.py

# 4) Open the local dashboard for that project
trackio show --project til-trackio-demo
# trackio_demo.py
import math

import trackio

def run(epochs: int = 5) -> None:
    trackio.init(
        project="til-trackio-demo",
        config={"epochs": epochs, "optimizer": "adamw"},
    )

    for step in range(1, epochs + 1):
        loss = math.exp(-step / 4)
        lr = 3e-4 * (1 - step / epochs)

        trackio.log(
            {
                "train/loss": loss,
                "train/lr": lr,
            },
            step=step,
        )

    trackio.finish()


if __name__ == "__main__":
    run()

To also send metrics to a Hugging Face Space dashboard, add a space_id:

trackio.init(
    project="til-trackio-demo",
    space_id="YOUR_USERNAME/trackio-dashboard",
)

Pitfalls