[CI] [NPU] tests: Replace DeepSeek-V2-Lite-W8A8 cases with Moonlight (#43063)

This commit is contained in:
pllimax
2026-10-20 21:35:49 +08:00
committed by GitHub
parent 952c63b1bb
commit e262b44eef
5 changed files with 88 additions and 267 deletions
@@ -1,92 +0,0 @@
import os
import unittest
from types import SimpleNamespace
from urllib.parse import urlparse
from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke
from sglang.test.ci.ci_register import register_npu_ci
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
terminate_and_kill_process_tree,
)
register_npu_ci(est_time=400, suite="base-b-test-4-npu-a3")
register_npu_ci(est_time=400, suite="nightly-4-npu-a3", nightly=True)
TEST_MODEL_MATRIX = {
"/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": {
"accuracy": 0.34,
"latency": 1000,
"output_throughput": 6,
},
}
class TestAscendMlaHicache(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.models = TEST_MODEL_MATRIX.keys()
cls.base_url = DEFAULT_URL_FOR_TEST
cls.url = urlparse(DEFAULT_URL_FOR_TEST)
cls.common_args = [
"--trust-remote-code",
"--mem-fraction-static",
0.8,
"--attention-backend",
"ascend",
"--tp-size",
4,
"--enable-hierarchical-cache",
"--hicache-size",
1 if _is_pr_pipeline else 10,
]
def test_a_gsm8k(self):
for model in self.models:
with self.subTest(model=model):
process = popen_launch_server(
model,
self.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
env={
**os.environ,
"PYTORCH_NPU_ALLOC_CONF": (
"expandable_segments:True,pin_memory_expandable_segments:True"
),
},
other_args=[
*self.common_args,
],
)
try:
if _is_pr_pipeline:
run_npu_pr_smoke(self.base_url)
else:
print(f"##=== Testing accuracy: {model} ===##")
args = SimpleNamespace(
num_shots=5,
data_path=None,
num_questions=1319,
max_new_tokens=512,
parallel=128,
host=self.url.hostname,
port=int(self.url.port),
)
metrics = run_eval_few_shot_gsm8k(args)
self.assertGreaterEqual(
metrics["accuracy"],
TEST_MODEL_MATRIX[model]["accuracy"],
)
finally:
terminate_and_kill_process_tree(process)
if __name__ == "__main__":
unittest.main()
@@ -4,9 +4,11 @@ import requests
from sglang.srt.environ import envs
from sglang.srt.utils import kill_process_tree
from sglang.test.ascend.e2e.test_npu_performance_utils import (
MOONLIGHT_16B_A3B_MODEL_PATH,
)
from sglang.test.ascend.npu_eval_accuracy_kit import NPUGSM8KMixin
from sglang.test.ascend.test_ascend_utils import (
DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH,
IMAGES_EXAMPLE_PATH,
KIMI_VL_A3B_INSTRUCT_WEIGHTS_PATH,
QWEN3_32B_WEIGHTS_PATH,
@@ -26,7 +28,6 @@ from sglang.test.test_utils import (
register_npu_ci(
est_time=400,
suite="base-b-test-4-npu-a3",
disabled="Temporarily disable this test case due to DTS2026091464350",
)
register_npu_ci(est_time=2400, suite="nightly-4-npu-a3", nightly=True)
@@ -76,11 +77,12 @@ class TestDPAttentionMixedChunk(
):
# Use full GSM8K dataset to avoid sampling variance.
gsm8k_num_examples = 1319
gsm8k_accuracy_thres = 0.34
# Moonlight bf16 GSM8K baseline is ~0.837.
gsm8k_accuracy_thres = 0.83
@classmethod
def setUpClass(cls):
cls.model = DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH
cls.model = MOONLIGHT_16B_A3B_MODEL_PATH
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model,
@@ -113,7 +115,7 @@ class TestDPRetract(
):
@classmethod
def setUpClass(cls):
cls.model = DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH
cls.model = MOONLIGHT_16B_A3B_MODEL_PATH
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model,
@@ -0,0 +1,81 @@
import os
import unittest
from sglang.test.ascend.e2e.test_npu_performance_utils import (
MOONLIGHT_16B_A3B_MODEL_PATH,
)
from sglang.test.ascend.npu_eval_accuracy_kit import NPUGSM8KMixin
from sglang.test.ci.ci_register import register_npu_ci
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
terminate_and_kill_process_tree,
)
register_npu_ci(
est_time=800,
suite="base-b-test-2-npu-a3",
)
register_npu_ci(est_time=1400, suite="nightly-2-npu-a3", nightly=True)
# The nightly pipeline is also triggered by pull requests via path filters, so the
# pipeline is identified by GITHUB_WORKFLOW_REF (inherited from the caller's github
# context) instead of the triggering event.
_is_pr_pipeline = "/.github/workflows/nightly-test-npu.yml" not in os.environ.get(
"GITHUB_WORKFLOW_REF", ""
)
class TestAscendMlaFiaHicacheBf16(CustomTestCase, NPUGSM8KMixin):
# The nightly pipeline runs the full GSM8K set to avoid sampling variance; the
# PR pipeline only runs the mixin smoke request.
gsm8k_num_examples = 1319
gsm8k_accuracy_thres = 0.83
@classmethod
def setUpClass(cls):
os.environ["ASCEND_USE_FIA"] = "true"
cls.model = MOONLIGHT_16B_A3B_MODEL_PATH
cls.base_url = DEFAULT_URL_FOR_TEST
other_args = [
"--trust-remote-code",
"--mem-fraction-static",
0.8,
"--attention-backend",
"ascend",
"--device",
"npu",
"--dtype",
"bfloat16",
"--tp-size",
2,
"--enable-hierarchical-cache",
"--hicache-size",
2 if _is_pr_pipeline else 10,
]
# The PR pipeline runs eager to shorten startup; the nightly pipeline
# covers the default decode graph path with FIA + HiCache.
if _is_pr_pipeline:
other_args.append("--disable-cuda-graph")
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
env={
**os.environ,
"PYTORCH_NPU_ALLOC_CONF": (
"expandable_segments:True,pin_memory_expandable_segments:True"
),
},
other_args=other_args,
)
@classmethod
def tearDownClass(cls):
terminate_and_kill_process_tree(cls.process)
if __name__ == "__main__":
unittest.main()
@@ -1,86 +0,0 @@
import os
import unittest
from types import SimpleNamespace
from urllib.parse import urlparse
from sglang.srt.utils import kill_process_tree
from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke
from sglang.test.ci.ci_register import register_npu_ci
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
register_npu_ci(est_time=400, suite="base-b-test-2-npu-a3")
register_npu_ci(est_time=400, suite="nightly-2-npu-a3", nightly=True)
TEST_MODEL_MATRIX = {
"/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": {
"accuracy": 0.34,
"latency": 1000,
"output_throughput": 6,
},
}
class TestAscendMlaW8A8Int8(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.models = TEST_MODEL_MATRIX.keys()
cls.base_url = DEFAULT_URL_FOR_TEST
cls.url = urlparse(DEFAULT_URL_FOR_TEST)
cls.common_args = [
"--trust-remote-code",
"--disable-cuda-graph",
"--mem-fraction-static",
0.8,
"--attention-backend",
"ascend",
"--tp-size",
2,
"--disable-radix-cache",
]
def test_a_gsm8k(self):
os.environ["ASCEND_USE_FIA"] = "true"
for model in self.models:
with self.subTest(model=model):
process = popen_launch_server(
model,
self.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=[
*self.common_args,
],
)
try:
if _is_pr_pipeline:
run_npu_pr_smoke(self.base_url)
else:
print(f"##=== Testing accuracy: {model} ===##")
args = SimpleNamespace(
num_shots=5,
data_path=None,
num_questions=1319,
max_new_tokens=512,
parallel=128,
host=self.url.hostname,
port=int(self.url.port),
)
metrics = run_eval_few_shot_gsm8k(args)
self.assertGreaterEqual(
metrics["accuracy"],
TEST_MODEL_MATRIX[model]["accuracy"],
)
finally:
kill_process_tree(process.pid)
if __name__ == "__main__":
unittest.main()
@@ -1,84 +0,0 @@
import unittest
from types import SimpleNamespace
from urllib.parse import urlparse
from sglang.srt.utils import kill_process_tree
from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke
from sglang.test.ci.ci_register import register_npu_ci
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
register_npu_ci(est_time=400, suite="base-b-test-4-npu-a3")
register_npu_ci(est_time=400, suite="nightly-4-npu-a3", nightly=True)
TEST_MODEL_MATRIX = {
"/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": {
"accuracy": 0.34,
"latency": 1000,
"output_throughput": 6,
},
}
class TestAscendMlaW8A8Int8(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.models = TEST_MODEL_MATRIX.keys()
cls.base_url = DEFAULT_URL_FOR_TEST
cls.url = urlparse(DEFAULT_URL_FOR_TEST)
cls.common_args = [
"--trust-remote-code",
"--disable-cuda-graph",
"--mem-fraction-static",
0.8,
"--attention-backend",
"ascend",
"--tp-size",
4,
"--disable-radix-cache",
]
def test_a_gsm8k(self):
for model in self.models:
with self.subTest(model=model):
process = popen_launch_server(
model,
self.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=[
*self.common_args,
],
)
try:
if _is_pr_pipeline:
run_npu_pr_smoke(self.base_url)
else:
print(f"##=== Testing accuracy: {model} ===##")
args = SimpleNamespace(
num_shots=5,
data_path=None,
num_questions=1319,
max_new_tokens=512,
parallel=128,
host=self.url.hostname,
port=int(self.url.port),
)
metrics = run_eval_few_shot_gsm8k(args)
self.assertGreaterEqual(
metrics["accuracy"],
TEST_MODEL_MATRIX[model]["accuracy"],
)
finally:
kill_process_tree(process.pid)
if __name__ == "__main__":
unittest.main()