Update llm-api-benchmark

This commit is contained in:
FlintyLemming 2025-04-05 00:59:31 +08:00
parent e1fe821544
commit f61999ccb2
4 changed files with 22 additions and 3 deletions

View File

@ -55,8 +55,11 @@
pip install aiohttp pandas tiktoken matplotlib
```
# 或者,不安装可选库:
# pip install aiohttp pandas
或者,不安装可选库:
```bash
pip install aiohttp pandas
```
## 配置
@ -123,4 +126,20 @@ python benchmark_vllm.py \
* Token 计数的准确性依赖于 API 服务器在响应的 `usage` 字段中正确返回 `prompt_tokens``completion_tokens`
* `min_tokens` 参数的有效性取决于目标 API 端点是否支持它。提示增强是作为一种备用策略。
* 如果未安装 `tiktoken`Token 计数将基于字符长度进行近似估算,这对于非英语文本或代码来说准确性较低。
* 如果未安装 `tiktoken`Token 计数将基于字符长度进行近似估算,这对于非英语文本或代码来说准确性较低。
## 实例
使用下面的命令在 H200 HGX 平台上进行测试
```bash
python vllm_benchmark.py --token-lengths 10 100 500 1000 2000 5000 10000 20000 30000 --concurrency-levels 1 16 64 128 256 512 result
```
结果如下
![](src/avg_tokens_per_second_vs_concurrency.png)
![](src/success_rate_vs_concurrency.png)
![](total_tokens_per_second_vs_concurrency.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB