CheckpointTrainingCallback

class CheckpointTrainingCallback(schedule: str | CheckpointSchedule | type[CheckpointSchedule] | None = None, schedule_kwargs: Mapping[str, Any] | None = None, keeper: str | CheckpointKeeper | type[CheckpointKeeper] | None = None, keeper_kwargs: Mapping[str, Any] | None = None, root: Path | str | None = None, name_template: str = 'checkpoint_{epoch:07d}.pt')[source]

Bases: TrainingCallback

Save checkpoints at user-specific epochs.

Create callback.

Parameters:
  • schedule (HintOrType[CheckpointSchedule]) – a selection of the checkpoint schedule, cf. pykeen.checkpoints.scheduler_resolver

  • schedule_kwargs (OptionalKwargs) – keyword-based parameters to instantiate the checkpoint schedule, if necessary, cf. pykeen.checkpoints.scheduler_resolver

  • keeper (HintOrType[CheckpointKeeper]) – a selection of the checkpoint retention logic, cf. pykeen.checkpoints.keeper_resolver. None corresponds to keeping all checkpoints (which were created).

  • keeper_kwargs (OptionalKwargs) – keyword-based parameters to instantiate the retention policy, if necessary, cf. pykeen.checkpoints.keeper_resolver

  • root (pathlib.Path | str | None) – the checkpoint root directory. Defaults to a fresh sub-directory of pykeen.constants.PYKEEN_CHECKPOINTS

  • name_template (str) – a name template for the checkpoint file. Can contain a format key {epoch} which is replaced by the actual epoch. This callback does not take care of overwriting existing files, i.e., if you want to keep multiple checkpoints make sure to choose unique filenames.

Methods Summary

post_epoch(epoch, epoch_loss, **kwargs)

Call after epoch.

Methods Documentation

post_epoch(epoch: int, epoch_loss: float, **kwargs: Any) None[source]

Call after epoch.

Parameters:
Return type:

None