Trackio documentation

API Reference

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

API Reference

Run

class trackio.Run

< >

( url: str project: str client: gradio_client.client.Client | None name: str | None = None config: dict | None = None space_id: str | None = None )

finish

< >

( )

Cleanup when run is finished.

init

trackio.init

< >

( project: str name: str | None = None space_id: str | None = None dataset_id: str | None = None config: dict | None = None resume: str = 'never' settings: typing.Any = None ) Run

Parameters

  • project (str) — The name of the project (can be an existing project to continue tracking or a new project to start tracking from scratch).
  • name (str or None, optional, defaults to None) — The name of the run (if not provided, a default name will be generated).
  • space_id (str or None, optional, defaults to None) — If provided, the project will be logged to a Hugging Face Space instead of a local directory. Should be a complete Space name like "username/reponame" or "orgname/reponame", or just "reponame" in which case the Space will be created in the currently-logged-in Hugging Face user’s namespace. If the Space does not exist, it will be created. If the Space already exists, the project will be logged to it.
  • dataset_id (str or None, optional, defaults to None) — If a space_id is provided, a persistent Hugging Face Dataset will be created and the metrics will be synced to it every 5 minutes. Specify a Dataset with name like "username/datasetname" or "orgname/datasetname", or "datasetname" (uses currently-logged-in Hugging Face user’s namespace), or None (uses the same name as the Space but with the "_dataset" suffix). If the Dataset does not exist, it will be created. If the Dataset already exists, the project will be appended to it.
  • config (dict or None, optional, defaults to None) — A dictionary of configuration options. Provided for compatibility with wandb.init().
  • resume (str, optional, defaults to "never") — Controls how to handle resuming a run. Can be one of:

    • "must": Must resume the run with the given name, raises error if run doesn’t exist
    • "allow": Resume the run if it exists, otherwise create a new run
    • "never": Never resume a run, always create a new one
  • settings (Any, optional, defaults to None) — Not used. Provided for compatibility with wandb.init().

Returns

Run

A Run object that can be used to log metrics and finish the run.

Creates a new Trackio project and returns a Run object.

log

trackio.log

< >

( metrics: dict step: int | None = None )

Parameters

  • metrics (dict) — A dictionary of metrics to log.
  • step (int or None, optional, defaults to None) — The step number. If not provided, the step will be incremented automatically.

Logs metrics to the current run.

finish

trackio.finish

< >

( )

Finishes the current run.

show

trackio.show

< >

( project: str | None = None theme: str | gradio.themes.base.ThemeClass = 'citrus' )

Parameters

  • project (str or None, optional, defaults to None) — The name of the project whose runs to show. If not provided, all projects will be shown and the user can select one.
  • theme (str or ThemeClass, optional, defaults to "citrus") — A Gradio Theme to use for the dashboard instead of the default "citrus", can be a built-in theme (e.g. 'soft', 'default'), a theme from the Hub (e.g. "gstaff/xkcd"), or a custom Theme class.

Launches the Trackio dashboard.

import_csv

trackio.import_csv

< >

( csv_path: str | pathlib.Path project: str name: str | None = None space_id: str | None = None dataset_id: str | None = None )

Parameters

  • csv_path (str or Path) — The str or Path to the CSV file to import.
  • project (str) — The name of the project to import the CSV file into. Must not be an existing project.
  • name (str or None, optional, defaults to None) — The name of the Run to import the CSV file into. If not provided, a default name will be generated.
  • name (str or None, optional, defaults to None) — The name of the run (if not provided, a default name will be generated).
  • space_id (str or None, optional, defaults to None) — If provided, the project will be logged to a Hugging Face Space instead of a local directory. Should be a complete Space name like "username/reponame" or "orgname/reponame", or just "reponame" in which case the Space will be created in the currently-logged-in Hugging Face user’s namespace. If the Space does not exist, it will be created. If the Space already exists, the project will be logged to it.
  • dataset_id (str or None, optional, defaults to None) — If provided, a persistent Hugging Face Dataset will be created and the metrics will be synced to it every 5 minutes. Should be a complete Dataset name like "username/datasetname" or "orgname/datasetname", or just "datasetname" in which case the Dataset will be created in the currently-logged-in Hugging Face user’s namespace. If the Dataset does not exist, it will be created. If the Dataset already exists, the project will be appended to it. If not provided, the metrics will be logged to a local SQLite database, unless a space_id is provided, in which case a Dataset will be automatically created with the same name as the Space but with the "_dataset" suffix.

Imports a CSV file into a Trackio project. The CSV file must contain a "step" column, may optionally contain a "timestamp" column, and any other columns will be treated as metrics. It should also include a header row with the column names.

TODO: call init() and return a Run object so that the user can continue to log metrics to it.

import_tf_events

trackio.import_tf_events

< >

( log_dir: str | pathlib.Path project: str name: str | None = None space_id: str | None = None dataset_id: str | None = None )

Parameters

  • log_dir (str or Path) — The str or Path to the directory containing TensorFlow Events files.
  • project (str) — The name of the project to import the TensorFlow Events files into. Must not be an existing project.
  • name (str or None, optional, defaults to None) — The name prefix for runs (if not provided, will use directory names). Each subdirectory will create a separate run.
  • space_id (str or None, optional, defaults to None) — If provided, the project will be logged to a Hugging Face Space instead of a local directory. Should be a complete Space name like "username/reponame" or "orgname/reponame", or just "reponame" in which case the Space will be created in the currently-logged-in Hugging Face user’s namespace. If the Space does not exist, it will be created. If the Space already exists, the project will be logged to it.
  • dataset_id (str or None, optional, defaults to None) — If provided, a persistent Hugging Face Dataset will be created and the metrics will be synced to it every 5 minutes. Should be a complete Dataset name like "username/datasetname" or "orgname/datasetname", or just "datasetname" in which case the Dataset will be created in the currently-logged-in Hugging Face user’s namespace. If the Dataset does not exist, it will be created. If the Dataset already exists, the project will be appended to it. If not provided, the metrics will be logged to a local SQLite database, unless a space_id is provided, in which case a Dataset will be automatically created with the same name as the Space but with the "_dataset" suffix.

Imports TensorFlow Events files from a directory into a Trackio project. Each subdirectory in the log directory will be imported as a separate run.

< > Update on GitHub