test_chunked_prefill.py 1.51 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
    run_mulit_request_test,
12
)
13
14


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

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

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

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

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

Ke Bao's avatar
Ke Bao committed
33
34
35
36
37
38
39
40
41
42
    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

43
44
45
46
47
48
    def test_mixed_chunked_prefill_multi_requests(self):
        run_mulit_request_test(
            enable_mixed_chunk=True,
            chunked_prefill_size=2048,
        )

49
50

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