MCPcopy Create free account
hub / github.com/pytorch/examples / get_latest_checkpoint_folder

Function get_latest_checkpoint_folder

distributed/FSDP2/checkpoint.py:23–36  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

21
22
23def get_latest_checkpoint_folder(path):
24 max_num = None
25 if not os.path.exists(path):
26 return max_num
27 for name in os.listdir(path):
28 folder_path = os.path.join(path, name)
29 if os.path.isdir(folder_path):
30 try:
31 num = int(name)
32 if max_num is None or num > max_num:
33 max_num = num
34 except ValueError:
35 pass # Skip non-numeric folder names
36 return max_num
37
38
39class Checkpointer:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected