def find_model_local_ckpt_path(
    ckpt_path: Optional[_PATH], default_model_registry: Optional[str], default_root_dir: str
) -> str:
    """Find the local checkpoint path for a model."""
    model_registry = _determine_model_name(ckpt_path, default_model_registry)
    local_model_dir = _determine_model_folder(model_registry, default_root_dir)

    # todo: resolve if there are multiple checkpoints
    folder_files = [fn for fn in os.listdir(local_model_dir) if fn.endswith(".ckpt")]
    if not folder_files:
        raise RuntimeError(f"Parsing files from downloaded model: {model_registry}")
    # print(f"local RANK {self.trainer.local_rank}: using model files: {folder_files}")
    return os.path.join(local_model_dir, folder_files[0])
Find the local checkpoint path for a model.
src/lightning/pytorch/utilities/model_registry.py