Skip to content

Commit 52b89c4

Browse files
[misc] Add bench_serving compatibility shim (sgl-project#28997)
1 parent 33373cb commit 52b89c4

5 files changed

Lines changed: 39 additions & 5 deletions

File tree

python/sglang/bench_offline_throughput.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"`sglang.bench_offline_throughput` is deprecated and will be removed in a "
1616
"future release; use `sglang.benchmark.offline_throughput` instead "
1717
"(e.g. `python -m sglang.benchmark.offline_throughput`).",
18-
DeprecationWarning,
18+
FutureWarning,
1919
stacklevel=1,
2020
)
2121

python/sglang/bench_one_batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"`sglang.bench_one_batch` is deprecated and will be removed in a future "
1515
"release; use `sglang.benchmark.one_batch` instead "
1616
"(e.g. `python -m sglang.benchmark.one_batch`).",
17-
DeprecationWarning,
17+
FutureWarning,
1818
stacklevel=1,
1919
)
2020

python/sglang/bench_one_batch_server.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44
``from sglang.bench_one_batch_server import ...`` imports.
55
"""
66

7+
import warnings
8+
79
from sglang.benchmark.one_batch_server import * # noqa: F401,F403
810
from sglang.benchmark.one_batch_server import main
911

12+
warnings.warn(
13+
"`sglang.bench_one_batch_server` is deprecated and will be removed in a "
14+
"future release; use `sglang.benchmark.one_batch_server` instead "
15+
"(e.g. `python -m sglang.benchmark.one_batch_server`).",
16+
FutureWarning,
17+
stacklevel=1,
18+
)
19+
1020
if __name__ == "__main__":
1121
main()

python/sglang/bench_serving.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
"""Compatibility shim for the relocated serving benchmark entrypoint."""
3+
4+
import warnings
5+
6+
from sglang.benchmark.serving import * # noqa: F403
7+
from sglang.benchmark.serving import ( # noqa: F401
8+
_create_bench_client_session,
9+
cli_main,
10+
)
11+
12+
warnings.warn(
13+
"sglang.bench_serving is deprecated; use sglang.benchmark.serving instead.",
14+
FutureWarning,
15+
stacklevel=1,
16+
)
17+
18+
19+
if __name__ == "__main__":
20+
cli_main()

python/sglang/benchmark/serving.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
Benchmark online serving with dynamic requests.
88
99
Usage:
10-
python3 -m sglang.bench_serving --backend sglang --num-prompt 10
10+
python3 -m sglang.benchmark.serving --backend sglang --num-prompt 10
1111
12-
python3 -m sglang.bench_serving --backend sglang --dataset-name random --num-prompts 3000 --random-input 1024 --random-output 1024 --random-range-ratio 0.5
12+
python3 -m sglang.benchmark.serving --backend sglang --dataset-name random --num-prompts 3000 --random-input 1024 --random-output 1024 --random-range-ratio 0.5
1313
"""
1414

1515
import argparse
@@ -2124,7 +2124,7 @@ def __call__(self, parser, namespace, values, option_string=None):
21242124
getattr(namespace, self.dest).append(lora_name)
21252125

21262126

2127-
if __name__ == "__main__":
2127+
def cli_main():
21282128
parser = ArgumentParser(description="Benchmark the online serving throughput.")
21292129
parser.add_argument(
21302130
"--backend",
@@ -2651,3 +2651,7 @@ def __call__(self, parser, namespace, values, option_string=None):
26512651
args = parser.parse_args()
26522652
_validate_parsed_gsp_args(parser, args)
26532653
run_benchmark(args)
2654+
2655+
2656+
if __name__ == "__main__":
2657+
cli_main()

0 commit comments

Comments
 (0)