CkptMixin¶
- class torch_ecg.utils.CkptMixin[source]¶
Bases:
object
Mixin class for loading from checkpoint class methods
- classmethod from_checkpoint(path: str | bytes | PathLike, device: device | None = None) Tuple[Module, dict] [source]¶
Load a model from a checkpoint.
- Parameters:
path (path-like) – Path of the checkpoint.
device (torch.device, optional) – Map location of the model parameters, defaults to “cuda” if available, otherwise “cpu”.
- Returns:
model (torch.nn.Module) – The model loaded from a checkpoint.
aux_config (dict) – Auxiliary configs that are needed for data preprocessing, etc.