test_hicache.py 1.13 KB
Newer Older
1
2
3
4
5
6
import unittest
from types import SimpleNamespace

from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
7
    DEFAULT_MODEL_NAME_FOR_TEST,
8
9
    DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
    DEFAULT_URL_FOR_TEST,
10
    CustomTestCase,
11
12
13
14
    popen_launch_server,
)


15
class TestPageSize(CustomTestCase):
16
17
    @classmethod
    def setUpClass(cls):
18
        cls.model = DEFAULT_MODEL_NAME_FOR_TEST
19
20
21
22
23
        cls.base_url = DEFAULT_URL_FOR_TEST
        cls.process = popen_launch_server(
            cls.model,
            cls.base_url,
            timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
24
            other_args=["--enable-hierarchical-cache"],
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        )

    @classmethod
    def tearDownClass(cls):
        kill_process_tree(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)
41
        self.assertGreaterEqual(metrics["score"], 0.65)
42
43
44
45


if __name__ == "__main__":
    unittest.main()