3636 is_mlflow_available ,
3737 is_swanlab_available ,
3838 is_tensorboard_available ,
39+ is_trackio_available ,
3940 is_wandb_available ,
4041 listify ,
4142)
6768if is_swanlab_available ():
6869 _available_trackers .append (LoggerType .SWANLAB )
6970
71+ if is_trackio_available ():
72+ _available_trackers .append (LoggerType .TRACKIO )
73+
7074logger = get_logger (__name__ )
7175
7276
@@ -415,6 +419,83 @@ def finish(self):
415419 logger .debug ("WandB run closed" )
416420
417421
422+ class TrackioTracker (GeneralTracker ):
423+ """
424+ A `Tracker` class that supports `trackio`. Should be initialized at the start of your script.
425+
426+ Args:
427+ run_name (`str`):
428+ The name of the experiment run. Will be used as the `project` name when instantiating trackio.
429+ **kwargs (additional keyword arguments, *optional*):
430+ Additional key word arguments passed along to the `trackio.init` method. Refer to this
431+ [init](https://github.com/gradio-app/trackio/blob/814809552310468b13f84f33764f1369b4e5136c/trackio/__init__.py#L22)
432+ to see all supported key word arguments.
433+ """
434+
435+ name = "trackio"
436+ requires_logging_directory = False
437+ main_process_only = False
438+
439+ def __init__ (self , run_name : str , ** kwargs ):
440+ super ().__init__ ()
441+ self .run_name = run_name
442+ self .init_kwargs = kwargs
443+
444+ @on_main_process
445+ def start (self ):
446+ import trackio
447+
448+ self .run = trackio .init (project = self .run_name , ** self .init_kwargs )
449+ logger .debug (f"Initialized trackio project { self .run_name } " )
450+ logger .debug (
451+ "Make sure to log any initial configurations with `self.store_init_configuration` before training!"
452+ )
453+
454+ @property
455+ def tracker (self ):
456+ return self .run
457+
458+ @on_main_process
459+ def store_init_configuration (self , values : dict ):
460+ """
461+ Logs `values` as hyperparameters for the run. Should be run at the beginning of your experiment.
462+
463+ Args:
464+ values (Dictionary `str` to `bool`, `str`, `float` or `int`):
465+ Values to be stored as initial hyperparameters as key-value pairs. The values need to have type `bool`,
466+ `str`, `float`, `int`, or `None`.
467+ """
468+ import trackio
469+
470+ trackio .config .update (values , allow_val_change = True )
471+ logger .debug ("Stored initial configuration hyperparameters to trackio" )
472+
473+ @on_main_process
474+ def log (self , values : dict , step : Optional [int ] = None , ** kwargs ):
475+ """
476+ Logs `values` to the current run.
477+
478+ Args:
479+ values (Dictionary `str` to `str`, `float`, `int` or `dict` of `str` to `float`/`int`):
480+ Values to be logged as key-value pairs. The values need to have type `str`, `float`, `int` or `dict` of
481+ `str` to `float`/`int`.
482+ step (`int`, *optional*):
483+ The run step. If included, the log will be affiliated with this step.
484+ kwargs:
485+ Additional key word arguments passed along to the `trackio.log` method.
486+ """
487+ self .run .log (values , ** kwargs )
488+ logger .debug ("Successfully logged to trackio" )
489+
490+ @on_main_process
491+ def finish (self ):
492+ """
493+ Closes `trackio` run
494+ """
495+ self .run .finish ()
496+ logger .debug ("trackio run closed" )
497+
498+
418499class CometMLTracker (GeneralTracker ):
419500 """
420501 A `Tracker` class that supports `comet_ml`. Should be initialized at the start of your script.
@@ -1174,6 +1255,7 @@ def finish(self):
11741255 "clearml" : ClearMLTracker ,
11751256 "dvclive" : DVCLiveTracker ,
11761257 "swanlab" : SwanLabTracker ,
1258+ "trackio" : TrackioTracker ,
11771259}
11781260
11791261
@@ -1195,6 +1277,8 @@ def filter_trackers(
11951277 - `"all"`
11961278 - `"tensorboard"`
11971279 - `"wandb"`
1280+ - `"trackio"`
1281+ - `"aim"`
11981282 - `"comet_ml"`
11991283 - `"mlflow"`
12001284 - `"dvclive"`
0 commit comments