7.OpenCompass 大模型评测实战

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:模型的评测总结

--debugterminal显示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

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值