Skip to main content

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 生成的项目目录和结果。
  • 模型目录: 默认通过 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_nametokenizer.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dai_bench-0.2.0.post0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dai_bench-0.2.0.post0-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

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

Hashes for dai_bench-0.2.0.post0.tar.gz
Algorithm Hash digest
SHA256 1a37f3faf17a9e2af27cfe4876bf691f0ddd3f2b71cb02b2dfb2e652813d9696
MD5 ab627d9d39109bc32b1fdc9b95b986b7
BLAKE2b-256 6fd5e026d912a602b8cff43ee66a236699e5641e6529e6d90d5e81a81c24f12a

See more details on using hashes here.

File details

Details for the file dai_bench-0.2.0.post0-py3-none-any.whl.

File metadata

File hashes

Hashes for dai_bench-0.2.0.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 7977c278cd4b8b2ad74b319b75642051f55e740ab49f23b0057e0a1323c770ea
MD5 7d76f23c74e0c6546792cfd430cbb1dc
BLAKE2b-256 24de6bf9b27b499c86dfa2715a78d64121a9fbf352133c3d07bbc9a344fed6be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page