[Test] Stage-a sanity kits; consolidate core/ + models_e2e/ tests (#25831)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import unittest
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
@@ -46,7 +46,10 @@ _EAGLE_SPEC_ARGS = [
|
||||
]
|
||||
|
||||
|
||||
class TestDSV4FlashTP4DP4(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashTP4DP4(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""TP4 + DP4 + deepep + EAGLE MTP."""
|
||||
|
||||
@classmethod
|
||||
@@ -79,7 +82,10 @@ class TestDSV4FlashTP4DP4(ServerSanityMixin, CustomTestCase):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
|
||||
class TestDSV4FlashTP4EP(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashTP4EP(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""TP attn + EP MoE (no DP attn) — exercises the DeepEP + TP-attn path."""
|
||||
|
||||
@classmethod
|
||||
@@ -112,7 +118,10 @@ class TestDSV4FlashTP4EP(ServerSanityMixin, CustomTestCase):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
|
||||
class TestDSV4FlashTP4DP4ChunkedPrefillLarge(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashTP4DP4ChunkedPrefillLarge(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""TP4 + DP4 with --chunked-prefill-size 16384 — large chunked prefill."""
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import unittest
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
@@ -19,7 +19,10 @@ DSV4_FLASH_ENV = {
|
||||
}
|
||||
|
||||
|
||||
class TestDSV4FlashTP8NoSpec(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashTP8NoSpec(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""TP8, no spec decoding."""
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Archived test classes split out of test/registered/models/test_nvidia_nemotron_3_nano.py.
|
||||
"""Archived test classes split out of test/registered/models_e2e/test_nvidia_nemotron_3_nano.py.
|
||||
|
||||
Originally registered with `register_cuda_ci(...)`. Moved here as part of
|
||||
the per-commit pruning effort to keep the code reachable manually.
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ CONCURRENCY = 128
|
||||
MAX_TOKENS = 256
|
||||
|
||||
|
||||
class TestGemma4MoeDeterministic(CustomTestCase):
|
||||
class TestGemma4SwaTritonOobRegression(CustomTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = "google/gemma-4-26B-A4B-it"
|
||||
@@ -0,0 +1,74 @@
|
||||
"""Basic sanity: small-but-broad server smoke that downstream stages
|
||||
depend on. Three sanity kits, one shared server, covering protocol
|
||||
contract, decode correctness, and scheduler stress paths."""
|
||||
|
||||
import unittest
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
from sglang.test.kits.basic_api_contract_kit import BasicAPIContractMixin
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.basic_scheduler_stress_kit import BasicSchedulerStressMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_MODEL_NAME_FOR_TEST,
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
popen_launch_server,
|
||||
)
|
||||
|
||||
register_cuda_ci(est_time=120, stage="base-a", runner_config="1-gpu-small")
|
||||
register_amd_ci(est_time=120, suite="stage-a-test-1-gpu-small-amd")
|
||||
|
||||
|
||||
class TestBasicSanity(
|
||||
BasicAPIContractMixin,
|
||||
BasicDecodeCorrectnessMixin,
|
||||
BasicSchedulerStressMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
served_model_name = DEFAULT_MODEL_NAME_FOR_TEST
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.process = popen_launch_server(
|
||||
DEFAULT_MODEL_NAME_FOR_TEST,
|
||||
cls.base_url,
|
||||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
other_args=[
|
||||
"--cuda-graph-max-bs",
|
||||
"4",
|
||||
"--mem-fraction-static",
|
||||
"0.7",
|
||||
"--enable-metrics",
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_accuracy_floor(self):
|
||||
# Stage-a-private accuracy guard: hellaswag via the frontend DSL
|
||||
# bound to this server. Catches systematic regressions that pass
|
||||
# every cheap probe in the mixed-in kits but tank multi-choice
|
||||
# reasoning. Not part of any reusable mixin -- accuracy gating
|
||||
# is the gate test's own responsibility.
|
||||
import sglang as sgl
|
||||
from sglang.test.test_programs import test_hellaswag_select
|
||||
|
||||
sgl.set_default_backend(sgl.RuntimeEndpoint(self.base_url))
|
||||
try:
|
||||
accuracy, _ = test_hellaswag_select()
|
||||
finally:
|
||||
sgl.set_default_backend(None)
|
||||
self.assertGreater(
|
||||
accuracy,
|
||||
0.60,
|
||||
f"hellaswag accuracy floor breached: {accuracy:.3f}",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -25,66 +25,55 @@ register_amd_ci(est_time=77, suite="stage-b-test-1-gpu-small-amd")
|
||||
|
||||
|
||||
class TestEngineChildPids(CustomTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.engine = sgl.Engine(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
random_seed=42,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.engine.shutdown()
|
||||
|
||||
def test_get_all_child_pids_returns_live_pids(self):
|
||||
engine = sgl.Engine(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
random_seed=42,
|
||||
)
|
||||
try:
|
||||
pids = engine.get_all_child_pids()
|
||||
pids = self.engine.get_all_child_pids()
|
||||
|
||||
self.assertIsInstance(pids, list)
|
||||
self.assertGreater(len(pids), 0, "Expected at least one child PID")
|
||||
self.assertIsInstance(pids, list)
|
||||
self.assertGreater(len(pids), 0, "Expected at least one child PID")
|
||||
|
||||
for pid in pids:
|
||||
self.assertIsInstance(pid, int)
|
||||
self.assertTrue(
|
||||
psutil.pid_exists(pid),
|
||||
f"PID {pid} does not correspond to a running process",
|
||||
)
|
||||
for pid in pids:
|
||||
self.assertIsInstance(pid, int)
|
||||
self.assertTrue(
|
||||
psutil.pid_exists(pid),
|
||||
f"PID {pid} does not correspond to a running process",
|
||||
)
|
||||
|
||||
current_proc = psutil.Process(os.getpid())
|
||||
child_pids = {c.pid for c in current_proc.children(recursive=True)}
|
||||
for pid in pids:
|
||||
self.assertIn(
|
||||
pid,
|
||||
child_pids,
|
||||
f"PID {pid} is not a child of the current process",
|
||||
)
|
||||
finally:
|
||||
engine.shutdown()
|
||||
current_proc = psutil.Process(os.getpid())
|
||||
child_pids = {c.pid for c in current_proc.children(recursive=True)}
|
||||
for pid in pids:
|
||||
self.assertIn(
|
||||
pid,
|
||||
child_pids,
|
||||
f"PID {pid} is not a child of the current process",
|
||||
)
|
||||
|
||||
def test_child_pids_include_scheduler_and_detokenizer(self):
|
||||
engine = sgl.Engine(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
random_seed=42,
|
||||
pids = self.engine.get_all_child_pids()
|
||||
# dp_size=1 gives one scheduler + one detokenizer = at least 2 PIDs
|
||||
self.assertGreaterEqual(
|
||||
len(pids),
|
||||
2,
|
||||
"Expected at least 2 child PIDs (scheduler + detokenizer)",
|
||||
)
|
||||
try:
|
||||
pids = engine.get_all_child_pids()
|
||||
# dp_size=1 gives one scheduler + one detokenizer = at least 2 PIDs
|
||||
self.assertGreaterEqual(
|
||||
len(pids),
|
||||
2,
|
||||
"Expected at least 2 child PIDs (scheduler + detokenizer)",
|
||||
)
|
||||
finally:
|
||||
engine.shutdown()
|
||||
|
||||
def test_child_pids_no_duplicates(self):
|
||||
engine = sgl.Engine(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
random_seed=42,
|
||||
pids = self.engine.get_all_child_pids()
|
||||
self.assertEqual(
|
||||
len(pids),
|
||||
len(set(pids)),
|
||||
f"Duplicate PIDs found: {pids}",
|
||||
)
|
||||
try:
|
||||
pids = engine.get_all_child_pids()
|
||||
self.assertEqual(
|
||||
len(pids),
|
||||
len(set(pids)),
|
||||
f"Duplicate PIDs found: {pids}",
|
||||
)
|
||||
finally:
|
||||
engine.shutdown()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -19,29 +19,39 @@ if _is_hip:
|
||||
|
||||
|
||||
class TestHiddenState(CustomTestCase):
|
||||
def test_return_hidden_states(self):
|
||||
prompts = ["Today is", "Today is a sunny day and I like"]
|
||||
model_path = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
||||
input_ids = tokenizer(prompts).input_ids
|
||||
|
||||
sampling_params = {
|
||||
"temperature": 0,
|
||||
"max_new_tokens": 8,
|
||||
}
|
||||
|
||||
engine = sgl.Engine(
|
||||
model_path=model_path,
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model_path = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
|
||||
cls.tokenizer = AutoTokenizer.from_pretrained(cls.model_path)
|
||||
cls.prompts = ["Today is", "Today is a sunny day and I like"]
|
||||
cls.input_ids = cls.tokenizer(cls.prompts).input_ids
|
||||
cls.sampling_params = {"temperature": 0, "max_new_tokens": 8}
|
||||
# mem_fraction_static=0.7 leaves headroom for the HF reference
|
||||
# model that test_return_hidden_states loads on the same GPU.
|
||||
cls.engine = sgl.Engine(
|
||||
model_path=cls.model_path,
|
||||
random_seed=42,
|
||||
skip_tokenizer_init=True,
|
||||
enable_return_hidden_states=True,
|
||||
mem_fraction_static=0.7,
|
||||
)
|
||||
outputs = engine.generate(
|
||||
input_ids=input_ids,
|
||||
sampling_params=sampling_params,
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.engine.shutdown()
|
||||
|
||||
def setUp(self):
|
||||
# Tests share one Engine; flush radix cache so each test sees a
|
||||
# cold prefill (test_return_hidden_states asserts on the prefill
|
||||
# hidden-state shape, which collapses to 0 on a full cache hit).
|
||||
self.engine.flush_cache()
|
||||
|
||||
def test_return_hidden_states(self):
|
||||
outputs = self.engine.generate(
|
||||
input_ids=self.input_ids,
|
||||
sampling_params=self.sampling_params,
|
||||
return_hidden_states=True,
|
||||
)
|
||||
engine.shutdown()
|
||||
|
||||
for output in outputs:
|
||||
self.assertEqual(len(output["meta_info"]["hidden_states"]), 8)
|
||||
@@ -57,10 +67,10 @@ class TestHiddenState(CustomTestCase):
|
||||
)
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_path, torch_dtype=torch.bfloat16, device_map=get_device()
|
||||
self.model_path, torch_dtype=torch.bfloat16, device_map=get_device()
|
||||
)
|
||||
|
||||
for input_id, output in zip(input_ids, outputs):
|
||||
for input_id, output in zip(self.input_ids, outputs):
|
||||
with torch.inference_mode():
|
||||
hf_out = model(
|
||||
torch.tensor(
|
||||
@@ -94,39 +104,22 @@ class TestHiddenState(CustomTestCase):
|
||||
)
|
||||
|
||||
def test_repeatedly_changes_hidden_states(self):
|
||||
prompts = ["Today is", "Today is a sunny day and I like"]
|
||||
model_path = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
||||
input_ids = tokenizer(prompts).input_ids
|
||||
|
||||
sampling_params = {
|
||||
"temperature": 0,
|
||||
"max_new_tokens": 8,
|
||||
}
|
||||
|
||||
engine = sgl.Engine(
|
||||
model_path=model_path,
|
||||
random_seed=42,
|
||||
skip_tokenizer_init=True,
|
||||
enable_return_hidden_states=True,
|
||||
)
|
||||
outputs_completion_first_round = engine.generate(
|
||||
input_ids=input_ids,
|
||||
sampling_params=sampling_params,
|
||||
outputs_completion_first_round = self.engine.generate(
|
||||
input_ids=self.input_ids,
|
||||
sampling_params=self.sampling_params,
|
||||
return_hidden_states=True,
|
||||
)
|
||||
outputs_hidden_state = engine.generate(
|
||||
input_ids=input_ids,
|
||||
sampling_params=sampling_params,
|
||||
outputs_hidden_state = self.engine.generate(
|
||||
input_ids=self.input_ids,
|
||||
sampling_params=self.sampling_params,
|
||||
return_hidden_states=False,
|
||||
)
|
||||
|
||||
outputs_completion_last_round = engine.generate(
|
||||
input_ids=input_ids,
|
||||
sampling_params=sampling_params,
|
||||
outputs_completion_last_round = self.engine.generate(
|
||||
input_ids=self.input_ids,
|
||||
sampling_params=self.sampling_params,
|
||||
return_hidden_states=True,
|
||||
)
|
||||
engine.shutdown()
|
||||
|
||||
for (
|
||||
output_completion_first_round,
|
||||
|
||||
@@ -95,18 +95,6 @@ class TestSRTEndpoint(CustomTestCase):
|
||||
print(json.dumps(response_json, indent=2))
|
||||
print("=" * 100)
|
||||
|
||||
def test_simple_decode(self):
|
||||
self.run_decode()
|
||||
|
||||
def test_simple_decode_batch(self):
|
||||
self.run_decode(batch=True)
|
||||
|
||||
def test_parallel_sample(self):
|
||||
self.run_decode(n=3)
|
||||
|
||||
def test_parallel_sample_stream(self):
|
||||
self.run_decode(n=3, stream=True)
|
||||
|
||||
def test_logprob(self):
|
||||
self.run_decode(
|
||||
return_logprob=True,
|
||||
|
||||
@@ -6,7 +6,6 @@ python3 -m unittest test_srt_engine.TestSRTEngine.test_4_sync_async_stream_combi
|
||||
import asyncio
|
||||
import json
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
|
||||
import torch
|
||||
|
||||
@@ -15,7 +14,6 @@ from sglang.bench_offline_throughput import BenchArgs, throughput_test
|
||||
from sglang.srt.server_args import ServerArgs
|
||||
from sglang.srt.utils.hf_transformers_utils import get_tokenizer
|
||||
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
from sglang.test.few_shot_gsm8k_engine import run_eval
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_SMALL_EMBEDDING_MODEL_NAME_FOR_TEST,
|
||||
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
@@ -89,68 +87,6 @@ class TestSRTEngine(CustomTestCase):
|
||||
print(out2)
|
||||
self.assertEqual(out1, out2)
|
||||
|
||||
def test_4_sync_async_stream_combination(self):
|
||||
prompt = "AI safety is"
|
||||
sampling_params = {"temperature": 0.8, "top_p": 0.95}
|
||||
|
||||
# Create an LLM.
|
||||
llm = sgl.Engine(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
)
|
||||
|
||||
if True:
|
||||
# 1. sync + non streaming
|
||||
print("\n\n==== 1. sync + non streaming ====")
|
||||
output = llm.generate(prompt, sampling_params)
|
||||
print(output["text"])
|
||||
|
||||
# 2. sync + streaming
|
||||
print("\n\n==== 2. sync + streaming ====")
|
||||
output_generator = llm.generate(prompt, sampling_params, stream=True)
|
||||
offset = 0
|
||||
for output in output_generator:
|
||||
print(output["text"][offset:], end="", flush=True)
|
||||
offset = len(output["text"])
|
||||
print()
|
||||
|
||||
if True:
|
||||
loop = asyncio.get_event_loop()
|
||||
# 3. async + non_streaming
|
||||
print("\n\n==== 3. async + non streaming ====")
|
||||
output = loop.run_until_complete(
|
||||
llm.async_generate(prompt, sampling_params)
|
||||
)
|
||||
print(output["text"])
|
||||
|
||||
# 4. async + streaming
|
||||
async def async_streaming(engine):
|
||||
generator = await engine.async_generate(
|
||||
prompt, sampling_params, stream=True
|
||||
)
|
||||
|
||||
offset = 0
|
||||
async for output in generator:
|
||||
print(output["text"][offset:], end="", flush=True)
|
||||
offset = len(output["text"])
|
||||
print()
|
||||
|
||||
print("\n\n==== 4. async + streaming ====")
|
||||
loop.run_until_complete(async_streaming(llm))
|
||||
|
||||
llm.shutdown()
|
||||
|
||||
def test_5_gsm8k(self):
|
||||
|
||||
args = SimpleNamespace(
|
||||
model_path=DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
|
||||
local_data_path=None,
|
||||
num_shots=5,
|
||||
num_questions=1400,
|
||||
)
|
||||
|
||||
metrics = run_eval(args)
|
||||
self.assertGreater(metrics["accuracy"], 0.33)
|
||||
|
||||
def test_6_engine_cpu_offload(self):
|
||||
prompt = "Today is a sunny day and I like"
|
||||
model_path = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
"""Intentionally trigger a CUDA illegal memory access
|
||||
to verify the coredump collection pipeline works end-to-end.
|
||||
|
||||
Manual use: python3 test/registered/debug_utils/test_cuda_coredump.py
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import torch
|
||||
|
||||
from sglang.test.ci.ci_register import register_cuda_ci
|
||||
|
||||
register_cuda_ci(
|
||||
est_time=10,
|
||||
stage="base-a",
|
||||
runner_config="1-gpu-small",
|
||||
disabled="Manual only: triggers intentional CUDA crash for coredump verification",
|
||||
)
|
||||
|
||||
|
||||
class TestCudaCoredump(unittest.TestCase):
|
||||
def test_trigger_illegal_memory_access(self):
|
||||
x = torch.zeros(10, device="cuda")
|
||||
y = torch.arange(10, device="cuda")
|
||||
x[y * y] = 1
|
||||
torch.cuda.synchronize()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,94 +0,0 @@
|
||||
import unittest
|
||||
|
||||
import sglang as sgl
|
||||
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
from sglang.test.test_programs import (
|
||||
test_decode_int,
|
||||
test_decode_json_regex,
|
||||
test_dtype_gen,
|
||||
test_expert_answer,
|
||||
test_few_shot_qa,
|
||||
test_gen_min_new_tokens,
|
||||
test_hellaswag_select,
|
||||
test_mt_bench,
|
||||
test_parallel_decoding,
|
||||
test_regex,
|
||||
test_select,
|
||||
test_stream,
|
||||
test_stream_logprobs,
|
||||
test_tool_use,
|
||||
)
|
||||
from sglang.test.test_utils import DEFAULT_MODEL_NAME_FOR_TEST, CustomTestCase
|
||||
|
||||
register_cuda_ci(est_time=79, stage="base-a", runner_config="1-gpu-small")
|
||||
register_amd_ci(est_time=120, suite="stage-a-test-1-gpu-small-amd")
|
||||
|
||||
|
||||
class TestSRTBackend(CustomTestCase):
|
||||
backend = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.backend = sgl.Runtime(
|
||||
model_path=DEFAULT_MODEL_NAME_FOR_TEST,
|
||||
cuda_graph_max_bs=4,
|
||||
mem_fraction_static=0.7,
|
||||
incremental_streaming_output=True,
|
||||
log_level="info",
|
||||
enable_metrics=True,
|
||||
)
|
||||
sgl.set_default_backend(cls.backend)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.backend.shutdown()
|
||||
|
||||
def test_few_shot_qa(self):
|
||||
test_few_shot_qa()
|
||||
|
||||
def test_mt_bench(self):
|
||||
test_mt_bench()
|
||||
|
||||
def test_select(self):
|
||||
test_select(check_answer=False)
|
||||
|
||||
def test_decode_int(self):
|
||||
test_decode_int()
|
||||
|
||||
@unittest.skip("Skip this flaky test.")
|
||||
def test_decode_json_regex(self):
|
||||
test_decode_json_regex()
|
||||
|
||||
def test_expert_answer(self):
|
||||
test_expert_answer()
|
||||
|
||||
def test_tool_use(self):
|
||||
test_tool_use()
|
||||
|
||||
def test_parallel_decoding(self):
|
||||
test_parallel_decoding()
|
||||
|
||||
def test_stream(self):
|
||||
test_stream()
|
||||
|
||||
def test_stream_logprobs(self):
|
||||
test_stream_logprobs()
|
||||
|
||||
def test_regex(self):
|
||||
test_regex()
|
||||
|
||||
def test_dtype_gen(self):
|
||||
test_dtype_gen()
|
||||
|
||||
def test_hellaswag_select(self):
|
||||
# Run twice to capture more bugs
|
||||
for _ in range(2):
|
||||
accuracy, latency = test_hellaswag_select()
|
||||
self.assertGreater(accuracy, 0.60)
|
||||
|
||||
def test_gen_min_new_tokens(self):
|
||||
test_gen_min_new_tokens()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+23
-30
@@ -8,12 +8,11 @@ Registry: base-c-test-dsv4-4-gpu-b200 (per-commit, 4x B200)
|
||||
"""
|
||||
|
||||
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.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
@@ -32,24 +31,15 @@ _DEEPEP_ENV = {
|
||||
}
|
||||
|
||||
|
||||
def _gsm8k_check(test_case):
|
||||
args = SimpleNamespace(
|
||||
base_url=test_case.base_url,
|
||||
model=test_case.model,
|
||||
eval_name="gsm8k",
|
||||
api="completion",
|
||||
max_tokens=512,
|
||||
num_examples=200,
|
||||
num_threads=128,
|
||||
)
|
||||
metrics = run_eval(args)
|
||||
print(f"[{type(test_case).__name__}] GSM8K {metrics=}")
|
||||
test_case.assertGreater(metrics["score"], 0.93)
|
||||
|
||||
|
||||
class TestDSV4FlashFP4B200(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4B200(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""LowLatency recipe: TP=4, FP4 (mxfp4), EAGLE spec decoding."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -83,13 +73,16 @@ class TestDSV4FlashFP4B200(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
_gsm8k_check(self)
|
||||
|
||||
|
||||
class TestDSV4FlashFP4B200Balanced(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4B200Balanced(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""Balanced recipe: TP=4, DP=4, DeepEP, EAGLE (1-step spec)."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -126,13 +119,16 @@ class TestDSV4FlashFP4B200Balanced(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
_gsm8k_check(self)
|
||||
|
||||
|
||||
class TestDSV4FlashFP4B200Balanced_CP(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4B200Balanced_CP(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""Balanced recipe: TP=4, DP=4, DeepEP, EAGLE (1-step spec)."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -172,9 +168,6 @@ class TestDSV4FlashFP4B200Balanced_CP(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
_gsm8k_check(self)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+16
-33
@@ -8,12 +8,11 @@ Registry: base-c-test-dsv4-8-gpu-h200 (per-commit, 8x H200 — only 4 used by TP
|
||||
"""
|
||||
|
||||
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.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
@@ -41,9 +40,15 @@ SERVER_LAUNCH_TIMEOUT = 3600
|
||||
DEEPEP_CONFIG = '{"normal_dispatch":{"num_sms":96},"normal_combine":{"num_sms":96}}'
|
||||
|
||||
|
||||
class TestDSV4FlashFP4H200(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4H200(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""LowLatency recipe: TP=4, Marlin FP4, EAGLE spec decoding."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -76,26 +81,16 @@ class TestDSV4FlashFP4H200(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
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"[DSV4 Flash FP4 Marlin H200] GSM8K {metrics=}")
|
||||
self.assertGreater(metrics["score"], 0.93)
|
||||
|
||||
|
||||
@unittest.skipUnless(
|
||||
_flashinfer_has_sm90_cutlass_mxfp4(),
|
||||
"FlashInfer build lacks SM90 mixed-input MXFP4 helpers (PR #3084, >= 0.6.11)",
|
||||
)
|
||||
class TestDSV4FlashFP4H200FlashInferCutlass(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4H200FlashInferCutlass(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""FlashInfer SM90 mixed-input cutlass MXFP4 backend (this PR): TP=4 + EAGLE.
|
||||
|
||||
Mirrors :class:`TestDSV4FlashFP4H200` but swaps `--moe-runner-backend marlin`
|
||||
@@ -103,6 +98,8 @@ class TestDSV4FlashFP4H200FlashInferCutlass(ServerSanityMixin, CustomTestCase):
|
||||
#3084 end-to-end on a real DSv4-Flash checkpoint.
|
||||
"""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -133,20 +130,6 @@ class TestDSV4FlashFP4H200FlashInferCutlass(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
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"[DSV4 Flash FP4 FlashInfer Cutlass H200] GSM8K {metrics=}")
|
||||
self.assertGreater(metrics["score"], 0.93)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+16
-26
@@ -8,12 +8,11 @@ Registry: base-c-test-dsv4-4-gpu-b200 (per-commit, 4x B200)
|
||||
"""
|
||||
|
||||
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.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
@@ -39,24 +38,15 @@ _W4A4_MEGAMOE_ENV = {
|
||||
}
|
||||
|
||||
|
||||
def _gsm8k_check(test_case):
|
||||
args = SimpleNamespace(
|
||||
base_url=test_case.base_url,
|
||||
model=test_case.model,
|
||||
eval_name="gsm8k",
|
||||
api="completion",
|
||||
max_tokens=512,
|
||||
num_examples=200,
|
||||
num_threads=128,
|
||||
)
|
||||
metrics = run_eval(args)
|
||||
print(f"[{type(test_case).__name__}] GSM8K {metrics=}")
|
||||
test_case.assertGreater(metrics["score"], 0.93)
|
||||
|
||||
|
||||
class TestDSV4FlashFP4B200W4A8MegaMoE(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4B200W4A8MegaMoE(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""Balanced recipe: TP=4, DP=4, MegaMoE."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -91,13 +81,16 @@ class TestDSV4FlashFP4B200W4A8MegaMoE(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
_gsm8k_check(self)
|
||||
|
||||
|
||||
class TestDSV4FlashFP4B200W4A4MegaMoE(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP4B200W4A4MegaMoE(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""Balanced recipe: TP=4, DP=4, MegaMoE."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL)
|
||||
@@ -132,9 +125,6 @@ class TestDSV4FlashFP4B200W4A4MegaMoE(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_gsm8k(self):
|
||||
_gsm8k_check(self)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+9
-18
@@ -9,12 +9,11 @@ Registry: base-c-test-dsv4-8-gpu-h200 (per-commit, 8x H200 — only 4 used by TP
|
||||
"""
|
||||
|
||||
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.kits.server_sanity_kit import ServerSanityMixin
|
||||
from sglang.test.run_eval import run_eval
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
@@ -29,9 +28,15 @@ SERVER_LAUNCH_TIMEOUT = 3600
|
||||
DEEPEP_CONFIG = '{"normal_dispatch":{"num_sms":96},"normal_combine":{"num_sms":96}}'
|
||||
|
||||
|
||||
class TestDSV4FlashFP8H200(ServerSanityMixin, CustomTestCase):
|
||||
class TestDSV4FlashFP8H200(
|
||||
BasicDecodeCorrectnessMixin,
|
||||
GSM8KMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
"""LowLatency recipe: TP=4, Marlin FP4, EAGLE spec decoding."""
|
||||
|
||||
gsm8k_accuracy_thres = 0.93
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = try_cached_model(MODEL_FP8)
|
||||
@@ -77,20 +82,6 @@ class TestDSV4FlashFP8H200(ServerSanityMixin, CustomTestCase):
|
||||
if hasattr(cls, "process") and cls.process:
|
||||
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"[DSV4 Flash FP4 Marlin H200] GSM8K {metrics=}")
|
||||
self.assertGreater(metrics["score"], 0.93)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user