Skip to content

[benchmark] update tools#7512

Open
ZhangYulongg wants to merge 2 commits intoPaddlePaddle:developfrom
ZhangYulongg:update_0420
Open

[benchmark] update tools#7512
ZhangYulongg wants to merge 2 commits intoPaddlePaddle:developfrom
ZhangYulongg:update_0420

Conversation

@ZhangYulongg
Copy link
Copy Markdown
Collaborator

Motivation

截断case也记录usage

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[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]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 20, 2026

Thanks for your contribution!

@EmmonsCurse
Copy link
Copy Markdown
Collaborator

/skip-ci all

EmmonsCurse
EmmonsCurse previously approved these changes Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@EmmonsCurse EmmonsCurse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~ Skip check for Benchmark.

PaddlePaddle-bot

This comment was marked as outdated.

Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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() 访问方式。代码改动范围小、风险低。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants