Tune Callbacks (tune.Callback)#

See this user guide for more details.

See also

Tune’s built-in loggers use the Callback interface.

Callback Interface#

Callback Initialization and Setup#

Callback()

Tune base callback that can be extended and passed to a TrialRunner

Callback.setup([stop, num_samples, ...])

Called once at the very beginning of training.

Callback Hooks#

Callback.on_checkpoint(iteration, trials, ...)

Called after a trial saved a checkpoint with Tune.

Callback.on_experiment_end(trials, **info)

Called after experiment is over and all trials have concluded.

Callback.on_step_begin(iteration, trials, **info)

Called at the start of each tuning loop step.

Callback.on_step_end(iteration, trials, **info)

Called at the end of each tuning loop step.

Callback.on_trial_complete(iteration, ...)

Called after a trial instance completed.

Callback.on_trial_error(iteration, trials, ...)

Called after a trial instance failed (errored).

Callback.on_trial_restore(iteration, trials, ...)

Called after restoring a trial instance.

Callback.on_trial_result(iteration, trials, ...)

Called after receiving a result from a trial.

Callback.on_trial_save(iteration, trials, ...)

Called after receiving a checkpoint from a trial.

Callback.on_trial_start(iteration, trials, ...)

Called after starting a trial instance.

Stateful Callbacks#

The following methods must be overriden for stateful callbacks to be saved/restored properly by Tune.

Callback.get_state()

Get the state of the callback.

Callback.set_state(state)

Get the state of the callback.