ksuit.callbacks.checkpoint_callbacks.best_checkpoint

Classes

BestCheckpointCallback

Callback to save the best model based on a metric.

Module Contents

class ksuit.callbacks.checkpoint_callbacks.best_checkpoint.BestCheckpointCallback(callback_config, **kwargs)

Bases: ksuit.callbacks.PeriodicCallback

Callback to save the best model based on a metric.

Initializes the BestCheckpointCallback.

Parameters:
  • callback_config (ksuit.schemas.callbacks.BestMetricCallbackConfig) – The configuration for the callback. Implements the BestMetricCallbackConfig schema.

  • **kwargs – additional arguments passed to the parent class.

metric_key
model_names
higher_is_better
best_metric_value
save_frozen_weights
tolerances_is_exceeded
tolerance_counter = 0
metric_at_exceeded_tolerance
state_dict()

Returns the state of the callback.

Return type:

dict[str, Any]

load_state_dict(state_dict)

Loads the state of the callback into the state_dict. Note that this modifies the input state_dict.

Parameters:

state_dict (dict[str, Any])

Return type:

None