Skip to content

Commit e6369b1

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 2e959a0 commit e6369b1

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
@@ -521,7 +521,9 @@ def _test_moe_worker_impl(
521521
# Setup mapping
522522
mapping = mapping or Mapping()
523523
mapping.rank = mpi_rank()
524-
all_rank_num_tokens = [seq_len] * mapping.world_size
524+
# DP modes need per-rank token counts for cross-rank dispatch; non-DP modes
525+
# (TTP/TEP) have no dispatch and the scheduler derives [x.shape[0]] from None.
526+
all_rank_num_tokens = [seq_len] * mapping.world_size if mapping.enable_attention_dp else None
525527
torch.cuda.set_device(mapping.rank)
526528
_ensure_dist_for_megamoe(moe_backend, mapping.rank, mapping.world_size)
527529

0 commit comments

Comments
 (0)