sgl-project/sglang · warning · FutureWarning

`sglang.bench_one_batch` is deprecated and will be removed i

Error message

`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`).

What it means

FutureWarning raised on import of the legacy shim sglang.bench_one_batch: the one-batch latency benchmark now lives at sglang.benchmark.one_batch. The shim re-exports symbols and warns that it will be deleted in a future release.

Source

Thrown at python/sglang/bench_one_batch.py:13

"""Deprecated import path for ``sglang.benchmark.one_batch``.

``python -m sglang.bench_one_batch`` and ``from sglang.bench_one_batch import ...``
still work, but the implementation now lives in ``sglang.benchmark.one_batch``.
Update references to the new path.
"""

import warnings

from sglang.benchmark.one_batch import *  # noqa: F401,F403
from sglang.benchmark.one_batch import cli_main

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`).",
    FutureWarning,
    stacklevel=1,
)

if __name__ == "__main__":
    cli_main()

View on GitHub (pinned to 0132848349)

Solutions

  1. Use python -m sglang.benchmark.one_batch
  2. Update imports to sglang.benchmark.one_batch
  3. Filter FutureWarning in the interim if the command is pinned by CI

Example fix

# before
python -m sglang.bench_one_batch --model ...
# after
python -m sglang.benchmark.one_batch --model ...
Defensive patterns

Strategy: fallback

Validate before calling

try:
    from sglang.benchmark.one_batch import cli_main
except ImportError:
    from sglang.bench_one_batch import cli_main  # legacy

Prevention

When it happens

Trigger: Running python -m sglang.bench_one_batch or importing sglang.bench_one_batch in scripts/tools after upgrading sglang.

Common situations: Old benchmark commands in docs, shell scripts, or regression harnesses that predate the sglang.benchmark package reorganization.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/20338895406e0dd4. Report an issue: GitHub.