ckpt_path_from_base_path

lightning_pose.utils.io.ckpt_path_from_base_path(base_path: str, model_name: str, logging_dir_name: str = 'tb_logs/') str | None[source]

Given a path to a hydra output with trained model, extract the model .ckpt file.

Prioritizes the checkpoint marked with β€˜-best.ckpt’ in the latest version directory. If no β€˜best’ checkpoint is found, falls back to the latest checkpoint (highest step count). If only one checkpoint exists, returns it directly.

Parameters:
  • base_path (str) – path to a folder with logs and checkpoint. for example, function will search base_path/logging_dir_name/model_name…

  • model_name (str) – the name you gave your model before training it; appears as model_name in lightning-pose/scripts/config/model_params.yaml

  • logging_dir_name (str, optional) – name of the folder in logs, controlled in train_hydra.py Defaults to β€œtb_logs/”.

Returns:

path to model checkpoint, or None if none found.

Return type:

str

Raises:

ValueError – If multiple β€˜best’ checkpoint files are found (e.g., from save_top_k > 1).