mednet.utils.checkpointer¶
Module Attributes
Definition of a Checkpoint alias type to make it flexible to user defined metric to monitor. |
|
Standard paths where checkpoints may be (if produced with this framework). |
Functions
Return the best checkpoint file path to resume training from. |
|
|
Return the best checkpoint file path to run inference with. |
- mednet.utils.checkpointer.CheckpointAliasType = str | collections.abc.Callable[[str, str], str]¶
Definition of a Checkpoint alias type to make it flexible to user defined metric to monitor.
- mednet.utils.checkpointer.CHECKPOINT_ALIASES: dict[str, str | Callable[[str, str], str]] = {'best': <function <lambda>>, 'periodic': 'model-at-{epoch}'}¶
Standard paths where checkpoints may be (if produced with this framework).
- mednet.utils.checkpointer.get_checkpoint_to_resume_training(path)[source]¶
Return the best checkpoint file path to resume training from.
- Parameters:
path (
Path) – The base directory containing either the “periodic” checkpoint to start the training session from.- Returns:
Path to a checkpoint file that exists on disk.
- Return type:
- Raises:
FileNotFoundError – If none of the checkpoints can be found on the provided directory.
- mednet.utils.checkpointer.get_checkpoint_to_run_inference(path, metric, mode='min')[source]¶
Return the best checkpoint file path to run inference with.
- Parameters:
- Returns:
Path to a checkpoint file that exists on disk.
- Return type:
- Raises:
FileNotFoundError – If none of the checkpoints can be found on the provided directory.