( url: str project: str client: gradio_client.client.Client | None name: str | None = None group: str | None = None config: dict | None = None space_id: str | None = None )
Cleanup when run is finished.
( project: str name: str | None = None group: str | None = None space_id: str | None = None space_storage: huggingface_hub._space_api.SpaceStorage | None = None dataset_id: str | None = None config: dict | None = None resume: str = 'never' settings: typing.Any = None private: bool | None = None embed: bool = True ) → Run
Parameters
str) —
The name of the project (can be an existing project to continue tracking or
a new project to start tracking from scratch). str, optional) —
The name of the run (if not provided, a default name will be generated). str, optional) —
The name of the group which this run belongs to in order to help organize
related runs together. You can toggle the entire group’s visibilitiy in the
dashboard. str, optional) —
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. str, optional) —
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. dict, optional) —
A dictionary of configuration options. Provided for compatibility with
wandb.init(). 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 onebool, optional) —
Whether to make the Space private. If None (default), the repo will be
public unless the organization’s default is private. This value is ignored
if the repo already exists. Any, optional) —
Not used. Provided for compatibility with wandb.init(). bool, optional, defaults to True) —
If running inside a jupyter/Colab notebook, whether the dashboard should
automatically be embedded in the cell when trackio.init() is called. 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.
( metrics: dict step: int | None = None )
Logs metrics to the current run.
Finishes the current run.
( project: str | None = None theme: str | gradio.themes.base.ThemeClass | None = None mcp_server: bool | None = None )
Parameters
str, optional) —
The name of the project whose runs to show. If not provided, all projects
will be shown and the user can select one. str or ThemeClass, optional) —
A Gradio Theme to use for the dashboard instead of the default Gradio theme,
can be a built-in theme (e.g. 'soft', 'citrus'), a theme from the Hub
(e.g. "gstaff/xkcd"), or a custom Theme class. If not provided, the
TRACKIO_THEME environment variable will be used, or if that is not set, the
default Gradio theme will be used. bool, optional) —
If True, the Trackio dashboard will be set up as an MCP server and certain
functions will be added as MCP tools. If None (default behavior), then the
GRADIO_MCP_SERVER environment variable will be used to determine if the
MCP server should be enabled (which is "True" on Hugging Face Spaces). Launches the Trackio dashboard.
( csv_path: str | pathlib.Path project: str name: str | None = None space_id: str | None = None dataset_id: str | None = None private: bool | None = None )
Parameters
str or Path) —
The str or Path to the CSV file to import. str) —
The name of the project to import the CSV file into. Must not be an existing
project. str, optional) —
The name of the Run to import the CSV file into. If not provided, a default
name will be generated. str, optional) —
The name of the run (if not provided, a default name will be generated). str, optional) —
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. str, optional) —
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. bool, optional) —
Whether to make the Space private. If None (default), the repo will be
public unless the organization’s default is private. This value is ignored
if the repo already exists. 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.
( log_dir: str | pathlib.Path project: str name: str | None = None space_id: str | None = None dataset_id: str | None = None private: bool | None = None )
Parameters
str or Path) —
The str or Path to the directory containing TensorFlow Events files. str) —
The name of the project to import the TensorFlow Events files into. Must not
be an existing project. str, optional) —
The name prefix for runs (if not provided, will use directory names). Each
subdirectory will create a separate run. str, optional) —
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. str, optional) —
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. bool, optional) —
Whether to make the Space private. If None (default), the repo will be
public unless the organization’s default is private. This value is ignored
if the repo already exists. Imports TensorFlow Events files from a directory into a Trackio project. Each subdirectory in the log directory will be imported as a separate run.
( columns: list[str] | None = None data: list[list[typing.Any]] | None = None dataframe: pandas.core.frame.DataFrame | None = None rows: list[list[typing.Any]] | None = None optional: bool | list[bool] = True allow_mixed_types: bool = False log_mode: typing.Optional[typing.Literal['IMMUTABLE', 'MUTABLE', 'INCREMENTAL']] = 'IMMUTABLE' )
Parameters
list[str], optional) —
Names of the columns in the table. Optional if data is provided. Not
expected if dataframe is provided. Currently ignored. list[list[Any]], optional) —
2D row-oriented array of values. pandas.DataFrame`, *optional*) -- DataFrame object used to create the table. When set, dataandcolumns`
arguments are ignored. list[list[any]], optional) —
Currently ignored. bool or list[bool], optional, defaults to True) —
Currently ignored. bool, optional, defaults to False) —
Currently ignored. Literal["IMMUTABLE", "MUTABLE", "INCREMENTAL"] or None, optional, defaults to "IMMUTABLE"):
Currently ignored. Initializes a Table object.
( value: str | pathlib.Path | numpy.ndarray | PIL.Image.Image caption: str | None = None )
Initializes an Image object.
Example:
import trackio
import numpy as np
from PIL import Image
# Create an image from numpy array
image_data = np.random.randint(0, 255, (64, 64, 3), dtype=np.uint8)
image = trackio.Image(image_data, caption="Random image")
trackio.log({"my_image": image})
# Create an image from PIL Image
pil_image = Image.new('RGB', (100, 100), color='red')
image = trackio.Image(pil_image, caption="Red square")
trackio.log({"red_image": image})
# Create an image from file path
image = trackio.Image("path/to/image.jpg", caption="Photo from file")
trackio.log({"file_image": image})( value: str | pathlib.Path | numpy.ndarray caption: str | None = None fps: int | None = None format: typing.Optional[typing.Literal['gif', 'mp4', 'webm']] = None )
Parameters
str, Path, or numpy.ndarray, optional) —
A path to a video file, or a numpy array.
The array should be of type np.uint8 with RGB values in the range [0, 255].
It is expected to have shape of either (frames, channels, height, width) or (batch, frames, channels, height, width).
For the latter, the videos will be tiled into a grid. str, optional) —
A string caption for the video. int, optional) —
Frames per second for the video. Only used when value is an ndarray. Default is 24. Literal["gif", "mp4", "webm"], optional) —
Video format (“gif”, “mp4”, or “webm”). Only used when value is an ndarray. Default is “gif”. Initializes a Video object.
Example:
import trackio
import numpy as np
# Create a simple video from numpy array
frames = np.random.randint(0, 255, (10, 3, 64, 64), dtype=np.uint8)
video = trackio.Video(frames, caption="Random video", fps=30)
# Create a batch of videos
batch_frames = np.random.randint(0, 255, (3, 10, 3, 64, 64), dtype=np.uint8)
batch_video = trackio.Video(batch_frames, caption="Batch of videos", fps=15)
# Create video from file path
video = trackio.Video("path/to/video.mp4", caption="Video from file")