composer.callbacks.callback_hparams#

Hyperparameters for callbacks.

Hparams

These classes are used with yahp for YAML-based configuration.

CallbackHparams

Base class for Callback hyperparameters.

CheckpointSaverHparams

CheckpointSaver hyperparameters.

GradMonitorHparams

GradMonitor hyperparamters.

LRMonitorHparams

LRMonitor hyperparameters.

MemoryMonitorHparams

MemoryMonitor hyperparameters.

SpeedMonitorHparams

SpeedMonitor hyperparameters.

class composer.callbacks.callback_hparams.CallbackHparams[source]#

Bases: yahp.hparams.Hparams, abc.ABC

Base class for Callback hyperparameters.

abstract initialize_object()[source]#

Initialize the callback.

Returns

Callback โ€“ An instance of the callback.

class composer.callbacks.callback_hparams.CheckpointSaverHparams(save_folder='{run_name}/checkpoints', filename='ep{epoch}-ba{batch}-rank{rank}', artifact_name='{run_name}/checkpoints/ep{epoch}-ba{batch}-rank{rank}', latest_filename='latest-rank{rank}', overwrite=False, weights_only=False, save_interval='1ep', num_checkpoints_to_keep=- 1)[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

CheckpointSaver hyperparameters.

Parameters
class composer.callbacks.callback_hparams.GradMonitorHparams(log_layer_grad_norms=False)[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

GradMonitor hyperparamters.

Parameters

log_layer_grad_norms (bool, optional) โ€“ See GradMonitor for documentation.

initialize_object()[source]#

Initialize the GradMonitor callback.

Returns

GradMonitor โ€“ An instance of GradMonitor.

class composer.callbacks.callback_hparams.LRMonitorHparams[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

LRMonitor hyperparameters.

There are no parameters as LRMonitor does not take any parameters.

initialize_object()[source]#

Initialize the LRMonitor callback.

Returns

LRMonitor โ€“ An instance of LRMonitor.

class composer.callbacks.callback_hparams.MLPerfCallbackHparams(root_folder, index, benchmark='resnet', target=0.759, division='open', metric_name='Accuracy', metric_label='eval', submitter='MosaicML', system_name=None, status='onprem', cache_clear_cmd=None)[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

MLPerfCallback hyperparameters.

Parameters
  • root_folder (str) โ€“ The root submission folder

  • index (int) โ€“ The repetition index of this run. The filename created will be result_[index].txt.

  • benchmark (str, optional) โ€“ Benchmark name. Currently only resnet supported.

  • target (float, optional) โ€“ The target metric before the mllogger marks the stop of the timing run. Default: 0.759 (resnet benchmark).

  • division (str, optional) โ€“ Division of submission. Currently only open division supported.

  • metric_name (str, optional) โ€“ name of the metric to compare against the target. Default: Accuracy.

  • metric_label (str, optional) โ€“ label name. The metric will be accessed via state.current_metrics[metric_label][metric_name].

  • submitter (str, optional) โ€“ Submitting organization. Default: MosaicML.

  • system_name (str, optional) โ€“ Name of the system (e.g. 8xA100_composer). If not provided, system name will default to [world_size]x[device_name]_composer, e.g. 8xNVIDIA_A100_80GB_composer.

  • status (str, optional) โ€“ Submission status. One of (onprem, cloud, or preview). Default: "onprem".

  • cache_clear_cmd (str, optional) โ€“ Command to invoke during the cache clear. This callback will call subprocess(cache_clear_cmd). Default is disabled (None)

initialize_object()[source]#

Initialize the MLPerf Callback.

Returns

MLPerfCallback โ€“ An instance of MLPerfCallback

class composer.callbacks.callback_hparams.MemoryMonitorHparams[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

MemoryMonitor hyperparameters.

There are no parameters as MemoryMonitor does not take any parameters.

initialize_object()[source]#

Initialize the MemoryMonitor callback.

Returns

MemoryMonitor โ€“ An instance of MemoryMonitor.

class composer.callbacks.callback_hparams.SpeedMonitorHparams(window_size=100)[source]#

Bases: composer.callbacks.callback_hparams.CallbackHparams

SpeedMonitor hyperparameters.

Parameters

window_size (int, optional) โ€“ See SpeedMonitor for documentation.

initialize_object()[source]#

Initialize the SpeedMonitor callback.

Returns

SpeedMonitor โ€“ An instance of SpeedMonitor.