Trackio documentation
API Reference
API Reference
Run
class trackio.Run
< source >( url: str project: str client: gradio_client.client.Client | None name: str | None = None config: dict | None = None space_id: str | None = None )
Cleanup when run is finished.
init
trackio.init
< source >( 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
orNone
, optional, defaults toNone
) — The name of the run (if not provided, a default name will be generated). - space_id (
str
orNone
, optional, defaults toNone
) — 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
orNone
, optional, defaults toNone
) — If aspace_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), orNone
(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
orNone
, optional, defaults toNone
) — A dictionary of configuration options. Provided for compatibility withwandb.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 toNone
) — Not used. Provided for compatibility withwandb.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
< source >( metrics: dict step: int | None = None )
Logs metrics to the current run.
finish
Finishes the current run.
show
trackio.show
< source >( project: str | None = None theme: str | gradio.themes.base.ThemeClass = 'citrus' )
Parameters
- project (
str
orNone
, optional, defaults toNone
) — 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
orThemeClass
, 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
< source >( 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
orPath
) — 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
orNone
, optional, defaults toNone
) — The name of the Run to import the CSV file into. If not provided, a default name will be generated. - name (
str
orNone
, optional, defaults toNone
) — The name of the run (if not provided, a default name will be generated). - space_id (
str
orNone
, optional, defaults toNone
) — 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
orNone
, optional, defaults toNone
) — 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 aspace_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
< source >( 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
orPath
) — 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
orNone
, optional, defaults toNone
) — The name prefix for runs (if not provided, will use directory names). Each subdirectory will create a separate run. - space_id (
str
orNone
, optional, defaults toNone
) — 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
orNone
, optional, defaults toNone
) — 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 aspace_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.