Experiment Tracking
The Base Tracker Class
A base Tracker class to be used for all logging integration implementations.
Each function should take in **kwargs
that will automatically be passed in from a base dictionary provided to
Accelerator.
Should implement name
, requires_logging_directory
, and tracker
properties such that:
name
(str
): String representation of the tracker class name, such as “TensorBoard” requires_logging_directory
(bool
): Whether the logger requires a directory to store their logs. tracker
(object
): Should return internal
tracking mechanism used by a tracker class (such as the run
for wandb)
Implementations can also include a main_process_only
(bool
) attribute to toggle if relevent logging, init, and
other functions should occur on the main process or across all processes (by default will use True
)
Should run any finalizing functions within the tracking API. If the API should not have one, just don’t overwrite that method.
log
< source >( values: dict step: typing.Optional[int] **kwargs )
Logs values
to the current run. Base log
implementations of a tracking API should go in here, along with
special behavior for the `step parameter.
store_init_configuration
< source >( values: dict )
Logs values
as hyperparameters for the run. Implementations should use the experiment configuration
functionality of a tracking API.
Integrated Trackers
class accelerate.tracking.TensorBoardTracker
< source >( run_name: str logging_dir: typing.Union[str, os.PathLike] **kwargs )
A Tracker
class that supports tensorboard
. Should be initialized at the start of your script.
class accelerate.tracking.WandBTracker
< source >( run_name: str **kwargs )
A Tracker
class that supports wandb
. Should be initialized at the start of your script.
class accelerate.tracking.CometMLTracker
< source >( run_name: str **kwargs )
A Tracker
class that supports comet_ml
. Should be initialized at the start of your script.
API keys must be stored in a Comet config file.
class accelerate.tracking.AimTracker
< source >( run_name: str logging_dir: typing.Union[str, os.PathLike, NoneType] = '.' **kwargs )
A Tracker
class that supports aim
. Should be initialized at the start of your script.
__init__
< source >( run_name: str logging_dir: typing.Union[str, os.PathLike, NoneType] = '.' **kwargs )
class accelerate.tracking.MLflowTracker
< source >( experiment_name: str = None logging_dir: typing.Union[str, os.PathLike, NoneType] = '.' run_id: typing.Optional[str] = None tags: typing.Union[typing.Dict[str, typing.Any], str, NoneType] = None nested_run: typing.Optional[bool] = False run_name: typing.Optional[str] = None description: typing.Optional[str] = None )
Parameters
-
experiment_name (
str
, optional) — Name of the experiment. Environment variable MLFLOW_EXPERIMENT_NAME has priority over this argument. -
logging_dir (
str
oros.PathLike
, defaults to"."
) — Location for mlflow logs to be stored. -
run_id (
str
, optional) — If specified, get the run with the specified UUID and log parameters and metrics under that run. The run’s end time is unset and its status is set to running, but the run’s other attributes (source_version, source_type, etc.) are not changed. Environment variable MLFLOW_RUN_ID has priority over this argument. -
tags (
Dict[str, str]
, optional) — An optionaldict
ofstr
keys and values, or astr
dump from adict
, to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run. Environment variable MLFLOW_TAGS has priority over this argument. -
nested_run (
bool
, optional, defaults toFalse
) — Controls whether run is nested in parent run. True creates a nested run. Environment variable MLFLOW_NESTED_RUN has priority over this argument. -
run_name (
str
, optional) — Name of new run (stored as a mlflow.runName tag). Used only whenrun_id
is unspecified. -
description (
str
, optional) — An optional string that populates the description box of the run. If a run is being resumed, the description is set on the resumed run. If a new run is being created, the description is set on the new run.
A Tracker
class that supports mlflow
. Should be initialized at the start of your script.
__init__
< source >( experiment_name: str = None logging_dir: typing.Union[str, os.PathLike, NoneType] = '.' run_id: typing.Optional[str] = None tags: typing.Union[typing.Dict[str, typing.Any], str, NoneType] = None nested_run: typing.Optional[bool] = False run_name: typing.Optional[str] = None description: typing.Optional[str] = None )