Open
Conversation
|
Thanks for your contribution! |
Collaborator
|
/skip-ci all |
EmmonsCurse
previously approved these changes
Apr 20, 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.
🤖 AI Code Review |
2026-04-20 17:46:36
📋 Review 摘要
PR 概述:在流式请求截断场景下,补充记录 usage 信息(output_tokens、prompt_tokens、prompt_len)
变更范围:benchmarks/backend_request_func.py
影响面 Tag:[Benchmark]
📝 PR 规范检查
PR 标题 Tag 大小写不规范,且标题描述过于笼统,建议修改:
标题建议(可直接复制):
[Benchmark] Record usage info for truncated streaming cases
描述模板(可直接复制):
Motivation
当流式请求被截断时,usage 信息(completion_tokens、prompt_tokens、prompt_len)未被记录,导致 benchmark 统计数据不完整。
Modifications
在
async_request_eb_openai_chat_completions函数中,流式循环结束后增加对最后一个 chunk 的 usage 字段读取,确保截断场景下也能正确记录 token 用量。
问题
未发现阻塞性问题。
总体评价
变更逻辑正确,在流式循环退出后从最后一个 chunk 中补充读取 usage 信息,与循环内 elif 分支(第 416-423 行)的已有逻辑保持一致,且使用了更安全的 .get() 访问方式。代码改动范围小、风险低。
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.
Motivation
截断case也记录usage
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.