[docs]defget_checkpoint_to_resume_training(path:pathlib.Path,)->pathlib.Path:"""Return the best checkpoint file path to resume training from. Parameters ---------- path The base directory containing either the "periodic" checkpoint to start the training session from. Returns ------- pathlib.Path Path to a checkpoint file that exists on disk. Raises ------ FileNotFoundError If none of the checkpoints can be found on the provided directory. """return_get_checkpoint_from_alias(path,"periodic")
[docs]defget_checkpoint_to_run_inference(path:pathlib.Path,)->pathlib.Path:"""Return the best checkpoint file path to run inference with. Parameters ---------- path The base directory containing either the "best", "last" or "periodic" checkpoint to start the training session from. Returns ------- pathlib.Path Path to a checkpoint file that exists on disk. Raises ------ FileNotFoundError If none of the checkpoints can be found on the provided directory. """try:return_get_checkpoint_from_alias(path,"best")exceptFileNotFoundError:logger.error("Did not find lowest-validation-loss model to run inference ""from. Trying to search for the last periodically saved model...",)return_get_checkpoint_from_alias(path,"periodic")