Skip to main content

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 生成的项目目录和结果。
  • 模型目录: 默认通过 hostPath 挂载 /gpfs/rd/models 到容器内 /models,需要根据实际环境调整:
    • 修改 deploy/common/deployment.yaml 中:
      • spec.template.spec.containers[0].volumeMounts[*].mountPath: /models
      • spec.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

Metadata

Release files for dai-bench 0.2.0.post0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dai-bench 0.2.0.post0
File Size Uploaded Provenance Actions
dai_bench-0.2.0.post0.tar.gz 1.3 MB Without provenance Details for dai_bench-0.2.0.post0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dai-bench 0.2.0.post0
File Interpreter ABI Platform Actions
dai_bench-0.2.0.post0-py3-none-any.whl Python 3 none any Details for dai_bench-0.2.0.post0-py3-none-any.whl

Total release size: 1.4 MB

Release files / dai_bench-0.2.0.post0.tar.gz

Download URL dai_bench-0.2.0.post0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
1a37f3faf17a9e2af27cfe4876bf691f0ddd3f2b71cb02b2dfb2e652813d9696
BLAKE2b-256 checksum
How to use checksums
6fd5e026d912a602b8cff43ee66a236699e5641e6529e6d90d5e81a81c24f12a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / dai_bench-0.2.0.post0-py3-none-any.whl

Download URL dai_bench-0.2.0.post0-py3-none-any.whl
Size 75.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7977c278cd4b8b2ad74b319b75642051f55e740ab49f23b0057e0a1323c770ea
BLAKE2b-256 checksum
How to use checksums
24de6bf9b27b499c86dfa2715a78d64121a9fbf352133c3d07bbc9a344fed6be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for dai-bench 0.2.0.post0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page