Add a test case to test retract (#1662)

This commit is contained in:
Lianmin Zheng
2024-10-13 20:32:37 -07:00
committed by GitHub
parent 2725f8da61
commit 869f1c02c4
4 changed files with 50 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ suites = {
"test_large_max_new_tokens.py",
"test_openai_server.py",
"test_pytorch_sampling_backend.py",
"test_retract_decode.py",
"test_server_args.py",
"test_skip_tokenizer_init.py",
"test_srt_engine.py",

View File

@@ -0,0 +1,41 @@
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_child_process
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
popen_launch_server,
)
class TestRetractDecode(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.model = DEFAULT_MODEL_NAME_FOR_TEST
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model, cls.base_url, timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
)
@classmethod
def tearDownClass(cls):
kill_child_process(cls.process.pid)
def test_mmlu(self):
args = SimpleNamespace(
base_url=self.base_url,
model=self.model,
eval_name="mmlu",
num_examples=64,
num_threads=32,
)
metrics = run_eval(args)
assert metrics["score"] >= 0.65
if __name__ == "__main__":
unittest.main()