Skip to content

Conversation

qwes5s5
Copy link
Contributor

@qwes5s5 qwes5s5 commented Sep 23, 2025

增加 FastDeploy Bench CLI:基准测试工具

FastDeploy CLI 新增了 bench 命令,集成了 评估(eval)吞吐量(throughput) 两种基准测试功能

1. 评估(Eval)

fastdeploy bench eval 命令利用 lm-eval 框架对在线服务进行效果基准测试。

  • 使用示例:
    fastdeploy bench eval --model local-completions \
    --model_args pretrained=/root/paddlejob/wenlei/models/ERNIE-4.5-0.3B-Paddle,base_url=[http://0.0.0.0:8891/v1/completions,tokenizer=/root/paddlejob/wenlei/models/ERNIE-4.5-0.3B-Paddle,trust_remote_code=True](http://0.0.0.0:8891/v1/completions,tokenizer=/root/paddlejob/wenlei/models/ERNIE-4.5-0.3B-Paddle,trust_remote_code=True) \
    --write_out \
    --tasks ceval-valid_accountant
    
    - **参数说明:**
      该命令的参数与 `lm-eval` 保持一致。可以参考其官方文档查看详细信息:[lm-evaluation-harness interface](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/interface.md)
    

2. 吞吐量(Throughput)

fastdeploy bench throughput 命令用于创建推理引擎并进行吞吐量基准测试。

  • 使用示例 1:

    fastdeploy bench throughput --model /root/paddlejob/wenlei/models/ERNIE-4.5-0.3B-Paddle \
    --dataset-name EBChat \
    --dataset-path /root/paddlejob/wenlei/datasets/filtered_sharedgpt_2000_input_1136_output_200_fd.json \
    --max-model-len 32768 \
    --trust_remote_code 
  • 使用示例 2:

    fastdeploy bench throughput --model Qwen/Qwen3-0.6B \
    --backend hf \
    --input-len 32 \
    --output-len 1 \
    --hf-max-batch-size 64 \
    --trust_remote_code

核心参数

1. 后端选择参数

  • --backend: 指定推理后端,可选 fastdeploy (默认), hf (HuggingFace) 或 fastdeploy-chat
  • --model: 模型名称或本地路径。
  • --tokenizer: Tokenizer 的路径,默认为 --model 指定的路径。

2. 数据集参数

  • --dataset-name: 数据集类型,支持 EBChat, random (默认) 或 EB
  • --dataset-path: 数据集文件的路径。
  • --input-len: 输入提示的长度(在使用随机数据集时必需)。
  • --output-len: 生成的输出长度(此参数会覆盖数据集中原始的输出长度)。

3. 基准测试参数

  • --n: 每个提示生成的序列数,默认为 1
  • --num-prompts: 要处理的提示数量,默认为 50
  • --hf-max-batch-size: 当使用 HF 后端时,指定最大批次大小。
  • --output-json: 保存吞吐量测试结果的 JSON 文件路径。
  • --disable-detokenize: 禁用解码时间统计。

4. LoRA 相关参数

  • --lora-path: LoRA 适配器的路径。
  • --prefix-len: 请求中随机上下文前的固定前缀 token 数。

5. 随机数据集参数

  • --random-range-ratio: 输入/输出长度的采样范围比例,取值范围为 0-1

6. 引擎参数(通过 EngineArgs 添加,详见fastdeploy/engine/args_utils.py)

  • --tensor-parallel-size: 张量并行度。
  • --disable-prefix-caching: 禁用前缀缓存功能。
  • --max-model-len: 模型的最大上下文长度。
  • --gpu-memory-utilization: GPU 内存的利用率。

@CLAassistant
Copy link

CLAassistant commented Sep 23, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ qwes5s5
❌ K11OntheBoat


K11OntheBoat seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

paddle-bot bot commented Sep 23, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants