drytorch.lib.checkpoints
Module containing classes to save the model state and its optimizer state.
Classes
Abstract class that stores and loads weight for a ModelProtocol class. |
|
|
Manage paths for the experiment. |
|
Manage locally saving and loading the model state and optimizer. |
- class AbstractCheckpoint[source]
Bases:
CheckpointProtocol,ABCAbstract class that stores and loads weight for a ModelProtocol class.
Initialize.
- property model
The registered model to be saved and loaded.
- Raises:
CheckpointNotInitializedError – if no model has been bound.
- load(epoch: int = -1) None[source]
Load the model and optimizer state dictionaries.
- Parameters:
epoch (int) – epoch to load.
- Raises:
ModelNotFoundError – if the model location does not exist.
EpochNotFoundError – if the epoch location does not exist.
- Return type:
None
- bind_model(model: ModelProtocol[Any, Any]) None[source]
Bind the model to manage.
- Parameters:
model (ModelProtocol[Any, Any])
- Return type:
None
- class LocalCheckpoint(par_dir: Path | None = None)[source]
Bases:
AbstractCheckpointManage locally saving and loading the model state and optimizer.
Initialize.
- Parameters:
par_dir (Path | None) – parent directory for experiment data.
- property paths: CheckpointPathManager
Path manager for directories and checkpoints.