Trackio documentation
Self-host the Trackio server
Self-host the Trackio server
You can run the Trackio dashboard and API on your own machine (or any host you control) and send metrics from training scripts to that server over HTTP. This is an alternative to logging to a Hugging Face Space via space_id.
Run the server locally
Install Trackio, then start the dashboard. By default it listens on 127.0.0.1 and uses the port from GRADIO_SERVER_PORT if set, otherwise 7860 (see Launch the Dashboard).
trackio show
Leave that process running while you train. The terminal prints a base URL for the UI and a URL that includes a write token; anyone who can reach that URL with the token can perform write operations supported by the server (for example renaming runs), so treat it like a secret on untrusted networks.
Listen on all interfaces
To access the dashboard from another machine on your network (or from containers), bind to all interfaces:
trackio show --host 0.0.0.0
Ensure your firewall and security policies allow the traffic you intend.
Point training code at your server
In your training script, pass a server_url and supply the write token: either embed write_token in the query string (the same URL the dashboard prints for write access, or the full_url return value from trackio.show()), or pass a base URL like http://127.0.0.1:7860/ and set the TRACKIO_WRITE_TOKEN environment variable to that token. Metric ingestion and uploads require this token when the server is not on Hugging Face Spaces. You can also set TRACKIO_SERVER_URL instead of passing server_url in code.
import trackio
trackio.init(
project="my-project",
server_url="http://127.0.0.1:7860?write_token=YOUR_TOKEN",
)
trackio.log({"loss": 0.25})
trackio.finish()Precedence: space_id / TRACKIO_SPACE_ID always wins over server_url / TRACKIO_SERVER_URL when both are set (in code or in the environment). Trackio then behaves as if only the Space were configured.
Hugging Face–specific options such as dataset_id and bucket_id apply only when logging to a Space. When only server_url is in effect, configure persistence on the machine where the server runs (for example via TRACKIO_DIR on that host). See Environment Variables.
Related
- Launch the Dashboard — CLI options, port, and remote access
- Environment Variables —
TRACKIO_SERVER_URL,TRACKIO_DIR, and others