MCPcopy
hub / github.com/deepspeedai/DeepSpeed / test_get_optim_files

Function test_get_optim_files

tests/unit/utils/test_get_optim_files.py:12–22  ·  view source on GitHub ↗
(tmpdir, num_checkpoints)

Source from the content-addressed store, hash-verified

10
11@pytest.mark.parametrize('num_checkpoints', [1, 2, 12, 24])
12def test_get_optim_files(tmpdir, num_checkpoints):
13 saved_files = []
14 for i in range(num_checkpoints):
15 file_name = "zero_" + str(i) + "_optim_states.pt"
16 path_name = os.path.join(tmpdir, file_name)
17 saved_files.append(path_name)
18 with open(path_name, "w") as f:
19 f.write(file_name)
20 loaded_files = get_optim_files(tmpdir)
21 for lf, sf in zip(loaded_files, saved_files):
22 assert lf == sf

Callers

nothing calls this directly

Calls 3

get_optim_filesFunction · 0.90
appendMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…