For the complete documentation index, see llms.txt. This page is also available as Markdown.

Trackio

Logging and visualizing experiments with Trackio.

Overview

The Trackio integration for ZenML enables experiment tracking, metric logging, artifact management, and Hugging Face ecosystem publishing directly inside ZenML pipelines.

The integration connects ZenML's pipeline orchestration layer with Trackio's lightweight experiment tracking runtime, allowing users to monitor and publish machine learning workflows with minimal operational overhead.

Supported Features

  • Local experiment tracking

  • Hugging Face Space dashboards

  • Dataset publishing

  • Artifact logging

  • Metric visualization

  • System and GPU telemetry

  • Static dashboard workflows

  • Full Hugging Face ecosystem integration

The tracker is implemented as a ZenML experiment tracker flavor and lifecycle integration.


How the Integration Works

During pipeline execution, the integration follows this workflow:

  1. ZenML initializes the active experiment tracker

  2. The Trackio integration creates a Trackio run

  3. ZenML pipeline metadata is injected automatically

  4. Metrics, artifacts, and metadata are logged to Trackio

  5. Optional synchronization and publishing actions are executed

  6. Run metadata and dashboard URLs are attached back to the ZenML run

Internally, the integration hooks into the ZenML step lifecycle using:

  • prepare_step_run

  • cleanup_step_run

  • get_step_run_metadata


Backend Support

The integration supports multiple Trackio backend modes through the backend configuration field.

Backend
Description

sqlite

Local lightweight tracking

space

Hugging Face Space-hosted dashboards

http

Remote Trackio server

static

Static deployment mode

This allows the same ZenML pipeline to run locally or publish hosted dashboards without changing pipeline logic.


Configuration

The integration exposes two configuration layers:

Tracker Configuration

TrackioExperimentTrackerConfig defines backend and deployment behavior.

Important fields include:

Field
Description

project_name

Trackio project name

backend

Backend type

tracking_uri

Optional backend URI

local_dir

Local tracking directory

hf_token

Hugging Face authentication token

hf_space

Hugging Face Space dashboard

hf_dataset_repo

Dataset repository

publish_to_space

Publish dashboards automatically

publish_to_dataset

Publish logs automatically

Runtime Settings

TrackioExperimentTrackerSettings controls runtime behavior.

Supported settings include:

Setting
Description

run_name

Custom run name

tags

Run tags

resume

Resume policy

auto_sync

Automatically sync runs

auto_freeze

Freeze dashboards

log_system_metrics

System telemetry

log_gpu_metrics

GPU telemetry


Complete Integration Example

Overview

The example pipeline demonstrates a complete Hugging Face + ZenML + Trackio workflow. The pipeline performs:

  • Dataset loading from Hugging Face Datasets

  • Sentiment inference using Transformers

  • Metric logging with Trackio

  • Artifact saving

  • Dataset publishing to Hugging Face Hub

  • Dashboard synchronization

Active Experiment Tracker

The currently active experiment tracker is resolved from the ZenML stack:

This allows the pipeline to remain environment-independent while inheriting the configured experiment tracker automatically.

Hugging Face Integration Targets

Dataset Loading

The pipeline loads an input dataset directly from the Hugging Face Hub:

This step becomes reproducible and version-aware through ZenML.

Transformers Inference

The example initializes a Hugging Face Transformers sentiment pipeline:

Inference is executed inside the classify_sentiment step. Each dataset row is processed individually and converted into structured prediction records.

Trackio Logging

The integration logs metrics directly through Trackio:

The example logs:

  • Number of samples

  • Positive predictions

  • Negative predictions

  • Confidence scores

  • Prediction ratios

  • Min/max confidence

Additional metadata is also logged:

Artifact Management

The pipeline stores prediction outputs and metrics locally before uploading them through Trackio.

Artifacts are written as JSON files and uploaded using:

This enables artifact persistence alongside experiment metadata.

Hugging Face Dataset Publishing

The processed dataset is published back to the Hugging Face Hub:

This creates a reproducible dataset output workflow integrated directly into the pipeline.

Hugging Face Space Dashboard

The pipeline also publishes dashboard metadata for a Hugging Face Space:

Synchronization

The example explicitly synchronizes the Trackio project after execution:

This pushes tracked metadata and artifacts into the configured backend.

Runtime Initialization

Internally, the integration initializes Trackio with ZenML metadata:

The integration dynamically filters unsupported SDK arguments before calling:

This improves compatibility across Trackio versions and backend modes.

Automatic Cleanup

At the end of each step, the integration finalizes the Trackio session using:

Optional synchronization and dashboard freezing can also be enabled through runtime settings.


Full Example Code


Summary

The Trackio integration extends ZenML with a lightweight experiment tracking layer that supports:

  • Metric logging

  • Artifact tracking

  • Hugging Face publishing

  • Hosted dashboards

  • Dataset synchronization

  • Experiment metadata management

The example pipeline demonstrates how ZenML orchestration, Hugging Face tooling, and Trackio tracking can be combined into a single reproducible ML workflow with minimal infrastructure requirements.

Integration Benefits

  • Hugging Face Ecosystem: Native integration with Datasets, Models, and Spaces.

  • Multiple Backends: Supports local SQLite, Hugging Face Spaces, HTTP servers, and static deployments.

  • Automatic Metadata Injection: Pipeline context (names, run IDs, step names) automatically included.

  • Artifact Management: Seamless artifact persistence and publishing.

  • Dashboard Publishing: Export runs to hosted Hugging Face Spaces dashboards.


Last updated

Was this helpful?