[benchmark] Update seed argument handling in benchmark_serving.py#7356
Merged
EmmonsCurse merged 1 commit intodevelopfrom Apr 13, 2026
Merged
[benchmark] Update seed argument handling in benchmark_serving.py#7356EmmonsCurse merged 1 commit intodevelopfrom
EmmonsCurse merged 1 commit intodevelopfrom
Conversation
|
Thanks for your contribution! |
Collaborator
|
/skip-ci all |
EmmonsCurse
approved these changes
Apr 13, 2026
Collaborator
EmmonsCurse
left a comment
There was a problem hiding this comment.
LGTM~ Skip check for benchmark.
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
📋 Review 摘要
PR 概述:将 benchmark 的 --seed 参数默认值从 0 改为 None,使 benchmark 默认不固定随机种子。
变更范围:benchmarks/benchmark_serving.py
影响面 Tag:[Benchmark]
📝 PR 规范检查
PR 描述使用了默认模板,未填写 Motivation 和 Modifications 部分。建议补充说明修改动机和具体变更内容。
标题建议(当前标题已符合规范,无需修改):
[benchmark] Update seed argument handling in benchmark_serving.py
描述模板(建议补充):
## Motivation
默认使用固定 seed 会导致每次 benchmark 运行结果完全相同,无法测试模型在不同输入下的真实性能波动。改为默认不使用 seed,使 benchmark 更贴近实际使用场景。
## Modifications
- 将 `--seed` 参数默认值从 `0` 改为 `None`
- 只在 `args.seed is not None` 时设置全局 random seed问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | benchmarks/benchmark_dataset.py:76 |
None seed 在 Dataset 内部仍被替换为 0 |
总体评价
变更逻辑正确,实现了让 benchmark 默认不固定随机种子的目标。但需注意 BenchmarkDataset 类内部会将 None seed 替换为 DEFAULT_SEED(0),因此 --shuffle 仍然是可重复的(seed=0)。如果需要完全不可重复,可能需要同时修改 BenchmarkDataset 的处理逻辑。当前实现对大多数场景已足够。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
默认不使用seed
Motivation
Modifications
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.