MCPcopy
hub / github.com/huggingface/transformers / get_last_checkpoint

Function get_last_checkpoint

src/transformers/trainer_utils.py:270–279  ·  view source on GitHub ↗
(folder)

Source from the content-addressed store, hash-verified

268
269
270def get_last_checkpoint(folder):
271 content = os.listdir(folder)
272 checkpoints = [
273 path
274 for path in content
275 if _re_checkpoint.search(path) is not None and os.path.isdir(os.path.join(folder, path))
276 ]
277 if len(checkpoints) == 0:
278 return
279 return os.path.join(folder, max(checkpoints, key=lambda x: int(_re_checkpoint.search(x).groups()[0])))
280
281
282def sort_checkpoints(

Callers 5

test_save_checkpointsMethod · 0.90
trainMethod · 0.85

Calls 1

joinMethod · 0.80