Trackio documentation
Quickstart Guide
Quickstart Guide
To get started, you can run a simple example that logs some fake training metrics:
import trackio
import random
import time
runs = 3
epochs = 8
for run in range(runs):
trackio.init(
project="my-project",
config={"epochs": epochs, "learning_rate": 0.001, "batch_size": 64}
)
for epoch in range(epochs):
train_loss = random.uniform(0.2, 1.0)
train_acc = random.uniform(0.6, 0.95)
val_loss = train_loss - random.uniform(0.01, 0.1)
val_acc = train_acc + random.uniform(0.01, 0.05)
trackio.log({
"epoch": epoch,
"train_loss": train_loss,
"train_accuracy": train_acc,
"val_loss": val_loss,
"val_accuracy": val_acc
})
time.sleep(0.2)
trackio.finish()
Running the above will print to the terminal instructions on launching the dashboard.
The usage of trackio
is designed to be identical to wandb
in most cases, so you can easily switch between the two libraries.
import trackio as wandb
Dashboard
You can launch the dashboard by running:
trackio show
You can also provide an optional project
name as the argument to load a specific project directly:
trackio show --project "my-project"
Deploying to Hugging Face Spaces
When calling trackio.init()
, by default the service will run locally and store project data on the local machine.
But if you pass a space_id
to init(), like:
trackio.init(project="my-project", space_id="orgname/space_id")
or
trackio.init(project="my-project", space_id="username/space_id")
it will use an existing or automatically deploy a new Hugging Face Space as needed. You should be logged in with the huggingface-cli
locally and your token should have write permissions to create the Space.