Skip to content

Callbacks

gpu

EmissionTrackerCallback (Callback)

Tracks the carbon emissions produced by deep neural networks using CodeCarbon. To use this callback first install codecarbon using pip install codecarbon. For offline use, you must have to specify the country code.

Parameters:

Name Type Description Default
offline

whether to use internet connection or not. You will have to provide the country code country_iso_code for offline use.

required
**kwargs

passed directly to codecarbon class.

required

on_fit_end(self)

Called after model.fit(...)

logger special

comet

CometCallback (Callback)

Comet Logging callback. To use this callback pip install comet-ml.

Parameters:

Name Type Description Default
project_name

Name of the Project

required
api_key

project API key

required
offline

log experiment offline

required
on_epoch_end(self)

Called after each epoch

on_fit_start(self)

Called on each model.fit(...)

on_train_epoch_start(self)

Called on start of training epoch

on_train_step_end(self, *args, **kwargs)

Called after training step

on_val_epoch_start(self)

Called on start of validation epoch

on_val_step_end(self, *args, **kwargs)

Called after validation step

logger

CSVLogger (Callback)

Saves Model training metrics as CSV

Parameters:

Name Type Description Default
filename

filename of the csv

required
path

folder path location of the csv

required
verbose

Whether to show output

required
on_epoch_end(self)

Called after each epoch

ModelCheckpoint (Callback)

Saves Model checkpoint

Parameters:

Name Type Description Default
filename

name of checkpoint

required
path

folder path location of the model checkpoint

required
save_extra

whether to save extra details like tracker

required
on_epoch_end(self)

Called after each epoch

progress

ProgressCallback (Callback)

clean(self)

Clean up

on_epoch_end(self)

Called after each epoch

on_fit_end(self)

Called after model.fit(...)

on_fit_start(self)

Called on each model.fit(...)

on_train_epoch_end(self, *args, **kwargs)

Called after end of training epoch

on_train_epoch_start(self)

Called on start of training epoch

on_train_step_end(self, *args, **kwargs)

Called after training step

on_val_epoch_end(self, *args, **kwargs)

called after validation epoch ends

on_val_epoch_start(self)

Called on start of validation epoch

on_val_step_end(self, *args, **kwargs)

Called after validation step

raytune

TorchTuneCheckpointCallback (Callback)

on_epoch_end(self)

Called after each epoch

TorchTuneReport (Callback)

on_epoch_end(self)

Called after each epoch

runner

CallbackRunner (Callback)

clean(self, keep=None)

Remove all the callbacks except callback names provided in keep

on_epoch_end(self)

Called after each epoch

on_epoch_start(self)

Called Before each Epoch

on_fit_end(self)

Called after model.fit(...)

on_fit_start(self)

Called on each model.fit(...)

on_forward_end(self)

Called after model.forward(...)

on_forward_start(self)

Called before model.forward(...)

on_train_epoch_end(self, *args, **kwargs)

Called after end of training epoch

on_train_epoch_start(self)

Called on start of training epoch

on_train_step_end(self, *args, **kwargs)

Called after training step

on_train_step_start(self)

called before train_step

on_val_epoch_end(self, *args, **kwargs)

called after validation epoch ends

on_val_epoch_start(self)

Called on start of validation epoch

on_val_step_end(self, *args, **kwargs)

Called after validation step

on_val_step_start(self)

Called on validation step

training

TrainEvalCallback (Callback)

on_train_epoch_start(self)

Called on start of training epoch

on_train_step_end(self, *args, **kwargs)

Called after training step

on_train_step_start(self)

called before train_step

on_val_epoch_start(self)

Called on start of validation epoch

on_val_step_end(self, *args, **kwargs)

Called after validation step


Last update: September 29, 2021