Skip to content

Commit 772faca

Browse files
committed
Merge branch 'ko3n1g/ci/flaky-marker' into 'main'
tests: Use flaky instead of skip marker See merge request ADLR/megatron-lm!2208
2 parents 47bb8d1 + 8c018ca commit 772faca

File tree

12 files changed

+19
-17
lines changed

12 files changed

+19
-17
lines changed

.gitlab/stages/01.tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ unit_tests:
119119
ARGS=()
120120
if [[ $TAG != latest ]]; then
121121
ARGS+=(-m "not internal")
122+
else
123+
ARGS+=(-m "not flaky")
122124
fi
123125
if [[ $IMAGE == ${CI_MCORE_DEV_IMAGE} ]]; then
124126
ARGS+=(-m "experimental")

tests/unit_tests/data/test_bin_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class _LocalClientError(Exception):
8989
setattr(exceptions, "ClientError", _LocalClientError)
9090

9191

92-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
92+
@pytest.mark.flaky
9393
def test_bin_reader():
9494
with tempfile.TemporaryDirectory() as temp_dir:
9595
# set the default nltk data path

tests/unit_tests/data/test_gpt_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def sample_N(dataset, N, randomize):
2626
return samples
2727

2828

29-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
29+
@pytest.mark.flaky
3030
def test_mock_gpt_dataset():
3131
if torch.distributed.is_available():
3232
Utils.initialize_distributed()

tests/unit_tests/data/test_preprocess_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def gpt2_merge(odir):
183183
return path
184184

185185

186-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
186+
@pytest.mark.flaky
187187
def test_preprocess_data_gpt():
188188
with tempfile.TemporaryDirectory() as temp_dir:
189189

@@ -214,7 +214,7 @@ def bert_vocab(odir):
214214
return path
215215

216216

217-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
217+
@pytest.mark.flaky
218218
def test_preprocess_data_bert():
219219
with tempfile.TemporaryDirectory() as temp_dir:
220220

tests/unit_tests/dist_checkpointing/models/test_mamba.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class TestMambaReconfiguration:
7474
# (False, (1, 1, 4), (8, 1, 1), True),
7575
],
7676
)
77-
@pytest.mark.skip(reason="Flaky test; needs to be debugged")
77+
@pytest.mark.flaky
7878
def test_parallel_reconfiguration_e2e(
7979
self, tmp_path_dist_ckpt, src_tp_pp_exp, dest_tp_pp_exp, use_glu, use_fpsl
8080
):

tests/unit_tests/dist_checkpointing/test_fp8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_ten(dtype: str = 'fp8'):
5151
(False, (2, 4), (2, 4), None),
5252
],
5353
)
54-
@pytest.mark.skip(reason="Flaky test")
54+
@pytest.mark.flaky
5555
def test_fp8_save_load(
5656
self, tmp_path_dist_ckpt, use_fpsl, src_tp_pp, dest_tp_pp, load_exchange_algo
5757
):

tests/unit_tests/dist_checkpointing/test_fully_parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ def test_load_distribution(self, parallelization_along_dp, tmp_path_dist_ckpt):
280280

281281
assert loaded_state_dict.keys() == state_dict.keys()
282282

283-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
284283
@pytest.mark.parametrize('state_dict_device', ['cpu', 'cuda'])
284+
@pytest.mark.flaky
285285
def test_memory_usage(self, state_dict_device, tmp_path_dist_ckpt):
286286
Utils.initialize_model_parallel(2, 1)
287287

tests/unit_tests/dist_checkpointing/test_nonpersistent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def teardown_method(self, method):
2929
Utils.destroy_model_parallel()
3030

3131
@pytest.mark.parametrize(('tp,pp'), [(2, 4)])
32-
@pytest.mark.skip(reason="Flaky test")
32+
@pytest.mark.flaky
3333
def test_basic_save_load_scenarios(self, tmp_path_dist_ckpt, tp, pp):
3434
Utils.initialize_model_parallel(tp, pp)
3535
num_floating_point_operations_so_far = 0
@@ -118,7 +118,7 @@ def test_basic_save_load_scenarios(self, tmp_path_dist_ckpt, tp, pp):
118118

