test_chunked_prefill.py 1.31 KB
Newer Older
1
2
3
4
"""
python3 -m unittest test_chunked_prefill.TestChunkedPrefill.test_mixed_chunked_prefill_without_radix_cache
"""

5
6
import unittest

7
8
from sglang.test.test_utils import (
    DEFAULT_MODEL_NAME_FOR_TEST,
Ke Bao's avatar
Ke Bao committed
9
    run_bench_serving,
10
    run_mmlu_test,
11
)
12
13


14
15
class TestChunkedPrefill(unittest.TestCase):
    def test_chunked_prefill(self):
16
        run_mmlu_test(disable_radix_cache=False, enable_mixed_chunk=False)
17
18

    def test_mixed_chunked_prefill(self):
19
        run_mmlu_test(disable_radix_cache=False, enable_mixed_chunk=True)
20
21

    def test_chunked_prefill_without_radix_cache(self):
22
        run_mmlu_test(disable_radix_cache=True, enable_mixed_chunk=False)
23
24

    def test_mixed_chunked_prefill_without_radix_cache(self):
25
        run_mmlu_test(disable_radix_cache=True, enable_mixed_chunk=True)
26

27
    def test_no_chunked_prefill(self):
28
        run_mmlu_test(
29
30
31
            disable_radix_cache=False, enable_mixed_chunk=False, chunked_prefill_size=-1
        )

Ke Bao's avatar
Ke Bao committed
32
33
34
35
36
37
38
39
40
41
    def test_no_chunked_prefill_without_radix_cache(self):
        res = run_bench_serving(
            model=DEFAULT_MODEL_NAME_FOR_TEST,
            num_prompts=10,
            request_rate=float("inf"),
            other_server_args=["--disable-radix-cache", "--chunked-prefill-size", "-1"],
        )

        assert res["completed"] == 10

42
43

if __name__ == "__main__":
Lianmin Zheng's avatar
Lianmin Zheng committed
44
    unittest.main()