@@ -275,6 +275,8 @@ def new_router(self, **kwargs):
275275 def teardown_method (self , method ):
276276 Utils .destroy_model_parallel ()
277277
278+ # Shared reinitialization race: https://github.com/NVIDIA/Megatron-LM/issues/7745
279+ @pytest .mark .flaky_in_dev
278280 @pytest .mark .internal
279281 @pytest .mark .skipif (not torch .cuda .is_available (), reason = "CUDA not available" )
280282 @pytest .mark .parametrize (
@@ -383,6 +385,8 @@ def test_seq_aux_loss(self, tp_size, ep_size, cp_size):
383385 torch .testing .assert_close (aux_loss , seq_aux_loss )
384386 torch .testing .assert_close (grad1 , grad2 )
385387
388+ # Shared reinitialization race: https://github.com/NVIDIA/Megatron-LM/issues/7745
389+ @pytest .mark .flaky_in_dev
386390 @pytest .mark .internal
387391 @pytest .mark .skipif (not torch .cuda .is_available (), reason = "CUDA not available" )
388392 @pytest .mark .parametrize ("with_padding" , [False , True ])
@@ -517,6 +521,8 @@ def test_aux_loss_fusion_equivalence(self, aux_type):
517521 torch .testing .assert_close (aux_loss_ref , aux_loss_fused )
518522 torch .testing .assert_close (grad_ref , grad_fused )
519523
524+ # Shared reinitialization race: https://github.com/NVIDIA/Megatron-LM/issues/7745
525+ @pytest .mark .flaky_in_dev
520526 @pytest .mark .skipif (not torch .cuda .is_available (), reason = "CUDA not available" )
521527 @pytest .mark .parametrize (
522528 "tp_size,ep_size,cp_size" , [(8 , 1 , 1 ), (4 , 2 , 1 ), (1 , 1 , 8 ), (2 , 1 , 4 ), (2 , 2 , 2 )]
@@ -599,6 +605,8 @@ def test_global_aux_loss(self, tp_size, ep_size, cp_size):
599605 assert router .ga_steps == 0
600606 assert torch .all (router .global_tokens_per_expert == 0 )
601607
608+ # Shared reinitialization race: https://github.com/NVIDIA/Megatron-LM/issues/7745
609+ @pytest .mark .flaky_in_dev
602610 @pytest .mark .internal
603611 @pytest .mark .skipif (not torch .cuda .is_available (), reason = "CUDA not available" )
604612 @pytest .mark .parametrize (
@@ -655,18 +663,12 @@ def test_combined_aux_loss(self, tp_size, ep_size, cp_size):
655663 assert router .get_aux_loss_coeff ("global_aux_loss" ) == 2.0
656664 assert router .get_aux_loss_coeff ("non_existent_type" ) == 0.0
657665
666+ # Intermittent Gloo timeout: https://github.com/NVIDIA/Megatron-LM/issues/7745
667+ @pytest .mark .flaky_in_dev
658668 @pytest .mark .internal
659669 @pytest .mark .skipif (not torch .cuda .is_available (), reason = "CUDA not available" )
660670 @pytest .mark .parametrize (
661- "tp_size,ep_size,cp_size" ,
662- [
663- # Intermittent Gloo timeout: https://github.com/NVIDIA/Megatron-LM/issues/7745
664- pytest .param (8 , 1 , 1 , marks = pytest .mark .flaky_in_dev ),
665- (4 , 2 , 1 ),
666- (1 , 1 , 8 ),
667- (2 , 1 , 4 ),
668- (2 , 2 , 2 ),
669- ],
671+ "tp_size,ep_size,cp_size" , [(8 , 1 , 1 ), (4 , 2 , 1 ), (1 , 1 , 8 ), (2 , 1 , 4 ), (2 , 2 , 2 )]
670672 )
671673 def test_force_balanced_aux_loss (self , tp_size , ep_size , cp_size ):
672674 """Test if aux loss is 1.0 when using uniform routing"""
0 commit comments