support rust sglang server (#29799)
This commit is contained in:
@@ -9,13 +9,21 @@ from sglang.test.test_utils import (
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
is_rust_server_built,
|
||||
popen_launch_server,
|
||||
)
|
||||
|
||||
register_cuda_ci(est_time=62, stage="base-b", runner_config="1-gpu-large")
|
||||
# Two classes run from this file: the default server plus the Rust-frontend
|
||||
# variant (when the embedded extension is built), each launches a server + eval.
|
||||
register_cuda_ci(est_time=124, stage="base-b", runner_config="1-gpu-large")
|
||||
|
||||
|
||||
class TestModeloptFP8(CustomTestCase):
|
||||
# Extra server env; the Rust-frontend subclass sets SGLANG_RUST_SERVER here.
|
||||
env = None
|
||||
# Eval endpoint. The Rust server exposes only the native `/generate`, so its
|
||||
# subclass overrides this to "generate".
|
||||
api = "completion"
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@@ -25,7 +33,15 @@ class TestModeloptFP8(CustomTestCase):
|
||||
cls.model,
|
||||
cls.base_url,
|
||||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
other_args=["--quantization", "modelopt_fp8"],
|
||||
other_args=[
|
||||
"--quantization",
|
||||
"modelopt_fp8",
|
||||
"--tokenizer-worker-num",
|
||||
"2",
|
||||
"--detokenizer-worker-num",
|
||||
"2",
|
||||
],
|
||||
env=cls.env,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -38,7 +54,7 @@ class TestModeloptFP8(CustomTestCase):
|
||||
base_url=self.base_url,
|
||||
model=self.model,
|
||||
eval_name="gsm8k",
|
||||
api="completion",
|
||||
api=self.api,
|
||||
max_tokens=512,
|
||||
num_examples=200,
|
||||
num_threads=200,
|
||||
@@ -48,5 +64,20 @@ class TestModeloptFP8(CustomTestCase):
|
||||
self.assertGreater(metrics["score"], 0.70)
|
||||
|
||||
|
||||
@unittest.skipUnless(
|
||||
is_rust_server_built(),
|
||||
"embedded rust server extension not built",
|
||||
)
|
||||
class TestModeloptFP8WithRustServer(TestModeloptFP8):
|
||||
"""Same model + eval, but served through the embedded Rust frontend
|
||||
(`SGLANG_RUST_SERVER`). Guards the Rust tokenizer/detokenizer/completions path
|
||||
against accuracy regressions: a bug there drops gsm8k score below the same
|
||||
0.70 bar the default frontend must clear. Uses the native `/generate` endpoint
|
||||
(the only API the Rust server exposes)."""
|
||||
|
||||
env = {"SGLANG_RUST_SERVER": "1"}
|
||||
api = "generate"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user