7.0 概念
模型评测促进模型发展
评测挑战
OpenCompass
7.1 准备
环境:开发机10%A100,cuda11.7,安装
studio-conda -o internlm-base -t opencompass
source activate opencompass
git clone -b 0.2.4 https://github.com/open-compass/opencompass
cd opencompass
pip install -e .
数据:
cp /share/temp/datasets/OpenCompassData-core-20231110.zip /root/opencompass/
unzip OpenCompassData-core-20231110.zip
查看所有跟 InternLM 及 C-Eval 相关的配置
python tools/list_configs.py internlm ceval
7.2 评测 InternLM2-Chat-1.8B 模型在 C-Eval 数据集上的性能
python run.py --datasets ceval_gen --hf-path /share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b --tokenizer-path /share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b --tokenizer-kwargs padding_side='left' truncation='left' trust_remote_code=True --model-kwargs trust_remote_code=True device_map='auto' --max-seq-len 1024 --max-out-len 16 --batch-size 2 --num-gpus 1 --debug
命令解析:
参数 | 说明 |
run.py | 运行的主函数 |
--datasets | 指定评测使用的数据集ceval_gen |
--hf-path | 评测的模型路径:/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b |
--tokenizer-path | tokenizer路径:/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b |
--tokenizer-kwargs | 构建tokenizer的参数: padding_side='left':设置tokenizer 添加填充标记(padding)的位置,left标记添加到句首 truncation='left':允许截断,输入超过max-seq-len trust_remote_code=True:下载来自 Hugging Face 模型中心或其他在线资源的配置文件 |
--model-kwargs | 构建模型的参数: trust_remote_code=True:下载来自 Hugging Face 模型中心或其他在线资源的配置文件 device_map='auto':在所有可用的GPU上均匀分配模型 |
--max-seq-len | 模型读入的最大token数1024 |
--max-out-len | 模型回复的最大token数16 |
--work_dir | 结果保存路径,默认保存在/outputs/default下。 /outputs/default有五个文件: /configs:结果总结 /logs:日志 /predictions:预测集的输出结果 /results:预测集的评价指标 /summary:模型的评测总结 |
--debug | terminal显示debug信息。默认存在/outputs/default/logs下 |
--reuse | /outputs指定时间戳文件,复用已经存在的文件继续跑。latest最新 |
报错了:Error: mkl-service + Intel(R) MKL: MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library.
添加环境变量设置可以解决
export MKL_SERVICE_FORCE_INTEL=1
#或
export MKL_THREADING_LAYER=GNU
再次运行python run.py的命令,报错ImportError。安装protobuf解决。
pip install protobuf