Files
sglang/test/srt/test_eval_accuracy_mini.py

43 lines
1.1 KiB
Python
Raw Normal View History

2024-08-01 21:20:17 -07:00
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
2024-08-01 21:20:17 -07:00
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,
)
2024-08-01 21:20:17 -07:00
2024-08-12 02:21:38 -07:00
class TestEvalAccuracyMini(unittest.TestCase):
2024-08-01 21:20:17 -07:00
@classmethod
def setUpClass(cls):
2024-08-04 20:51:55 -07:00
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
)
2024-08-01 21:20:17 -07:00
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
2024-08-01 21:20:17 -07:00
def test_mmlu(self):
args = SimpleNamespace(
base_url=self.base_url,
model=self.model,
eval_name="mmlu",
num_examples=64,
2024-08-12 02:21:38 -07:00
num_threads=32,
temperature=0.1,
2024-08-01 21:20:17 -07:00
)
metrics = run_eval(args)
2024-11-14 01:30:24 -08:00
self.assertGreaterEqual(metrics["score"], 0.65)
2024-08-01 21:20:17 -07:00
if __name__ == "__main__":
2024-08-10 15:09:03 -07:00
unittest.main()