# PR #25143 完整报告

- 仓库：`sgl-project/sglang`
- 标题：bench: fix wrong flag names in bench_one_batch{,_server} docstrings
- 合并时间：2026-05-13 14:46
- 原文链接：http://prhub.com.cn/sgl-project/sglang/pull/25143

---

# 执行摘要

- 一句话：修复 bench 脚本 docstring 中错误的 flag 名称
- 推荐动作：这是一个琐碎但有用的文档修正，建议合并以提升开发者体验。无需深入审查。

# 功能与动机

PR body 指出， `bench_one_batch.py` 和 `bench_one_batch_server.py` 的 docstring 中使用的 flag 名称与 argparse 实际定义的参数名不符（例如 `--batch` 应为 `--batch-size`），直接复制粘贴这些示例会导致错误： `bench_one_batch.py: error: unrecognized arguments: --batch`。

# 实现拆解

1. **`bench_one_batch.py`**的 docstring 中，将所有 4 处 `--batch` 替换为 `--batch-size`。
2. **`bench_one_batch_server.py`**的 docstring 中，将 `--output-path results.json` 替换为 `--result-filename results.jsonl`（实际参数名并修正扩展名为 `.jsonl`）。
3. 无其他代码变更，argparse 本身已支持正确的 flag 名称。

关键文件：
- `python/sglang/bench_one_batch.py`（模块 bench 工具；类别 source；类型 docs）: 文件级 docstring 中存在 4 处 `--batch` 错误，已全部修正为 `--batch-size`。
- `python/sglang/bench_one_batch_server.py`（模块 bench 工具；类别 source；类型 docs）: 文件级 docstring 中存在 1 处 `--output-path` 错误，已修正为 `--result-filename` 并更正扩展名为 `.jsonl`。

关键符号：未识别

## 关键源码片段

### `python/sglang/bench_one_batch.py`

文件级 docstring 中存在 4 处 `--batch` 错误，已全部修正为 `--batch-size`。

```python
"""
...
## sweep through multiple data points and store (append) the results in a jsonl file:
python -m sglang.bench_one_batch --model-path meta-llama/Meta-Llama-3-8B-Instruct --batch-size 1 12 14 --input-len 256 512 --output-len 32 256 --run-name test_run
## run with profiling:
python -m sglang.bench_one_batch --model-path meta-llama/Meta-Llama-3-8B-Instruct --batch-size 1 12 14 --input-len 256 512 --profile
## run with profiling to custom directory:
export SGLANG_TORCH_PROFILER_DIR=/root/sglang/profile_log
python -m sglang.bench_one_batch --model-path meta-llama/Meta-Llama-3-8B-Instruct --batch-size 1 --input-len 256 --profile
## run with CUDA profiler (nsys):
nsys profile --force-overwrite=true -o bench_one_batch python -m sglang.bench_one_batch --model-path meta-llama/Meta-Llama-3-8B-Instruct --batch-size 1 --input-len 256 --profile --profile-activities CUDA_PROFILER
...
"""

```

# 评论区精华

没有 review 讨论。

- 暂无高价值评论线程

# 风险与影响

- 风险：无风险。仅修改 docstring，不影响任何运行时行为。
- 影响：**影响范围**：极小。仅影响阅读 docstring 并尝试复制命令的用户，修复后示例命令可以正常工作。
- 风险标记：暂无

# 关联脉络

- 暂无明显关联 PR