diff --git a/README.md b/README.md index b233264..818bdd9 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,39 @@ -# EvalScope 评测套件(DeepSeek-V4-Flash-INT8 定制版) +# EvalScope 评测脚本与配置 -本仓库基于 [EvalScope](https://github.com/modelscope/evalscope) 构建,面向 **DeepSeek-V4-Flash-INT8(no-thinking / thinking)** 模型,提供一键化、可断点续跑、可汇总对比的 benchmark 评测能力。 +本仓库包含一组基于 [EvalScope](https://github.com/modelscope/evalscope) 的评测脚本、配置和辅助工具,用于通过 OpenAI-compatible API 统一运行各类 LLM benchmark。 + +代码本身与具体模型无关,当前默认配置以 `DeepSeek-V4-Flash-INT8` 为例,可通过命令行参数或配置文件切换到其他模型。 --- -## 1. 仓库定位 - -- **底座**:EvalScope 开源评测框架(本地 editable 安装)。 -- **目标模型**:DeepSeek-V4-Flash-INT8,通过本地 sglang 服务以 OpenAI API 形式调用。 -- **核心产出**: - - 标准化 benchmark 分数(与 Kimi / GLM / DS 官方对比表对齐)。 - - 每个 benchmark 的详细预测、review、报告 JSON。 - - 汇总 Excel / CSV,含真实运行时间(active time)统计。 - ---- - -## 2. 目录结构 +## 1. 代码组成 ``` /data1/sora/evalscope/ -├── bash/ # 评测入口与辅助脚本 -│ ├── run.py # 统一评测入口(full/lite/mid/group*/official) -│ ├── collect_results.py # 汇总各 benchmark 分数到 Excel/CSV -│ ├── perf_backup.py # 断点续跑:备份/恢复 predictions 与 perf -│ └── pull_swe_bench_images.py # 预拉 SWE-bench Docker 镜像 +├── bash/ # 可执行脚本 +│ ├── run.py # 统一 benchmark 入口 +│ ├── collect_results.py # 汇总分数到 Excel/CSV +│ ├── perf_backup.py # 断点续跑:备份与恢复 predictions/perf +│ ├── pull_swe_bench_images.py # 预拉 SWE-bench Docker 镜像 +│ └── test.sh # 本地测试脚本示例 ├── config/ -│ └── dpv4-int8_nothinking.yaml # 各 benchmark 的 temperature / max_tokens 配置 -├── tools/docker/ # Docker 镜像构建上下文 -│ ├── Dockerfile.py312 # evalscope-complete-py312 镜像定义 -│ ├── bash/ # 构建时内置的入口脚本 -│ └── evalscope/ # 构建时内置的源码 -├── myread.md # 完整使用手册(环境、数据、Docker、参数、结果) -├── DOCKER_BUILD.md # Docker 镜像构建实录 -└── results/ # 汇总 Excel / CSV 输出目录 +│ └── dpv4-int8_nothinking.yaml # benchmark 生成参数配置 +├── tools/docker/ # Docker 构建上下文(仅构建产物,不含运行镜像) +│ ├── Dockerfile.py312 +│ ├── bash/ +│ ├── evalscope/ +│ └── tau2-bench/ +├── myread.md # 详细使用手册 +└── DOCKER_BUILD.md # Docker 镜像构建说明 ``` --- -## 3. 核心能力 +## 2. 核心脚本 -### 3.1 统一入口 `bash/run.py` +### 2.1 `bash/run.py` -一个脚本跑所有 benchmark: +统一的 benchmark 启动入口,支持 suite、自定义 datasets、thinking 模式、输出目录组织等。 ```bash python bash/run.py \ @@ -53,54 +45,68 @@ python bash/run.py \ --limit none ``` -支持 suite: +主要特性: -| suite | 说明 | -|-------|------| -| `full` | 全部 benchmark + multi-run | -| `lite` | 快速冒烟 | -| `mid` | 较全子集 | -| `group1/2/3` | 多机组分组 | -| `official` | 腾讯入库标准对比表核心子集 | +- `--suite`:预置 `full` / `lite` / `mid` / `group1` / `group2` / `group3` / `official` +- `--datasets`:覆盖 suite,逗号分隔自定义 benchmark +- `--thinking` / `--thinking-max-tokens-scale` / `--max-tokens-add`:支持 thinking 模型 +- `--folder-name`:自定义输出顶层文件夹名 +- 自动生成汇总 Excel 到 `results/{folder_name}.xlsx` -### 3.2 thinking 模式 +### 2.2 `bash/collect_results.py` -```bash -# 开启 thinking,max_tokens 按倍数放大 -python bash/run.py --suite official --thinking --thinking-max-tokens-scale 2.0 +读取 `output/{folder_name}/{benchmark}/seed_{seed}/reports/*.json`,汇总成: -# 或在原 max_tokens 基础上再加 token -python bash/run.py --suite official --thinking --max-tokens-add 32768 -``` +- `results/{folder_name}.xlsx` +- `results/{folder_name}.csv` -### 3.3 输出目录结构 +由 `run.py` 在每个 benchmark 结束后自动调用,也可单独运行。 + +### 2.3 `bash/perf_backup.py` + +实现断点续跑: + +- 每次 benchmark 完成后把 `predictions/` 和 report JSON 备份到 durable 目录。 +- 再次运行同一 benchmark 前自动恢复到 `work_dir`,避免重复推理。 +- 记录 `active_time`,kill 后重启不会重复计算等待时间。 + +### 2.4 `bash/pull_swe_bench_images.py` + +根据数据集实例批量预拉 SWE-bench 评测所需的 Docker 镜像,支持: + +- `--dataset`:指定 `swe_bench_verified` / `swe_bench_lite` 等 +- `--max-workers`:控制并发数 +- 国内源加载数据集元数据 + +### 2.5 `config/dpv4-int8_nothinking.yaml` + +各 benchmark 的 `temperature`、`top_p`、`max_tokens`、`subset_list`、`agent_config` 等参数。未在此文件中的 benchmark 会回退到 `run.py` 里的默认生成参数。 + +--- + +## 3. 输出目录约定 ``` output/ └── {folder_name}/ # 默认 model_name,thinking 时默认 model_name_THINKING ├── {benchmark}/ - │ └── seed_{seed}/ - │ ├── predictions/ - │ ├── reviews/ - │ ├── reports/{benchmark}.json - │ └── logs/ + │ ├── seed_{seed}/ + │ │ ├── predictions/ + │ │ ├── reviews/ + │ │ ├── reports/{benchmark}.json + │ │ └── logs/ + │ └── seed_{seed}_run_{n}/ # multi-run 数据集的第 n 次运行 └── active_time/ # 真实运行时间累计 results/ -└── {folder_name}.xlsx # 汇总表格 +└── {folder_name}.xlsx ``` -### 3.4 断点续跑 - -- 通过 `perf_backup.py` 在每次 benchmark 结束后备份 predictions 和 report。 -- 再次运行同一 benchmark 时自动恢复,避免重复推理。 -- 运行时间通过 `active_time/` 累计,kill 后重启不会把等待时间算进去。 - --- ## 4. 快速开始 -### 4.1 环境(宿主机) +### 4.1 安装依赖 ```bash conda create -n evalscope python=3.12 -y @@ -109,49 +115,37 @@ cd /data1/sora/evalscope pip install -e ./evalscope ``` -### 4.2 数据 - -参考 `myread.md` 第 4 章,从 ModelScope 下载数据集到 `datasets/`。 - -### 4.3 Docker 一键评测 +### 4.2 运行单个 benchmark ```bash -docker load -i docker/evalscope-complete-py312.tar.gz +python bash/run.py --datasets gsm8k --limit 50 +``` -docker run -it --rm \ - --network host \ - -v /data1/sora/evalscope:/opt/evalscope \ - -v /data1/models:/opt/models \ - -v /var/run/docker.sock:/var/run/docker.sock \ - evalscope-complete-py312:latest \ - bash -c "cd /opt/evalscope && python bash/run.py --suite official --limit none" +### 4.3 运行 suite + +```bash +python bash/run.py --suite official --limit none +``` + +详细参数见 `myread.md` 或: + +```bash +python bash/run.py --help ``` --- -## 5. 主要自定义增强 +## 5. 设计说明 -相较于上游 EvalScope,本仓库额外增加了: - -- `--folder-name`:自定义顶层输出文件夹。 -- `--thinking` / `--thinking-max-tokens-scale` / `--max-tokens-add`:支持 thinking 模型评测。 -- `official` suite:对齐腾讯入库标准的 8 个核心 benchmark。 -- `active_time` 机制:更准确地测量 benchmark 真实运行时间。 -- `perf_backup.py`:支持 kill 后断点续跑。 -- `pull_swe_bench_images.py`:支持批量预拉 SWE-bench 镜像。 +- **模型无关**:`run.py` 通过 `--model` / `--api-url` 接入任意 OpenAI-compatible 服务。 +- **配置可覆盖**:YAML 配置 + 命令行参数,未配置的 benchmark 自动使用默认生成参数。 +- **可恢复**:基于 `perf_backup.py`,适合长时间评测任务在 kill/中断后继续。 +- **可汇总**:基于 `collect_results.py`,自动产出可对比的 Excel/CSV。 --- ## 6. 相关文档 -- 完整使用手册:`myread.md` -- Docker 构建实录:`DOCKER_BUILD.md` -- 上游 EvalScope 文档:https://evalscope.readthedocs.io/ - ---- - -## 7. 维护者 - -- 仓库:`git.meta-stone.net/sora/evalstone.git` -- Docker 镜像:`SoraAmami/evalscope-docker`(ModelScope) -- 数据集:`SoraAmami/evalscope-datasets`(ModelScope) +- 详细使用手册:`myread.md` +- Docker 构建说明:`DOCKER_BUILD.md` +- 上游 EvalScope:https://github.com/modelscope/evalscope