MCPcopy Create free account
hub / github.com/apple/axlearn / checkpoint_paths

Method checkpoint_paths

axlearn/common/checkpointer.py:1006–1016  ·  view source on GitHub ↗

See `BaseCheckpointer.checkpointer_paths`.

(cls, base_dir: str)

Source from the content-addressed store, hash-verified

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]:

Callers 5

checkpoint_stepsMethod · 0.45

Calls 3

_all_checkpoint_pathsMethod · 0.80
joinMethod · 0.80
mapMethod · 0.80

Tested by 2