A comprehensive LLM benchmarking tool
Project description
dai-bench
=======
dai-bench 项目结构
如何运行
uv pip install -e .
由于依赖的 llm-d/llm-d-benchmark 没有Python包,采用的
config-explorer @ git+https://github.com/llm-d/llm-d-benchmark.git@v0.4.0#subdirectory=config_explorer的方式声明的依赖,如果由于网络原因卡在这里可以尝试使用 git clone https://github.com/llm-d/llm-d-benchmark.git 后运行 pip install -e ./config_explorer 安装
创建项目和运行实验
dai-bench setup --name test1
cd test1
dai-bench run --experiment 1
在 Kubernetes 上运行
本仓库内置了一个最小可用的 K8S 部署示例,使用 deploy/common 目录下的清单即可在集群中直接运行基准测试。
1. 准备依赖
- PVC:
deploy/common/deployment.yaml中默认使用名为dai-bench-common-pvc的 PVC 作为输出目录挂载点,需要提前创建:- 该 PVC 会挂载到容器内
/outputs,用于存储dai-bench生成的项目目录和结果。
- 该 PVC 会挂载到容器内
- 模型目录: 默认通过
hostPath挂载/gpfs/rd/models到容器内/models,需要根据实际环境调整:- 修改
deploy/common/deployment.yaml中:spec.template.spec.containers[0].volumeMounts[*].mountPath: /modelsspec.template.spec.volumes[*].hostPath.path: /gpfs/rd/models
- 确保模型目录内包含
Qwen3-0.6B或按需调整deploy/common/config.yaml中的server.model_name和tokenizer.path。
- 修改
2. 配置压测参数
deploy/common/config.yaml 定义了一个 ConfigMap,其中:
config.yaml:- 包含
project_name,用于在容器启动时自动创建项目目录(相当于执行dai-bench setup --name <project_name> --output-dir /outputs)。
- 包含
bench.yaml:- 定义负载(
load)、接口类型(api)、服务端信息(server)、tokenizer、数据源等。 - 启动时会被复制到
/outputs/<project_name>/experiments/01/treatment/bench.yaml。
- 定义负载(
如需调整压测参数,只需修改该文件中的 bench.yaml 部分并重新应用 ConfigMap:
kubectl apply -f deploy/common/config.yaml
3. 启动 benchmark 容器
部署 Deployment:
kubectl apply -f deploy/common/deployment.yaml
该 Deployment 中容器启动命令等价于:
dai-bench run \
--init \
--from-config /config/config.yaml \
--from-bench /config/bench.yaml \
--output-dir /outputs \
--experiment 01
其中:
--init --from-config会:- 读取
/config/config.yaml中的project_name; - 在
/outputs下创建对应项目目录结构; - 将
config.yaml覆盖到setup/config.yaml。
- 读取
--from-bench会:- 将
/config/bench.yaml复制到experiments/01/treatment/bench.yaml,覆盖默认配置。
- 将
4. 查看运行结果
压测完成后,结果会写入 PVC 对应的存储卷中,目录结构类似:
/outputs/
└── <project_name>
├── experiments/
├── results/
└── setup/
可以通过以下方式查看:
- 在节点上直接查看挂载路径(如果使用
hostPath)。 - 或通过临时 Pod 访问 PVC 内容,例如:
kubectl run -it --rm debug --image=busybox --restart=Never -- sh
# 挂载同一个 PVC 后在容器内查看 /outputs 下的数据
运行 llm-d-benchmark config explorer 可视化结果
# 安装 llm-d-benchmark 依赖
git clone https://github.com/llm-d/llm-d-benchmark.git
cd llm-d-benchmark
pip install -e ./config_explorer # 如果已经安装可以跳过
pip install -r config_explorer/requirements-streamlit.txt
streamlit run ./config_explorer/Capacity_Planner.py
输出目录结构
outputs/
└── test1
├── experiments
│ ├── 01
│ │ └── treatment
│ │ ├── bench.yaml
│ │ └── run.sh
│ └── 02
│ └── treatment
│ ├── bench.yaml
│ └── run.sh
├── README.md
├── results
│ └── 01
│ └── Qwen_Qwen3-0.6B
│ └── data
│ ├── stage1-c1_2-i100-o100
│ │ ├── benchmark_report,_infqps-concurrency1-20251216-185633.json.yaml
│ │ ├── benchmark_report,_infqps-concurrency2-20251216-185658.json.yaml
│ │ ├── infqps-concurrency1-20251216-185633.json
│ │ └── infqps-concurrency2-20251216-185658.json
│ └── stage2-c1_2-i1000-o100
│ ├── benchmark_report,_infqps-concurrency1-20251216-185705.json.yaml
│ ├── benchmark_report,_infqps-concurrency2-20251216-185715.json.yaml
│ ├── infqps-concurrency1-20251216-185705.json
│ └── infqps-concurrency2-20251216-185715.json
└── setup
├── config.yaml
└── metadata.json
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dai_bench-0.2.0.post0.tar.gz.
File metadata
- Download URL: dai_bench-0.2.0.post0.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a37f3faf17a9e2af27cfe4876bf691f0ddd3f2b71cb02b2dfb2e652813d9696
|
|
| MD5 |
ab627d9d39109bc32b1fdc9b95b986b7
|
|
| BLAKE2b-256 |
6fd5e026d912a602b8cff43ee66a236699e5641e6529e6d90d5e81a81c24f12a
|
File details
Details for the file dai_bench-0.2.0.post0-py3-none-any.whl.
File metadata
- Download URL: dai_bench-0.2.0.post0-py3-none-any.whl
- Upload date:
- Size: 75.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7977c278cd4b8b2ad74b319b75642051f55e740ab49f23b0057e0a1323c770ea
|
|
| MD5 |
7d76f23c74e0c6546792cfd430cbb1dc
|
|
| BLAKE2b-256 |
24de6bf9b27b499c86dfa2715a78d64121a9fbf352133c3d07bbc9a344fed6be
|