unilab.utils.checkpoint¶
Pure-filesystem log root and checkpoint resolution helpers.
Functions
|
Return the latest model checkpoint inside a run directory. |
|
Return the lexicographically latest run directory under a task log root. |
|
Normalize a raw checkpoint selector value; sentinel values map to |
|
|
|
Resolve a checkpoint from a task log root. |
- unilab.utils.checkpoint.get_latest_run(log_dir)[source]¶
Return the lexicographically latest run directory under a task log root.
- unilab.utils.checkpoint.get_latest_checkpoint(run_dir, *, suffix='.pt')[source]¶
Return the latest model checkpoint inside a run directory.
- unilab.utils.checkpoint.normalize_checkpoint_value(value)[source]¶
Normalize a raw checkpoint selector value; sentinel values map to
None.
- 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_runselects the run:"-1"picks the latest run undertask_log_root; any other value is first tried as a direct path and then relative totask_log_root, and may name either a run directory or a checkpoint file.checkpointoptionally 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).