final_checkpoints
- final_checkpoints(num_epochs: int = 100, 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) list[int] [source]
Simulate a checkpoint schedule and return the set of epochs for which a checkpoint remains.
>>> final_checkpoints(50) [10, 20, 30, 40, 50] >>> final_checkpoints(50, schedule="explicit", schedule_kwargs=dict(steps=[30, 35])) [30, 35] >>> final_checkpoints( ... 50, ... schedule="union", ... schedule_kwargs=dict( ... bases=["every", "explicit"], ... bases_kwargs=[dict(frequency=15), dict(steps=[7,])], ... ), ... ) [7, 15, 30, 45] >>> final_checkpoints(50, keeper="last", keeper_kwargs=dict(keep=2)) [40, 50] >>> final_checkpoints(50, keeper="modulo", keeper_kwargs=dict(modulo=20)) [20, 40] >>> final_checkpoints(50, keeper="explicit", keeper_kwargs=dict(keep=[15])) [] >>> final_checkpoints( ... 50, ... keeper="union", ... keeper_kwargs=dict( ... bases=["last", "modulo"], ... bases_kwargs=[None, dict(divisor=20)], ... ), ... ) [20, 40, 50]
Warning
You cannot easily inspect schedules which depend on training dynamics, e.g.,
BestCheckpointSchedule
.- Parameters:
num_epochs (int) – the number of epochs
schedule (str | CheckpointSchedule | type[CheckpointSchedule] | None) – a checkpoint schedule instance or selection, cf.
pykeen.checkpoints.scheduler_resolver
schedule_kwargs (Mapping[str, Any] | None) – additional keyword-based parameters when the schedule needs to instantiated first from a selection, cf.
pykeen.checkpoints.scheduler_resolver
keeper (str | CheckpointKeeper | type[CheckpointKeeper] | None) – a checkpoint retention policy instance or selection, cf.
pykeen.checkpoints.keeper_resolver
None corresponds to keeping everything that was checkpointed.keeper_kwargs (Mapping[str, Any] | None) – additional keyword-based parameters when the retention policy needs to instantiated first from a selection, cf.
pykeen.checkpoints.keeper_resolver
- Returns:
a sorted list of epochs at which a checkpoint remains after clean-up.
- Return type: