Skip to content

Commit c848da0

Browse files
845473182白永斌gemini-code-assist[bot]
authored
[Bugfix] fix nightly multi-node EPLB tests' "DYNAMIC_EPLB=true" environment not working (#4223)
### What this PR does / why we need it? fix nightly multi-node EPLB tests by adjusting vllm_ascend\eplb\core\eplb_utils.py dynamic_eplb gate checking ### Does this PR introduce _any_ user-facing change? no - vLLM version: v0.11.0 - vLLM main: vllm-project/vllm@2918c1b --------- Signed-off-by: 白永斌 <baiyongbin3@h-partners.com> Signed-off-by: 欧派果奶我还要 <47294568+845473182@users.noreply.github.com> Co-authored-by: 白永斌 <baiyongbin3@h-partners.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent a3e9673 commit c848da0

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

tests/ut/eplb/core/test_eplb_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,36 @@ def test_check_dynamic_eplb_value_error_env_not_set(self, monkeypatch):
128128
with pytest.raises(
129129
ValueError,
130130
match=
131-
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
131+
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
132132
):
133133
EPLBParamUtils.check_dynamic_eplb(True)
134134

135135
monkeypatch.setenv("DYNAMIC_EPLB", "false")
136136
with pytest.raises(
137137
ValueError,
138138
match=
139-
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
139+
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
140140
):
141141
EPLBParamUtils.check_dynamic_eplb(True)
142142

143143
monkeypatch.setenv("DYNAMIC_EPLB", "any_other_value")
144144
with pytest.raises(
145145
ValueError,
146146
match=
147-
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
147+
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
148148
):
149149
EPLBParamUtils.check_dynamic_eplb(True)
150150

151151
def test_check_dynamic_eplb_valid_with_env_set(self, monkeypatch):
152152
monkeypatch.setenv("DYNAMIC_EPLB", "true")
153153
EPLBParamUtils.check_dynamic_eplb(True)
154154

155+
monkeypatch.setenv("DYNAMIC_EPLB", "True")
156+
EPLBParamUtils.check_dynamic_eplb(True)
157+
158+
monkeypatch.setenv("DYNAMIC_EPLB", "1")
159+
EPLBParamUtils.check_dynamic_eplb(True)
160+
155161
def test_check_expert_map_path_none(self):
156162
EPLBParamUtils.check_expert_map_path(None)
157163

vllm_ascend/envs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@
172172
lambda: int(os.getenv("VLLM_ASCEND_ENABLE_NZ", 1)),
173173
# Decide whether we should enable CP parallelism.
174174
"VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL":
175-
lambda: bool(int(os.getenv("VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL", '0')))
175+
lambda: bool(int(os.getenv("VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL", '0'))),
176+
# Whether to anbale dynamic EPLB
177+
"DYNAMIC_EPLB":
178+
lambda: os.getenv("DYNAMIC_EPLB", "false").lower(),
176179
}
177180

178181
# end-env-vars-definition

vllm_ascend/eplb/core/eplb_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import torch
2323
from vllm.logger import logger
2424

25+
import vllm_ascend.envs as envs_ascend
26+
2527

2628
def determine_default_expert_map(global_expert_num, world_size, rank_id,
2729
global_redundant_expert_num):
@@ -140,9 +142,10 @@ def check_dynamic_eplb(dynamic_eplb):
140142
return
141143
if not isinstance(dynamic_eplb, bool):
142144
raise TypeError("The dynamic_eplb is not bool.")
143-
if dynamic_eplb and os.getenv("DYNAMIC_EPLB", "false") != "true":
145+
146+
if dynamic_eplb and envs_ascend.DYNAMIC_EPLB not in ("true", "1"):
144147
raise ValueError(
145-
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
148+
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
146149
)
147150

148151
@staticmethod

vllm_ascend/patch/platform/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import os
1818

19+
import vllm_ascend.envs as envs_ascend
1920
import vllm_ascend.patch.platform.patch_config # noqa
2021
import vllm_ascend.patch.platform.patch_distributed # noqa
2122
import vllm_ascend.patch.platform.patch_mamba_config # noqa
2223
import vllm_ascend.patch.platform.patch_sched_yield # noqa
2324

24-
if os.getenv("DYNAMIC_EPLB", "false") == "true" or os.getenv(
25+
if envs_ascend.DYNAMIC_EPLB not in ("true", "1") or os.getenv(
2526
"EXPERT_MAP_RECORD", "false") == "true":
2627
import vllm_ascend.patch.platform.patch_multiproc_executor # noqa

0 commit comments

Comments
 (0)