[Test] Stage-a sanity kits; consolidate core/ + models_e2e/ tests (#25831)

This commit is contained in:
Liangsheng Yin
2026-05-20 01:58:48 -07:00
committed by GitHub
parent 24d27c2035
commit 614672fea5
36 changed files with 570 additions and 637 deletions
@@ -1,42 +0,0 @@
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import CustomTestCase, is_in_ci, run_bench_one_batch
register_cuda_ci(
est_time=120,
stage="base-b",
runner_config="2-gpu-large",
disabled="Temporarily disabled",
)
class TestDummyGrok1(CustomTestCase):
def test_dummy_grok_1(self):
_, output_throughput, _ = run_bench_one_batch(
None,
[
"--model",
"/dummy-grok",
"--tokenizer-path",
"Xenova/grok-1-tokenizer",
"--batch-size",
"2",
"--tp",
"2",
"--quantization",
"fp8",
"--load-format",
"dummy",
"--json-model-override-args",
'{"num_hidden_layers": 2}',
],
)
if is_in_ci():
self.assertGreater(output_throughput, 0)
if __name__ == "__main__":
unittest.main()
@@ -1,109 +0,0 @@
"""End-to-end test for compressed-tensors per-expert FP8 MoE checkpoint
loading on Gemma4 (e.g. RedHatAI/gemma-4-26B-A4B-it-FP8-Dynamic).
Regression coverage for the load_weights path that recognises
`experts.<id>.{gate,up,down}_proj.{weight,weight_scale}` keys and folds
them into SGLang's fused FusedMoE parameters. Without that path, all
routed-expert weights are silently skipped at load time and the model
emits only `<pad>` tokens at inference (GSM8K collapses to 0.0).
"""
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import get_device_sm, kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
# Compressed-tensors per-expert FP8 MoE checkpoint that exercises the
# loader path (gated repo + ~27 GB download + 4 GPUs at TP=4).
register_cuda_ci(est_time=120, stage="base-c", runner_config="4-gpu-h100")
@unittest.skipIf(get_device_sm() < 90, "Test requires CUDA SM 90 or higher")
class TestGemma4FP8PerExpertLoading(CustomTestCase):
"""Three-stage check that catches the silent-skip failure mode:
1. server health
2. completion is not the all-`<pad>` garbage state
3. GSM8K accuracy matches the BF16 baseline
"""
model = "RedHatAI/gemma-4-26B-A4B-it-FP8-Dynamic"
base_url = DEFAULT_URL_FOR_TEST
@classmethod
def setUpClass(cls):
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=[
"--tp",
"4",
"--trust-remote-code",
"--random-seed",
"42",
],
)
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
def test_health(self):
r = requests.get(self.base_url + "/health")
self.assertEqual(r.status_code, 200)
def test_basic_generation_not_garbage(self):
"""Pre-fix the server starts but every routed expert is zero-init,
which leads chat completions to deterministic `<pad>` spam."""
r = requests.post(
self.base_url + "/v1/chat/completions",
json={
"model": self.model,
"messages": [{"role": "user", "content": "What is 7 + 5?"}],
"temperature": 0,
"max_tokens": 32,
},
)
self.assertEqual(r.status_code, 200)
text = r.json()["choices"][0]["message"]["content"]
self.assertNotIn(
"<pad>", text, f"Output looks like the pre-fix garbage state: {text!r}"
)
self.assertGreater(len(text.strip()), 0, "Empty completion")
self.assertIn("12", text, f"Expected the answer to mention '12': {text!r}")
def test_gsm8k_accuracy(self):
"""Pre-fix this scores exactly 0.00 (zero routed-expert weights);
post-fix it matches the BF16 baseline (~0.95 on 20 samples)."""
args = SimpleNamespace(
base_url=self.base_url,
model=self.model,
eval_name="gsm8k",
num_examples=20,
num_threads=16,
)
metrics = run_eval(args)
score = float(metrics["score"])
print(f"Gemma4 FP8 per-expert GSM8K-20 score: {score:.3f}")
# Threshold rules out the failure mode (0.00) while leaving ample
# margin under the BF16 baseline (~0.95).
self.assertGreaterEqual(
score,
0.80,
f"Per-expert FP8 ckpt accuracy collapsed: {score} "
"(pre-fix value is 0.00; BF16 baseline is ~0.95).",
)
if __name__ == "__main__":
unittest.main()
@@ -1,49 +0,0 @@
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
register_cuda_ci(est_time=178, stage="base-b", runner_config="2-gpu-large")
class TestKimiLinear(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.model = "moonshotai/Kimi-Linear-48B-A3B-Instruct"
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=["--tp-size", "2", "--trust-remote"],
)
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
def test_gsm8k(self):
args = SimpleNamespace(
base_url=self.base_url,
model=self.model,
eval_name="gsm8k",
api="completion",
max_tokens=512,
num_examples=200,
num_threads=128,
)
metrics = run_eval(args)
print(f"{metrics=}")
self.assertGreater(metrics["score"], 0.88)
if __name__ == "__main__":
unittest.main()
@@ -1,34 +0,0 @@
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.mmmu_vlm_kit import MMMUMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
from sglang.test.server_fixtures.mmmu_fixture import MMMUServerBase
register_cuda_ci(
est_time=200,
stage="base-b",
runner_config="1-gpu-small",
disabled="Temporarily disabled",
)
MODEL = "mistralai/Ministral-3-3B-Instruct-2512"
class TestMinistral3TextOnly(GSM8KMixin, DefaultServerBase):
gsm8k_accuracy_thres = 0.6
model = MODEL
other_args = ["--trust-remote-code"]
class TestMinistral3MMMU(MMMUMixin, MMMUServerBase):
accuracy = 0.3
model = MODEL
other_args = ["--trust-remote-code"]
mmmu_args = ["--limit=0.1"]
"""`--limit=0.1`: 10 percent of each task - this is fine for testing since the nominal result isn't interesting - this run is just to prevent relative regressions."""
if __name__ == "__main__":
unittest.main()
@@ -1,29 +0,0 @@
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.mmmu_vlm_kit import MMMUMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
from sglang.test.server_fixtures.mmmu_fixture import MMMUServerBase
register_cuda_ci(est_time=200, stage="extra-a", runner_config="2-gpu-large")
MODEL = "mistralai/Mistral-Small-4-119B-2603"
class TestMistralSmall4TextOnly(GSM8KMixin, DefaultServerBase):
gsm8k_accuracy_thres = 0.9
model = MODEL
other_args = ["--tp-size", "2", "--trust-remote-code"]
class TestMistralSmall4MMMU(MMMUMixin, MMMUServerBase):
accuracy = 0.45
model = MODEL
other_args = ["--tp-size", "2", "--trust-remote-code"]
mmmu_args = ["--limit=0.1"]
"""`--limit=0.1`: 10 percent of each task - this is fine for testing since the nominal result isn't interesting - this run is just to prevent relative regressions."""
if __name__ == "__main__":
unittest.main()
@@ -1,34 +0,0 @@
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.lm_eval_kit import LMEvalMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
register_cuda_ci(
est_time=190,
stage="base-b",
runner_config="2-gpu-large",
)
NEMOTRON_3_NANO_THINKING_ARGS = [
"--trust-remote-code",
"--tool-call-parser",
"qwen3_coder",
"--reasoning-parser",
"deepseek-r1",
]
class TestNvidiaNemotron3Nano30BFP8(LMEvalMixin, DefaultServerBase):
"""Test Nemotron-3-Nano-30B FP8 model with lm-eval GSM8K evaluation."""
model = "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8"
model_config_name = "lm_eval_configs/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8.yaml"
other_args = [
"--tp-size",
"2",
] + NEMOTRON_3_NANO_THINKING_ARGS
if __name__ == "__main__":
unittest.main()
@@ -1,34 +0,0 @@
import unittest
from sglang.srt.utils import get_device_sm
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
register_cuda_ci(est_time=500, suite="nightly-4-gpu-b200", nightly=True)
QWEN3_NEXT_MODEL_FP4 = "nvidia/Qwen3-Next-80B-A3B-Instruct-NVFP4"
@unittest.skipIf(
get_device_sm() < 100, "Test requires CUDA SM 100 or higher (Blackwell)"
)
class TestQwen3NextFp4(GSM8KMixin, DefaultServerBase):
model = QWEN3_NEXT_MODEL_FP4
gsm8k_accuracy_thres = 0.93
other_args = [
"--tp-size",
"4",
"--chunked-prefill-size",
"2048",
"--quantization",
"modelopt_fp4",
"--mamba-scheduler-strategy",
"extra_buffer",
"--mamba-track-interval",
"128",
]
if __name__ == "__main__":
unittest.main()