unilab.utils.checkpoint.resolve_checkpoint_path

unilab.utils.checkpoint.resolve_checkpoint_path(task_log_root, load_run, *, checkpoint=None, suffix='.pt')[source]

Resolve a checkpoint from a task log root.

load_run selects the run: "-1" picks the latest run under task_log_root; any other value is first tried as a direct path and then relative to task_log_root, and may name either a run directory or a checkpoint file. checkpoint optionally selects one checkpoint inside the resolved run (an iteration number or a filename).

Returns (checkpoint_path, run_dir). A resolved run that lacks the requested (or any) checkpoint yields (None, run_dir); an unresolvable run yields (None, None).

Parameters:
Return type:

tuple[Path | None, Path | None]