finetuner.tuner.callback.training_checkpoint module

class finetuner.tuner.callback.training_checkpoint.TrainingCheckpoint(save_dir, last_k_epochs=1, verbose=False)[source]

Bases: finetuner.tuner.callback.base.BaseCallback

Callback to save model at every epoch or the last K epochs

Parameters
  • save_dir (str) – string, path to save the model file.

  • last_k_epochs (int) – this parameter is an integer. Only the most recent k checkpoints will be kept. Older checkpoints are deleted.

  • verbose (bool) – Whether to log notifications when a checkpoint is saved/deleted.

on_epoch_end(tuner)[source]

Called at the end of an epoch, after both training and validation (or just training if no validaton is provided).

static load(tuner, fp)[source]

Loads the model and tuner state