Skip to content

Commit e7a1f15

Browse files
committed
fix: unittest failure for assertion in non-DP attention path
Signed-off-by: guqiqi <29116997+guqiqi@users.noreply.github.com>
1 parent dbd3976 commit e7a1f15

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/unittest/_torch/modules/moe/test_moe_module.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,9 @@ def _test_moe_worker_impl(
527527
# Setup mapping
528528
mapping = mapping or Mapping()
529529
mapping.rank = mpi_rank()
530-
all_rank_num_tokens = [seq_len] * mapping.world_size
530+
# DP modes need per-rank token counts for cross-rank dispatch; non-DP modes
531+
# (TTP/TEP) have no dispatch and the scheduler derives [x.shape[0]] from None.
532+
all_rank_num_tokens = [seq_len] * mapping.world_size if mapping.enable_attention_dp else None
531533
torch.cuda.set_device(mapping.rank)
532534
_ensure_dist_for_megamoe(moe_backend, mapping.rank, mapping.world_size)
533535

0 commit comments

Comments
 (0)