lm-evaluation-harness 模型评测
lm-evaluation-harness 是 EleutherAI 的模型评测框架,覆盖 MMLU、GSM8K、HellaSwag、C-Eval 等任务,支持 Hugging Face、vLLM 和 API 模型。
安装:
git clone https://github.com/EleutherAI/lm-evaluation-harness
cd lm-evaluation-harness
pip install -e .
评测本地模型:
lm_eval --model hf \
--model_args pretrained=Qwen/Qwen2.5-7B-Instruct \
--tasks mmlu,gsm8k \
--batch_size 4 \
--output_path results/
评测 vLLM 服务:
lm_eval --model local-completions \
--model_args base_url=http://localhost:8000/v1/completions,model=Qwen/Qwen2.5-7B-Instruct \
--tasks mmlu \
--batch_size 8
查看任务列表:
lm_eval --tasks list
少样本评测:
lm_eval --model hf --model_args pretrained=Qwen/Qwen2.5-7B-Instruct \
--tasks mmlu --num_fewshot 5
batch_size 过大导致 OOM,使用 auto 或降低 batch。