Skip to content
text
# Related Code
- `pyproject.toml`
- `requirements/dev.txt`
- `Makefile`
- `tests/`
- `dai_bench/logging.py`

开发指南

本地开发流程

  1. 安装依赖
bash
uv pip install -e .
uv pip install -r requirements/dev.txt
  1. 运行单测
bash
make test
# 或
pytest tests/ -v
  1. 本地调试
  • 使用 DAI_BENCHMARK_LOG_LEVEL=DEBUG 查看详细日志
  • dai-bench run --dry-run 检查参数拼接
  • 检查 results/experiments/ 目录结构是否符合预期

调试要点

  • Server Mode 卡住: 优先检查 ready_check_urlrun.sh/stop.sh
  • 结果缺失: 确认 bench.yaml 中的 server.model_name 与输出目录命名
  • 配置问题: BenchmarkConfig.to_dict() 只覆盖部分字段,修改后应校验 YAML 输出

测试策略

  • tests/test_config.py: 覆盖 LoadStageConfig 的字段解析
  • tests/test_vllm_bench.py: 覆盖 vLLM runner 参数生成与文件命名

Trace 一次完整执行

  1. dai-bench run -> run_experiment()
  2. 解析 bench.yaml / serve.yaml
  3. BenchmarkRunner 调用 VLLMBenchmarkRunner
  4. vLLM benchmark 执行并生成结果 + YAML 报告