[EPLB] Drop defensive getattr for ep_dispatch_algorithm (#31804)
Co-authored-by: Brayden Zhong <b8zhong@uwaterloo.ca>
This commit is contained in:
co-authored by
Brayden Zhong
parent
df254b0a11
commit
37ebacb50f
@@ -254,8 +254,7 @@ class HashTopK(nn.Module):
|
|||||||
log2phy_prob = None
|
log2phy_prob = None
|
||||||
if (
|
if (
|
||||||
expert_location_dispatch_info is not None
|
expert_location_dispatch_info is not None
|
||||||
and getattr(expert_location_dispatch_info, "ep_dispatch_algorithm", None)
|
and expert_location_dispatch_info.ep_dispatch_algorithm == "lp"
|
||||||
== "lp"
|
|
||||||
):
|
):
|
||||||
if self.layer_id is None:
|
if self.layer_id is None:
|
||||||
raise RuntimeError("HashTopK LP dispatch requires layer_id.")
|
raise RuntimeError("HashTopK LP dispatch requires layer_id.")
|
||||||
|
|||||||
@@ -2147,8 +2147,7 @@ def _post_process_topk_ids(
|
|||||||
log2phy_prob = None
|
log2phy_prob = None
|
||||||
if (
|
if (
|
||||||
expert_location_dispatch_info is not None
|
expert_location_dispatch_info is not None
|
||||||
and getattr(expert_location_dispatch_info, "ep_dispatch_algorithm", None)
|
and expert_location_dispatch_info.ep_dispatch_algorithm == "lp"
|
||||||
== "lp"
|
|
||||||
):
|
):
|
||||||
from sglang.srt.eplb.lplb_solver import get_global_lplb_solver
|
from sglang.srt.eplb.lplb_solver import get_global_lplb_solver
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ class TestWaterfillEPLB(CustomTestCase):
|
|||||||
num_fused_shared_experts=1,
|
num_fused_shared_experts=1,
|
||||||
routed_scaling_factor=1.0,
|
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(
|
def fake_eplb_postprocess(
|
||||||
ids, expert_location_dispatch_info, num_token_non_padded
|
ids, expert_location_dispatch_info, num_token_non_padded
|
||||||
@@ -104,7 +106,9 @@ class TestWaterfillEPLB(CustomTestCase):
|
|||||||
num_fused_shared_experts=1,
|
num_fused_shared_experts=1,
|
||||||
routed_scaling_factor=1.0,
|
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(
|
def fake_eplb_postprocess(
|
||||||
ids, expert_location_dispatch_info, num_token_non_padded
|
ids, expert_location_dispatch_info, num_token_non_padded
|
||||||
|
|||||||
Reference in New Issue
Block a user