[v0.11.0][Bugfix] fix sleepmode level2 e2e test (#4023)
<!-- Thanks for sending a pull request! BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing/overview.html --> ### What this PR does / why we need it? <!-- - Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. If possible, please consider writing useful notes for better and faster reviews in your PR. - Please clarify why the changes are needed. For instance, the use case and bug description. - Fixes # --> fix sleepmode level2 e2e test ### Does this PR introduce _any_ user-facing change? <!-- Note that it means *any* user-facing change including all aspects such as API, interface or other behavior changes. Documentation-only updates are not considered user-facing changes. --> no ### How was this patch tested? <!-- CI passed with new added/existing test. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> use e2e tests Signed-off-by: wangx700 <wangxin700@huawei.com>
This commit is contained in:
3
.github/workflows/_e2e_test.yaml
vendored
3
.github/workflows/_e2e_test.yaml
vendored
@@ -177,8 +177,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pytest -sv tests/e2e/multicard/test_data_parallel.py
|
pytest -sv tests/e2e/multicard/test_data_parallel.py
|
||||||
pytest -sv tests/e2e/multicard/test_expert_parallel.py
|
pytest -sv tests/e2e/multicard/test_expert_parallel.py
|
||||||
# FixMe
|
pytest -sv tests/e2e/multicard/test_external_launcher.py
|
||||||
#pytest -sv tests/e2e/multicard/test_external_launcher.py
|
|
||||||
pytest -sv tests/e2e/multicard/test_single_request_aclgraph.py
|
pytest -sv tests/e2e/multicard/test_single_request_aclgraph.py
|
||||||
pytest -sv tests/e2e/multicard/test_fused_moe_allgather_ep.py
|
pytest -sv tests/e2e/multicard/test_fused_moe_allgather_ep.py
|
||||||
pytest -sv tests/e2e/multicard/test_ilama_lora_tp2.py
|
pytest -sv tests/e2e/multicard/test_ilama_lora_tp2.py
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ def test_moe_external_launcher(model):
|
|||||||
assert proc.returncode == 0
|
assert proc.returncode == 0
|
||||||
|
|
||||||
|
|
||||||
|
@patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_NZ": "0"})
|
||||||
def test_external_launcher_and_sleepmode():
|
def test_external_launcher_and_sleepmode():
|
||||||
script = Path(
|
script = Path(
|
||||||
__file__
|
__file__
|
||||||
@@ -154,6 +155,7 @@ def test_external_launcher_and_sleepmode():
|
|||||||
assert proc.returncode == 0
|
assert proc.returncode == 0
|
||||||
|
|
||||||
|
|
||||||
|
@patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_NZ": "0"})
|
||||||
def test_external_launcher_and_sleepmode_level2():
|
def test_external_launcher_and_sleepmode_level2():
|
||||||
script = Path(
|
script = Path(
|
||||||
__file__
|
__file__
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
|
import os
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from vllm import SamplingParams
|
from vllm import SamplingParams
|
||||||
@@ -66,6 +68,7 @@ def test_basic_camem():
|
|||||||
|
|
||||||
|
|
||||||
@fork_new_process_for_each_test
|
@fork_new_process_for_each_test
|
||||||
|
@patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_NZ": "0"})
|
||||||
def test_end_to_end():
|
def test_end_to_end():
|
||||||
free, total = torch.npu.mem_get_info()
|
free, total = torch.npu.mem_get_info()
|
||||||
used_bytes_baseline = total - free # in case other process is running
|
used_bytes_baseline = total - free # in case other process is running
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
@@ -246,6 +247,7 @@ class TestNPUWorker(TestBase):
|
|||||||
|
|
||||||
@patch("vllm_ascend.worker.worker_v1.sleep_mode_enabled")
|
@patch("vllm_ascend.worker.worker_v1.sleep_mode_enabled")
|
||||||
@patch("vllm_ascend.worker.worker_v1.CaMemAllocator")
|
@patch("vllm_ascend.worker.worker_v1.CaMemAllocator")
|
||||||
|
@patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_NZ": "0"})
|
||||||
def test_wake_up_mode_enabled(self, mock_allocator_class,
|
def test_wake_up_mode_enabled(self, mock_allocator_class,
|
||||||
mock_sleep_mode_enabled):
|
mock_sleep_mode_enabled):
|
||||||
"""Test wake_up method when sleep mode is enabled"""
|
"""Test wake_up method when sleep mode is enabled"""
|
||||||
@@ -268,6 +270,7 @@ class TestNPUWorker(TestBase):
|
|||||||
mock_allocator.wake_up.assert_called_once_with(tags=["test_tag"])
|
mock_allocator.wake_up.assert_called_once_with(tags=["test_tag"])
|
||||||
|
|
||||||
@patch("vllm_ascend.worker.worker_v1.sleep_mode_enabled")
|
@patch("vllm_ascend.worker.worker_v1.sleep_mode_enabled")
|
||||||
|
@patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_NZ": "0"})
|
||||||
def test_wake_up_mode_disabled_raises_error(self, mock_sleep_mode_enabled):
|
def test_wake_up_mode_disabled_raises_error(self, mock_sleep_mode_enabled):
|
||||||
"""Test wake_up method raises exception when sleep mode is disabled"""
|
"""Test wake_up method raises exception when sleep mode is disabled"""
|
||||||
from vllm_ascend.worker.worker_v1 import NPUWorker
|
from vllm_ascend.worker.worker_v1 import NPUWorker
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ from vllm_ascend.cpu_binding import bind_cpus
|
|||||||
from vllm_ascend.device_allocator.camem import CaMemAllocator
|
from vllm_ascend.device_allocator.camem import CaMemAllocator
|
||||||
from vllm_ascend.distributed.parallel_state import init_ascend_model_parallel
|
from vllm_ascend.distributed.parallel_state import init_ascend_model_parallel
|
||||||
from vllm_ascend.platform import NPUPlatform
|
from vllm_ascend.platform import NPUPlatform
|
||||||
from vllm_ascend.utils import (init_ascend_soc_version,
|
from vllm_ascend.utils import (init_ascend_soc_version, is_enable_nz,
|
||||||
register_ascend_customop, sleep_mode_enabled,
|
register_ascend_customop, sleep_mode_enabled,
|
||||||
try_register_lib)
|
try_register_lib)
|
||||||
from vllm_ascend.worker.model_runner_v1 import NPUModelRunner
|
from vllm_ascend.worker.model_runner_v1 import NPUModelRunner
|
||||||
@@ -178,6 +178,11 @@ class NPUWorker(WorkerBase):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Sleep mode is not enabled. Please compile vllm-ascend with COMPILE_CUSTOM_KERNELS=1."
|
"Sleep mode is not enabled. Please compile vllm-ascend with COMPILE_CUSTOM_KERNELS=1."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if is_enable_nz():
|
||||||
|
raise ValueError(
|
||||||
|
"FRACTAL_NZ mode is enabled. This may cause model parameter precision issues "
|
||||||
|
"in the RL scenarios. Please set VLLM_ASCEND_ENABLE_NZ=0.")
|
||||||
allocator = CaMemAllocator.get_instance()
|
allocator = CaMemAllocator.get_instance()
|
||||||
allocator.wake_up(tags=tags)
|
allocator.wake_up(tags=tags)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user