BestCheckpointKeeper

class BestCheckpointKeeper(result_tracker: ResultTracker, metric_selection: MetricSelection)[source]

Bases: CheckpointKeeper

Keep checkpoints for steps that achieved the best value for a metric.

Attributes Summary

metric_selection

the metric selection

result_tracker

the result tracker which receives updates on metrics since the same tracker instance needs to receive results from the training loop, we do require a pre-instantiated one rather than offering to provide hints, too

Methods Summary

__call__(steps)

Iterate over the steps for which checkpoints should be kept.

Attributes Documentation

Parameters:
metric_selection: MetricSelection = <dataclasses._MISSING_TYPE object>

the metric selection

result_tracker: ResultTracker = <dataclasses._MISSING_TYPE object>

the result tracker which receives updates on metrics since the same tracker instance needs to receive results from the training loop, we do require a pre-instantiated one rather than offering to provide hints, too

Methods Documentation

__call__(steps: Sequence[int]) Iterator[int][source]

Iterate over the steps for which checkpoints should be kept.

Parameters:

steps (Sequence[int]) – the sorted list of steps at which checkpoints were written.

Yields:

the steps for which checkpoints should be kept

Return type:

Iterator[int]

# noqa:DAR302