Fix unit tests for the frontend language part (#872)

This commit is contained in:
Ying Sheng
2024-08-01 12:39:12 -07:00
committed by GitHub
parent aba6f51f88
commit 6f221d4ca0
11 changed files with 80 additions and 83 deletions

View File

@@ -1,9 +1,3 @@
"""
Usage:
python3 -m sglang.launch_server --model-path meta-llama/Meta-Llama-3-8B-Instruct --port 30000
python3 test_srt_backend.py
"""
import json
import unittest
@@ -15,8 +9,6 @@ from sglang.test.test_programs import (
test_few_shot_qa,
test_mt_bench,
test_parallel_decoding,
test_parallel_encoding,
test_react,
test_regex,
test_select,
test_stream,
@@ -27,12 +19,14 @@ from sglang.test.test_programs import (
class TestSRTBackend(unittest.TestCase):
backend = None
def setUp(self):
cls = type(self)
@classmethod
def setUpClass(cls):
cls.backend = sgl.Runtime(model_path="meta-llama/Meta-Llama-3-8B-Instruct")
sgl.set_default_backend(cls.backend)
if cls.backend is None:
cls.backend = sgl.RuntimeEndpoint(base_url="http://localhost:30000")
sgl.set_default_backend(cls.backend)
@classmethod
def tearDownClass(cls):
cls.backend.shutdown()
def test_few_shot_qa(self):
test_few_shot_qa()
@@ -64,9 +58,6 @@ class TestSRTBackend(unittest.TestCase):
def test_regex(self):
test_regex()
# def test_parallel_encoding(self):
# test_parallel_encoding(check_answer=False)
if __name__ == "__main__":
unittest.main(warnings="ignore")
@@ -75,5 +66,6 @@ if __name__ == "__main__":
# global_config.verbosity = 2
# t = TestSRTBackend()
# t.setUp()
# t.test_regex()
# t.setUpClass()
# t.test_few_shot_qa()
# t.tearDownClass()