From fe386acae6c5541451c4bae36fef330fab333752 Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Mon, 26 May 2025 23:42:49 +0800 Subject: [PATCH] Automatically configure for EPLB-related args (#6628) --- python/sglang/srt/server_args.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index 8ac4fe494..9dba0bb97 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -366,12 +366,28 @@ class ServerArgs: "Pipeline parallelism is incompatible with overlap schedule." ) + if self.enable_eplb and (self.expert_distribution_recorder_mode is None): + self.expert_distribution_recorder_mode = "stat" + logger.info( + f"EPLB is enabled. The expert_distribution_recorder_mode is automatically set." + ) + + if (self.enable_eplb or (self.init_expert_location is not None)) and ( + self.ep_dispatch_algorithm is None + ): + self.ep_dispatch_algorithm = "static" + logger.info( + f"EPLB is enabled or init_expert_location is provided. ep_dispatch_algorithm is configured." + ) + + if self.enable_expert_distribution_metrics and ( + self.expert_distribution_recorder_mode is None + ): + self.expert_distribution_recorder_mode = "stat" + if self.expert_distribution_recorder_buffer_size is None: - # TODO pr-chain: enable this later - # if (x := self.eplb_rebalance_num_iterations) is not None: - # self.expert_distribution_recorder_buffer_size = x - if False: - pass + if (x := self.eplb_rebalance_num_iterations) is not None: + self.expert_distribution_recorder_buffer_size = x elif self.expert_distribution_recorder_mode is not None: self.expert_distribution_recorder_buffer_size = 1000