latest_checkpoint
Return the file under root matching glob_pattern with the largest key(path), or None.
def latest_checkpoint(
root: pathlib.Path,
glob_pattern: str = "**/last.ckpt",
key: Callable[[pathlib.Path], Any] | None = None
) - > pathlib.Path | None
Return the file under root matching glob_pattern with the largest key(path), or None. By default key is lambda p: p.stat().st_mtime (newest modification time wins). Pass key to rank matches another way (e.g. parse a step from the filename). For example, the Lightning framework would use **/last.ckpt under the tree restored by flyte.Checkpoint.load_sync / flyte.Checkpoint.load. Pass a different glob_pattern for other layouts (e.g. "**/*.ckpt").
Parameters
| Name | Type | Description |
|---|---|---|
| root | pathlib.Path | The root directory to search for checkpoint files. |
| glob_pattern | str = "**/last.ckpt" | The glob pattern to match checkpoint files within the root directory. Defaults to "**/last.ckpt". |
| key | `Callable[[pathlib.Path], Any] | None` = None |
Returns
| Type | Description |
|---|---|
| `pathlib.Path | None` |