OpenCompass 评测 InternLM-1.8B 实践
基础作业:
- 使用 OpenCompass 评测 internlm2-chat-1.8b 模型在 ceval 数据集上的性能,记录复现过程并截图。
创建虚拟环境
conda create -n opencompass python=3.10
conda activate opencompass
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia -y
新建文件夹 opencompass用于存放课程相关文件
mkdir opencompass
cd opencompass
下载并安装opencompass
git clone -b 0.2.4 https://github.com/open-compass/opencompass
cd opencompass
pip install -e .
安装相关依赖
apt-get update
apt-get install cmake
pip install -r requirements.txt
pip install protobuf
复制测评数据集到当前目录下并解压
cp /share/temp/datasets/OpenCompassData-core-20231110.zip /root/opencompass/opencompass/
unzip OpenCompassData-core-20231110.zip
解压完成,目录下会出现一个data文件夹
测评前环境变量配置
export MKL_SERVICE_FORCE_INTEL=1
export MKL_THREADING_LAYER=GNU
使用命令行配置参数法进行评测
打开 opencompass文件夹下configs/models/hf_internlm/的hf_internlm2_chat_1_8b.py ,贴入以下代码
from opencompass.models import HuggingFaceCausalLM
models = [
dict(
type=HuggingFaceCausalLM,
abbr='internlm2-1.8b-hf',
path="/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b",
tokenizer_path='/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b',
model_kwargs=dict(
trust_remote_code=True,
device_map='auto',
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
use_fast=False,
trust_remote_code=True,
),
max_out_len=100,
min_out_len=1,
max_seq_len=2048,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
)
]
运行评测命令
python run.py --datasets ceval_gen --models hf_internlm2_chat_1_8b --debug
看到这行就说明一切正常,开始评测
从27号测到28号,等待十几个小时后,测评终于完成了
上图就是internlm2-chat-1.8b 模型在 ceval 数据集上的性能