"docs/EN/vscode:/vscode.git/clone" did not exist on "4b8f0d55988568390ba31c324f8b02c72aedd0d0"
test_bench_one_batch.py 1.59 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
    CustomTestCase,
7
    get_bool_env_var,
8
    is_in_ci,
9
    run_bench_one_batch,
10
    write_github_step_summary,
11
12
13
)


14
class TestBenchOneBatch(CustomTestCase):
15
    def test_bs1(self):
16
17
18
        output_throughput = run_bench_one_batch(
            DEFAULT_MODEL_NAME_FOR_TEST, ["--cuda-graph-max-bs", "2"]
        )
19

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

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

32
        if is_in_ci():
33
            write_github_step_summary(
Lianmin Zheng's avatar
Lianmin Zheng committed
34
                f"### test_moe_tp2_bs1\n"
35
36
                f"output_throughput : {output_throughput:.2f} token/s\n"
            )
37
            self.assertGreater(output_throughput, 124)
38

39
40
41
42
43
44
45
46
47
48
49
    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"
            )
Lianmin Zheng's avatar
Lianmin Zheng committed
50
            self.assertGreater(output_throughput, 225)
51

52
53
54

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