diff --git a/python/sglang/srt/layers/moe/hash_topk.py b/python/sglang/srt/layers/moe/hash_topk.py index b7befbae9..a9a438909 100644 --- a/python/sglang/srt/layers/moe/hash_topk.py +++ b/python/sglang/srt/layers/moe/hash_topk.py @@ -254,8 +254,7 @@ class HashTopK(nn.Module): log2phy_prob = None if ( expert_location_dispatch_info is not None - and getattr(expert_location_dispatch_info, "ep_dispatch_algorithm", None) - == "lp" + and expert_location_dispatch_info.ep_dispatch_algorithm == "lp" ): if self.layer_id is None: raise RuntimeError("HashTopK LP dispatch requires layer_id.") diff --git a/python/sglang/srt/layers/moe/topk.py b/python/sglang/srt/layers/moe/topk.py index c090ef227..36b8aa92d 100644 --- a/python/sglang/srt/layers/moe/topk.py +++ b/python/sglang/srt/layers/moe/topk.py @@ -2147,8 +2147,7 @@ def _post_process_topk_ids( log2phy_prob = None if ( expert_location_dispatch_info is not None - and getattr(expert_location_dispatch_info, "ep_dispatch_algorithm", None) - == "lp" + and expert_location_dispatch_info.ep_dispatch_algorithm == "lp" ): from sglang.srt.eplb.lplb_solver import get_global_lplb_solver diff --git a/test/registered/unit/eplb/test_waterfill_eplb.py b/test/registered/unit/eplb/test_waterfill_eplb.py index 118ab4a8f..b060bdb20 100644 --- a/test/registered/unit/eplb/test_waterfill_eplb.py +++ b/test/registered/unit/eplb/test_waterfill_eplb.py @@ -64,7 +64,9 @@ class TestWaterfillEPLB(CustomTestCase): num_fused_shared_experts=1, routed_scaling_factor=1.0, ) - dispatch_info = SimpleNamespace(num_physical_experts=264) + dispatch_info = SimpleNamespace( + num_physical_experts=264, ep_dispatch_algorithm="static" + ) def fake_eplb_postprocess( ids, expert_location_dispatch_info, num_token_non_padded @@ -104,7 +106,9 @@ class TestWaterfillEPLB(CustomTestCase): num_fused_shared_experts=1, routed_scaling_factor=1.0, ) - dispatch_info = SimpleNamespace(num_physical_experts=264) + dispatch_info = SimpleNamespace( + num_physical_experts=264, ep_dispatch_algorithm="static" + ) def fake_eplb_postprocess( ids, expert_location_dispatch_info, num_token_non_padded