syne_tune.callbacks.remove_checkpoints_callback module

class syne_tune.callbacks.remove_checkpoints_callback.RemoveCheckpointsCallback[source]

Bases: TunerCallback

This implements early removal of checkpoints of paused trials. In order for this to work, the scheduler needs to implement trials_checkpoints_can_be_removed().

on_tuning_start(tuner)[source]

Called at start of tuning loop

Parameters:

tunerTuner object

on_loop_end()[source]

Called at end of each tuning loop iteration

This is done before the loop stopping condition is checked and acted upon.

class syne_tune.callbacks.remove_checkpoints_callback.DefaultRemoveCheckpointsSchedulerMixin[source]

Bases: RemoveCheckpointsSchedulerMixin

Implements general case of RemoveCheckpointsSchedulerMixin, where the callback is of type RemoveCheckpointsCallback. This means scheduler has to implement trials_checkpoints_can_be_removed().

trials_checkpoints_can_be_removed()[source]

Supports the general case (see header comment). This method returns IDs of paused trials for which checkpoints can safely be removed. These trials either cannot be resumed anymore, or it is very unlikely they will be resumed. Any trial ID needs to be returned only once, not over and over. If a trial gets stopped (by returning SchedulerDecision.STOP in on_trial_result()), its checkpoint is removed anyway, so its ID does not have to be returned here.

Return type:

List[int]

Returns:

IDs of paused trials for which checkpoints can be removed

callback_for_checkpoint_removal(stop_criterion)[source]
Parameters:

stop_criterion (Callable[[TuningStatus], bool]) – Stopping criterion, as passed to Tuner

Return type:

Optional[TunerCallback]

Returns:

CP removal callback, or None if CP removal is not activated