test_bench_one_batch.py 1.55 KB
Newer Older
1
2
3
4
5
import unittest

from sglang.test.test_utils import (
    DEFAULT_MODEL_NAME_FOR_TEST,
    DEFAULT_MOE_MODEL_NAME_FOR_TEST,
6
    is_in_ci,
7
    run_bench_one_batch,
8
    write_github_step_summary,
9
10
11
)


12
class TestBenchOneBatch(unittest.TestCase):
13
    def test_bs1(self):
14
15
16
        output_throughput = run_bench_one_batch(
            DEFAULT_MODEL_NAME_FOR_TEST, ["--cuda-graph-max-bs", "2"]
        )
17

18
        if is_in_ci():
19
20
21
22
            write_github_step_summary(
                f"### test_bs1\n"
                f"output_throughput : {output_throughput:.2f} token/s\n"
            )
23
            self.assertGreater(output_throughput, 135)
24

25
    def test_moe_tp2_bs1(self):
26
        output_throughput = run_bench_one_batch(
27
            DEFAULT_MOE_MODEL_NAME_FOR_TEST, ["--tp", "2", "--cuda-graph-max-bs", "2"]
28
29
        )

30
        if is_in_ci():
31
32
33
34
            write_github_step_summary(
                f"### test_moe_tp2_bs1\n"
                f"output_throughput : {output_throughput:.2f} token/s\n"
            )
35
            self.assertGreater(output_throughput, 124)
36

37
38
39
40
41
42
43
44
45
46
47
    def test_torch_compile_tp2_bs1(self):
        output_throughput = run_bench_one_batch(
            DEFAULT_MODEL_NAME_FOR_TEST,
            ["--tp", "2", "--enable-torch-compile", "--cuda-graph-max-bs", "2"],
        )

        if is_in_ci():
            write_github_step_summary(
                f"### test_torch_compile_tp2_bs1\n"
                f"output_throughput : {output_throughput:.2f} token/s\n"
            )
48
            self.assertGreater(output_throughput, 235)
49

50
51
52

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