sgl-project/sglang · warning · FutureWarning

`sglang.bench_offline_throughput` is deprecated and will be

Error message

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

What it means

FutureWarning emitted at import time of the legacy module sglang.bench_offline_throughput: the benchmark was moved to the sglang.benchmark package and the old top-level shim re-exports everything then warns. Functionally harmless, but the old path will be removed.

Source

Thrown at python/sglang/bench_offline_throughput.py:14

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

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

import warnings

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

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

if __name__ == "__main__":
    cli_main()

View on GitHub (pinned to 0132848349)

Solutions

  1. Switch to python -m sglang.benchmark.offline_throughput
  2. Update imports from sglang.bench_offline_throughput to sglang.benchmark.offline_throughput
  3. Suppress temporarily with -W ignore::FutureWarning if you cannot edit the script yet

Example fix

# before
python -m sglang.bench_offline_throughput --model ...
# after
python -m sglang.benchmark.offline_throughput --model ...
Defensive patterns

Strategy: fallback

Validate before calling

import importlib.util
mod = "sglang.benchmark.offline_throughput" if importlib.util.find_spec("sglang.benchmark.offline_throughput") else "sglang.bench_offline_throughput"

Prevention

When it happens

Trigger: Importing sglang.bench_offline_throughput or running python -m sglang.bench_offline_throughput (old CLI entry point / old scripts and docs).

Common situations: Scripts, Makefiles, or docs written against older sglang versions; CI logs filling with FutureWarnings after upgrading.

Related errors


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