Skip to content

Commit fefdc38

Browse files
committed
fix: add validation for expert parallelism settings
Add validation to prevent simultaneous use of `--enable-expert-parallel` and `expert-tensor-parallel-size` configurations. These settings are mutually exclusive. Implementing this check prevents unexpected behavior and improves error tracing. If both settings are enabled concurrently, the system now throws an error, making it easier to identify and resolve configuration issues. Signed-off-by: Jade Zheng <[email protected]>
1 parent e72f94e commit fefdc38

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

vllm_ascend/ascend_config.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
from typing import Optional
16+
from typing import Optional, TYPE_CHECKING
1717

1818
import vllm.envs as envs
1919
from vllm.logger import logger
2020

21+
if TYPE_CHECKING:
22+
from vllm.config import VllmConfig
23+
2124

2225
class AscendConfig:
2326
"""
@@ -112,7 +115,7 @@ def get_ascend_config():
112115
return _ASCEND_CONFIG
113116

114117

115-
def check_ascend_config(vllm_config, enforce_eager):
118+
def check_ascend_config(vllm_config: "VllmConfig", enforce_eager):
116119
ascend_config = get_ascend_config()
117120

118121
# for v0 engine
@@ -164,3 +167,11 @@ def check_ascend_config(vllm_config, enforce_eager):
164167
"ACL Graph is currently experimental. Please "
165168
"raise an issue on https://github.com/vllm-project/vllm-ascend/issues"
166169
" if you encourage any Error")
170+
171+
# for expert parallelism
172+
if vllm_config.parallel_config.enable_expert_parallel and \
173+
ascend_config.expert_tensor_parallel_size > 0:
174+
raise RuntimeError(
175+
"Cannot set `--enable-expert-parallel` and "
176+
"`expert_tensor_parallel_size` at the same time. "
177+
)

0 commit comments

Comments
 (0)