119119
class TestLegacySaveAndLoad:
120120
@pytest.mark.parametrize(('tp,pp'), [(2, 4)])
121-
@pytest.mark.skip(reason="Flaky test")
121+
@pytest.mark.flaky
122122
def test_basic_save_load_scenario(self, tmp_path_dist_ckpt, tp, pp):
123123
Utils.initialize_model_parallel(tp, pp)
124124
num_floating_point_operations_so_far = 0

tests/unit_tests/dist_checkpointing/test_optimizer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def teardown_method(self, method):
178178
# ((2, 1), 2, 2),
179179
],
180180
)
181-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
181+
@pytest.mark.flaky
182182
def test_dp_sharding(self, tmp_path_dist_ckpt, tp_pp, src_dp, dest_dp, use_fpsl, initialize_fn):
183183
src_world_size = tp_pp[0] * tp_pp[1] * src_dp
184184
dest_world_size = tp_pp[0] * tp_pp[1] * dest_dp
@@ -256,7 +256,7 @@ def test_dp_sharding(self, tmp_path_dist_ckpt, tp_pp, src_dp, dest_dp, use_fpsl,
256256
('src_tp_pp', 'dest_tp_pp', 'use_glu'),
257257
[((2, 2), (2, 4), False), ((1, 8), (4, 1), True), ((2, 4), (4, 2), False)],
258258
)
259-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
259+
@pytest.mark.flaky
260260
def test_finetune_doesnt_load_optimizer(
261261
self, tmp_path_dist_ckpt, src_tp_pp, dest_tp_pp, use_glu
262262
):
@@ -329,7 +329,7 @@ def test_finetune_doesnt_load_optimizer(
329329
assert not diffs[0] and not diffs[1] and diffs[2]
330330
assert not any(diff(optimizer.state_dict(), optim_unloaded_state_dict))
331331

332-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
332+
@pytest.mark.flaky
333333
def test_can_load_deprecated_bucket_space_format(self, tmp_path_dist_ckpt):
334334
# sync=True to make sure other ranks wait for rank 0 to finish creating directory.
335335
tp = 4
@@ -398,7 +398,7 @@ def teardown_method(self, method):
398398
@pytest.mark.parametrize(
399399
('src_tp_pp', 'dest_tp_pp'), [((2, 4), (2, 4)), ((2, 4), (4, 2)), ((8, 1), (1, 2))]
400400
)
401-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
401+
@pytest.mark.flaky
402402
def test_fp32_optimizer_resharding(self, tmp_path_dist_ckpt, src_tp_pp, dest_tp_pp):
403403
# sync=True to make sure other ranks wait for rank 0 to finish creating directory.
404404
Utils.initialize_model_parallel(*src_tp_pp)
@@ -465,7 +465,7 @@ def teardown_method(self, method):
465465
('src_tp_pp', 'dest_tp_pp'),
466466
[((2, 4), (2, 4)), ((2, 4), (2, 2)), ((2, 4), (4, 2)), ((8, 1), (1, 2))],
467467
)
468-
@pytest.mark.skip(reason="Tests are flaky and need to be debugged")
468+
@pytest.mark.flaky
469469
def test_optimizer_resharding(
470470
self, tmp_path_dist_ckpt, src_tp_pp, dest_tp_pp, use_dist_opt, bf16
471471
):

tests/unit_tests/distributed/test_param_and_grad_buffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_model_and_buffers(
5858
@pytest.mark.parametrize("use_distributed_optimizer", [False, True])
5959
@pytest.mark.parametrize("bias", [False, True])
6060
@pytest.mark.parametrize("shared_embedding", [False, True])
61-
@pytest.mark.skip(reason="Flaky test")
61+
@pytest.mark.flaky
6262
def test_bucket_sizes(
6363
bucket_size: Optional[int], use_distributed_optimizer: bool, bias: bool, shared_embedding: bool
6464
):

0 commit comments

Comments
 (0)