See `BaseCheckpointer.checkpointer_paths`.
(cls, base_dir: str)
| 1004 | |
| 1005 | @classmethod |
| 1006 | def checkpoint_paths(cls, base_dir: str) -> list[str]: |
| 1007 | """See `BaseCheckpointer.checkpointer_paths`.""" |
| 1008 | # The default checkpointer commits under "<base_dir>/<step_prefix>_<step>/index". Using a |
| 1009 | # concurrent `exists` check for the index file can be several times faster than `glob` on |
| 1010 | # gcs when there are many checkpoint files, even if using a "native" solution like |
| 1011 | # `google-cloud-python` SDK. |
| 1012 | paths = cls._all_checkpoint_paths(base_dir) |
| 1013 | paths = [os.path.join(path, "index") for path in paths] |
| 1014 | with futures.ThreadPoolExecutor() as pool: |
| 1015 | index_exists = pool.map(fs.exists, paths) |
| 1016 | return [os.path.dirname(path) for path, committed in zip(paths, index_exists) if committed] |
| 1017 | |
| 1018 | @classmethod |
| 1019 | def checkpoint_steps(cls, base_dir: str) -> list[int]: |