diff --git a/python/sglang/bench_offline_throughput.py b/python/sglang/bench_offline_throughput.py index ab501aea9..9120157c7 100644 --- a/python/sglang/bench_offline_throughput.py +++ b/python/sglang/bench_offline_throughput.py @@ -15,7 +15,7 @@ warnings.warn( "`sglang.bench_offline_throughput` is deprecated and will be removed in a " "future release; use `sglang.benchmark.offline_throughput` instead " "(e.g. `python -m sglang.benchmark.offline_throughput`).", - DeprecationWarning, + FutureWarning, stacklevel=1, ) diff --git a/python/sglang/bench_one_batch.py b/python/sglang/bench_one_batch.py index bb2a64b87..684c2a4c9 100644 --- a/python/sglang/bench_one_batch.py +++ b/python/sglang/bench_one_batch.py @@ -14,7 +14,7 @@ warnings.warn( "`sglang.bench_one_batch` is deprecated and will be removed in a future " "release; use `sglang.benchmark.one_batch` instead " "(e.g. `python -m sglang.benchmark.one_batch`).", - DeprecationWarning, + FutureWarning, stacklevel=1, ) diff --git a/python/sglang/bench_one_batch_server.py b/python/sglang/bench_one_batch_server.py index 39da285e9..654589902 100644 --- a/python/sglang/bench_one_batch_server.py +++ b/python/sglang/bench_one_batch_server.py @@ -4,8 +4,18 @@ ``from sglang.bench_one_batch_server import ...`` imports. """ +import warnings + from sglang.benchmark.one_batch_server import * # noqa: F401,F403 from sglang.benchmark.one_batch_server import main +warnings.warn( + "`sglang.bench_one_batch_server` is deprecated and will be removed in a " + "future release; use `sglang.benchmark.one_batch_server` instead " + "(e.g. `python -m sglang.benchmark.one_batch_server`).", + FutureWarning, + stacklevel=1, +) + if __name__ == "__main__": main() diff --git a/python/sglang/bench_serving.py b/python/sglang/bench_serving.py new file mode 100644 index 000000000..ddf0874db --- /dev/null +++ b/python/sglang/bench_serving.py @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Compatibility shim for the relocated serving benchmark entrypoint.""" + +import warnings + +from sglang.benchmark.serving import * # noqa: F403 +from sglang.benchmark.serving import ( # noqa: F401 + _create_bench_client_session, + cli_main, +) + +warnings.warn( + "sglang.bench_serving is deprecated; use sglang.benchmark.serving instead.", + FutureWarning, + stacklevel=1, +) + + +if __name__ == "__main__": + cli_main() diff --git a/python/sglang/benchmark/serving.py b/python/sglang/benchmark/serving.py index 2cbc42e37..5fdb491de 100644 --- a/python/sglang/benchmark/serving.py +++ b/python/sglang/benchmark/serving.py @@ -7,9 +7,9 @@ Benchmark online serving with dynamic requests. Usage: -python3 -m sglang.bench_serving --backend sglang --num-prompt 10 +python3 -m sglang.benchmark.serving --backend sglang --num-prompt 10 -python3 -m sglang.bench_serving --backend sglang --dataset-name random --num-prompts 3000 --random-input 1024 --random-output 1024 --random-range-ratio 0.5 +python3 -m sglang.benchmark.serving --backend sglang --dataset-name random --num-prompts 3000 --random-input 1024 --random-output 1024 --random-range-ratio 0.5 """ import argparse @@ -2124,7 +2124,7 @@ class LoRAPathAction(argparse.Action): getattr(namespace, self.dest).append(lora_name) -if __name__ == "__main__": +def cli_main(): parser = ArgumentParser(description="Benchmark the online serving throughput.") parser.add_argument( "--backend", @@ -2651,3 +2651,7 @@ if __name__ == "__main__": args = parser.parse_args() _validate_parsed_gsp_args(parser, args) run_benchmark(args) + + +if __name__ == "__main__": + cli_main()