ray.air.integrations.comet.CometLoggerCallback#

class ray.air.integrations.comet.CometLoggerCallback(online: bool = True, tags: List[str] = None, save_checkpoints: bool = False, **experiment_kwargs)[source]#

Bases: LoggerCallback

CometLoggerCallback for logging Tune results to Comet.

Comet (https://comet.ml/site/) is a tool to manage and optimize the entire ML lifecycle, from experiment tracking, model optimization and dataset versioning to model production monitoring.

This Ray Tune LoggerCallback sends metrics and parameters to Comet for tracking.

In order to use the CometLoggerCallback you must first install Comet via pip install comet_ml

Then set the following environment variables export COMET_API_KEY=<Your API Key>

Alternatively, you can also pass in your API Key as an argument to the CometLoggerCallback constructor.

CometLoggerCallback(api_key=<Your API Key>)

Parameters:
  • online – Whether to make use of an Online or Offline Experiment. Defaults to True.

  • tags – Tags to add to the logged Experiment. Defaults to None.

  • save_checkpoints – If True, model checkpoints will be saved to Comet ML as artifacts. Defaults to False.

  • **experiment_kwargs – Other keyword arguments will be passed to the constructor for comet_ml.Experiment (or OfflineExperiment if online=False).

Please consult the Comet ML documentation for more information on the Experiment and OfflineExperiment classes: https://comet.ml/site/

Example:

from ray.air.integrations.comet import CometLoggerCallback
tune.run(
    train,
    config=config
    callbacks=[CometLoggerCallback(
        True,
        ['tag1', 'tag2'],
        workspace='my_workspace',
        project_name='my_project_name'
        )]
)

Methods

get_state

Get the state of the callback.

log_trial_restore

Handle logging when a trial restores.

log_trial_result

Log the current result of a Trial upon each iteration.

log_trial_start

Initialize an Experiment (or OfflineExperiment if self.online=False) and start logging to Comet.

on_checkpoint

Called after a trial saved a checkpoint with Tune.

on_experiment_end

Called after experiment is over and all trials have concluded.

on_step_begin

Called at the start of each tuning loop step.

on_step_end

Called at the end of each tuning loop step.

on_trial_recover

Called after a trial instance failed (errored) but the trial is scheduled for retry.

set_state

Set the state of the callback.

setup

Called once at the very beginning of training.