{"id":50497868,"url":"https://github.com/bjdbjd/human-eval-testbed","last_synced_at":"2026-06-02T09:30:23.280Z","repository":{"id":354184214,"uuid":"1222029120","full_name":"bjdbjd/human-eval-testbed","owner":"bjdbjd","description":"human-eval测试平台","archived":false,"fork":false,"pushed_at":"2026-04-27T13:04:11.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-27T15:07:41.291Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjdbjd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-27T01:18:00.000Z","updated_at":"2026-04-27T13:35:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bjdbjd/human-eval-testbed","commit_stats":null,"previous_names":["bjdbjd/human-eval-testbed"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bjdbjd/human-eval-testbed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjdbjd%2Fhuman-eval-testbed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjdbjd%2Fhuman-eval-testbed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjdbjd%2Fhuman-eval-testbed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjdbjd%2Fhuman-eval-testbed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjdbjd","download_url":"https://codeload.github.com/bjdbjd/human-eval-testbed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjdbjd%2Fhuman-eval-testbed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33816485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-02T09:30:22.163Z","updated_at":"2026-06-02T09:30:23.271Z","avatar_url":"https://github.com/bjdbjd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HumanEval 模型评估工具\n\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n基于 OpenAI HumanEval 基准测试，评估大语言模型代码生成能力的工具。\n\n## 项目结构\n\n```\n.\n├── evaluate_models.py     # 评估脚本（支持全量/快速/自定义测试）\n├── results/               # 评估结果输出目录\n├── requirements.txt       # 依赖清单\n└── README.md\n```\n\n## 快速开始\n\n### 1. 安装依赖\n\n```bash\npip install -r requirements.txt\n```\n\n### 2. 快速验证（5 道题）\n\n先跑 5 道题验证生成+评测流程是否正常：\n\n```bash\npython evaluate_models.py \\\n    --api-type anthropic \\\n    --base-url YOUR_BASE_URL \\\n    --api-key YOUR_API_KEY \\\n    --models model-name \\\n    --quick\n```\n\n### 3. 全量评估（164 道题）\n\n验证通过后跑完整的 164 题：\n\n```bash\npython evaluate_models.py \\\n    --api-type anthropic \\\n    --base-url YOUR_BASE_URL \\\n    --api-key YOUR_API_KEY \\\n    --models model1 model2 model3 \\\n    --max-tokens 32768\n```\n\n## 命令行参数\n\n### 基础参数\n\n| 参数             | 说明                            | 默认值         |\n|----------------|-------------------------------|-------------|\n| `--models`     | 模型名称列表，可同时指定多个                | 必填          |\n| `--channel`    | 模型渠道标识，用于区分不同供应商              | 空（不区分）      |\n| `--api-type`   | API 类型：`anthropic` 或 `openai` | `anthropic` |\n| `--base-url`   | API 服务地址（`/v1` 后缀可选，自动处理）     | 必填          |\n| `--api-key`    | API 密钥                        | 必填          |\n| `--output-dir` | 结果输出目录                        | `results`   |\n| `--max-tokens` | 每次生成允许的最大 token 数             | `16384`     |\n\n渠道参数用于对比同一模型在不同供应商的表现：\n\n- 支持中英文渠道名称\n- 文件名添加渠道标识，如 `model_硅基流动_samples_{timestamp}.jsonl`\n- 报告基本信息中显示渠道\n\n### 题目选择参数（三选一，优先级从高到低）\n\n| 参数                 | 说明              | 示例                                                  |\n|--------------------|-----------------|-----------------------------------------------------|\n| `--tasks ID...`    | 指定具体题目，支持题号或全名  | `--tasks 0 2 4` 或 `--tasks HumanEval/0 HumanEval/2` |\n| `--num-problems N` | 测试前 N 道题目       | `--num-problems 10`                                 |\n| `--quick`          | 快速测试模式（固定 5 道题） | `--quick`                                           |\n\n若不指定以上参数，默认运行全部 164 道题目。\n\n### 多轮重试参数\n\n| 参数                 | 说明                                  | 默认值      |\n|--------------------|-------------------------------------|----------|\n| `--retry-rounds N` | 错误重试轮数，如 3 表示最多执行 3 轮，记录 pass@1/2/3 | `1`（不重试） |\n\n多轮重试模式下：\n\n- 每轮执行后，收集错误题目，下一轮只跑这些错误题\n- 记录每轮累计正确率（pass@1、pass@2、pass@3...）\n- 报告中展示每轮结果和代码\n\n### 重复执行参数\n\n| 参数           | 说明                         | 默认值      |\n|--------------|----------------------------|----------|\n| `--repeat N` | 重复执行测试的次数，如 2 表示执行 2 次完整测试 | `1`（不重复） |\n\n重复执行模式下：\n\n- 每次执行生成独立的数据文件和报告\n- 文件名添加 `run{N}` 标识，如 `model_samples_run1_{timestamp}.jsonl`\n- 汇总报告中显示所有执行的 pass@1 及平均值\n\n### base-url 兼容性\n\n`/v1` 后缀可选，程序会根据 API 类型自动处理：\n\n- **OpenAI 类型**：自动添加 `/v1` 后缀（如 `https://api.example.com` → `https://api.example.com/v1`）\n- **Anthropic 类型**：自动移除 `/v1` 后缀（如 `https://api.example.com/v1` → `https://api.example.com`）\n\n示例：无论输入 `https://api.example.com` 还是 `https://api.example.com/v1`，均可正常使用。\n\n## 使用示例\n\n### 快速测试（5 题）\n\n```bash\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --quick\n```\n\n### 测试前 20 题\n\n```bash\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --num-problems 20\n```\n\n### 指定具体题目\n\n```bash\n# 使用题号\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --tasks 0 2 4 10 21\n\n# 使用全名\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --tasks HumanEval/0 HumanEval/2 HumanEval/4\n```\n\n### 全量测试（164 题）\n\n```bash\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o claude-4\n```\n\n### 渠道对比测试\n\n```bash\n# 测试火山引擎渠道\npython evaluate_models.py --api-type openai --base-url URL1 --api-key KEY1 --models minimax-m2.5 --channel volcengine\n\n# 测试硅基流动渠道（中文渠道名）\npython evaluate_models.py --api-type openai --base-url URL2 --api-key KEY2 --models minimax-m2.5 --channel 硅基流动\n\n# 完整示例：多参数组合\npython evaluate_models.py --api-type anthropic --base-url https://api.example.com --api-key sk-xxx --models minimax-m2.5 --channel 超算互联网 --max-tokens 16384 --tasks 0 2 4 --retry-rounds 3 --repeat 3\n```\n\n\n### 多轮重试测试\n\n```bash\n# 最多执行 3 轮，记录 pass@1/2/3\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --retry-rounds 3\n```\n\n### 重复执行测试\n\n```bash\n# 执行 2 次完整测试，生成 2 份报告\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o --repeat 2\n```\n\n## API 类型支持\n\n### Anthropic 兼容接口\n\n```bash\npython evaluate_models.py --api-type anthropic --base-url https://api.example.com --api-key sk-xxx --models claude-4\n```\n\n### OpenAI 兼容接口\n\n```bash\npython evaluate_models.py --api-type openai --base-url https://api.example.com --api-key sk-xxx --models gpt-4o\n```\n\n支持所有兼容 OpenAI `/v1/chat/completions` 和 Anthropic `/v1/messages` 格式的服务。\n\n## 输出说明\n\n评估结果保存在 `results/` 目录下：\n\n**全量测试（164 题）：**\n\n- `\u003c模型名\u003e_samples_{timestamp}.jsonl` — 生成的代码补全\n- `\u003c模型名\u003e_samples_{timestamp}_results.jsonl` — 逐题评测结果\n- `\u003c模型名\u003e_report_{timestamp}.md` — Markdown 格式评估报告\n- `summary_{timestamp}.json` — 多模型对比汇总\n\n**部分测试（如 5 题）：**\n\n- `\u003c模型名\u003e_samples_5of164_{timestamp}.jsonl`\n- `\u003c模型名\u003e_samples_5of164_{timestamp}_results.jsonl`\n- `\u003c模型名\u003e_report_5of164_{timestamp}.md`\n\n**多轮重试测试（如 3 轮）：**\n\n- `\u003c模型名\u003e_samples_retry3_{timestamp}.jsonl`\n- `\u003c模型名\u003e_report_retry3_{timestamp}.md` — 包含每轮 pass@N 结果\n\n**重复执行测试（如 2 次）：**\n\n- `\u003c模型名\u003e_samples_run1_{timestamp}.jsonl` — 第 1 次执行\n- `\u003c模型名\u003e_samples_run2_{timestamp}.jsonl` — 第 2 次执行\n- `\u003c模型名\u003e_report_run1_{timestamp}.md` — 第 1 次报告\n- `\u003c模型名\u003e_report_run2_{timestamp}.md` — 第 2 次报告\n\n\u003e `{timestamp}` 格式为 `yyyymmddhhmmss`，如 `20260427210000`\n\n## 环境要求\n\n- Python \u003e= 3.10\n- pip（用于安装依赖）\n\n## 安全提示\n\n建议使用环境变量传递 API Key，避免在命令行历史中暴露：\n\n```bash\n# Linux/macOS\nexport ANTHROPIC_API_KEY=\"your-api-key\"\npython evaluate_models.py --api-type anthropic --base-url YOUR_BASE_URL --models model-name\n\nexport OPENAI_API_KEY=\"your-api-key\"\npython evaluate_models.py --api-type openai --base-url YOUR_BASE_URL --models model-name\n\n# Windows (PowerShell)\n$env:ANTHROPIC_API_KEY=\"your-api-key\"\npython evaluate_models.py --api-type anthropic --base-url YOUR_BASE_URL --models model-name\n```\n\n程序会自动读取对应的环境变量，无需通过 `--api-key` 参数传递。\n\n## 常见问题\n\n### Q: 评测失败提示 \"Some problems are not attempted\"\n\nA: 这是旧版本问题，新版本已自动处理部分测试场景。请确保使用最新代码。\n\n### Q: 模型返回内容但解析失败（0 chars）\n\nA: 脚本会自动重试 3 次。如果仍然失败，可能是模型输出格式不符合预期，查看日志中的 `[DEBUG] raw output` 了解原始输出。\n\n### Q: 如何测试本地模型？\n\nA: 使用 OpenAI 兼容的本地推理服务（如 LM Studio、Ollama），设置 `--api-type openai` 和对应的 `--base-url`。\n\n## 致谢\n\n- [HumanEval](https://github.com/openai/human-eval) - OpenAI 的代码生成基准测试数据集\n- Chen, M., et al. \"Evaluating Large Language Models Trained on Code\", arXiv:2107.03374, 2021\n\n## License\n\n[MIT License](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjdbjd%2Fhuman-eval-testbed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjdbjd%2Fhuman-eval-testbed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjdbjd%2Fhuman-eval-testbed/lists"}