extensible.extensions.checkpoints#
Classes
|
|
|
Loads weights and fixtures at the pre_run stage of a training or evaluation run. |
|
Saves checkpoints containing weights and fixtures at in the |
- class extensible.extensions.checkpoints.CheckpointSaver(path=None, saved_fixtures: Iterable[str] | None = ('epoch_num',), saved_attribs: Iterable[str] | None = None)#
Bases:
CheckpointBase,ExtensionSaves checkpoints containing weights and fixtures at in the
post_train_step_epochstage.- Parameters:
path – The path where all values will be saved.
saved_fixtures – The fixtures to save. By default, only
'epoch_num'is saved.saved_attribs – If not specified, all train manager attributes with a
state_dictattribute will be saved. This usually includes the model, optimizer and learning rate scheduler.
a checkpoint to load. When training, set to
Trueto continue training if any checkpoints exist (training will fail with the default valueFalseif checkpoints exist).- post_train_step_epoch(train_manager, fixtures, epoch_num)#
Save a checkpoint
- class extensible.extensions.checkpoints.CheckpointLoader(path=None, ckpt_spec: int | str | Path = -1, permissive=True)#
Bases:
CheckpointBase,ExtensionLoads weights and fixtures at the pre_run stage of a training or evaluation run.
By default, the last checkpoint is loaded, if any.
- Parameters:
path – The path where checkpoints were saved.
ckpt_spec – A checkpoint file path or epoch number (or
-1for the latest checkpoint) specifying a checkpoint to load weights and fixtures from.permissive – If
ckpt_spec=-1and there are no checkpoints, do not raise an error.
- classmethod load_weights_and_fixtures(ckpt_file, train_manager, fixtures: FixturesDict | None)#
Loads the weights and sets the fixtures from the specified checkpoint file.
- pre_run(train_manager, fixtures)#
Loads the weights and fixtures at a particular checkpoint in preparation for standalone evaluations or for finetuning.
Stages:
load_checkpoint:
fixtures:
load_checkpoint:
bool