-
Notifications
You must be signed in to change notification settings - Fork 158
cmmlu_zh
ymcui edited this page Apr 29, 2024
·
6 revisions
本项目在CMMLU评测数据集上测试了相关模型效果,其中测试集包含11K个选择题,涵盖67个学科。接下来将介绍CMMLU数据集的预测方法。
从CMMLU官方指定路径下载评测数据集,并解压至data文件夹:
wget https://huggingface.co/datasets/haonan-li/cmmlu/resolve/main/cmmlu_v1_0_1.zip
unzip cmmlu_v1_0_1.zip -d data
将data文件夹放置于本项目的scripts/cmmlu目录下。
运行以下脚本:
model_path=path/to/llama-3-chinese
output_path=path/to/your_output_dir
cd scripts/cmmlu
python eval.py \
--model_path ${model_path} \
--few_shot False \
--with_prompt True \
--output_dir ${output_path} \
--input_dir data
-
model_path:待评测模型所在目录(完整的Llama-3-Chinese或Llama-3-Chinese-Instruct模型,非LoRA)
-
few_shot:是否使用few-shot
-
ntrain:few_shot=True时,指定few-shot实例的数量(5-shot:ntrain=5);few_shot=False时该项不起作用
-
with_prompt:模型输入是否包含针对Llama-3-Instruct模型的指令模板
-
n_times:指定评测的重复次数,将在output_dir下生成指定次数的文件夹
-
use_flash_attention_2:使用flash-attn2加速推理,否则使用SDPA加速。
-
output_dir:指定评测结果的输出路径
-
input_dir: 指定评测数据的路径
-
模型预测完成后,生成目录outputs/take*,其中*代表数字,范围为0至n_times-1,分别储存了n_times次解码的结果。
-
outputs/take*下包含submission.json和summary.json两个json文件。
-
submission.json为生成的存储模型评测答案的文件,形式如:
{
"arts": {
"0": "A",
"1": "B",
...
},
"nutration": {
"0": "B",
"1": "A",
...
},
...
}
- summary.json包含模型在67个主题下、5个大类下和总体平均的评测结果。例如,json文件最后的All字段中会显示总体平均效果:
"All": {
"score": 0.39984458642721465,
"num": 11582,
"correct": 4631.0
}
其中score为准确率,num为测试的总样本条数,correct为正确的数量。
- Model Reconstruction
- Model Quantization, Inference and Deployment
- System Performance
- Training Scripts
- FAQ