from pathlib import Path

def get_checkpoint_path( log_path: str, run_dir: str = ".*") -> str:
    # Get path to the latest model checkpoint in input directory.
    run_path = Path(log_path) / run_dir
    checkpoints = list(run_path.glob("*.pt"))
    if len(checkpoints) == 0:
        raise ValueError(f"No checkpoints in the directory: '{run_path}'.")
    checkpoints.sort(key=lambda m: f"{m.stem:0>15}")
    return str(checkpoints[-1])