书生大模型实战营L1-6 opencompass评测InternLM1.8B

1 配置 opencompass环境

git clone -b 0.2.4 https://github.com/open-compass/opencompass
pip install -e . -i https://mirrors.163.com/pypi/simple/
pip install -r requirements.txt -i https://mirrors.163.com/pypi/simple/
pip install protobuf -i https://mirrors.163.com/pypi/simple/
pip install modelscope -i https://mirrors.163.com/pypi/simple/

2 下载模型

from modelscope import snapshot_download
model_dir = snapshot_download('Shanghai_AI_Laboratory/internlm2_5-1_8b-chat',cache_dir='./model')

3 查看可用配置项

python tools/list_configs.py internlm ceval

在这里插入图片描述

4 修改测试文件

4.1 代码形式

修改`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="/data/coding/model/Shanghai_AI_Laboratory/internlm2_5-1_8b-chat",
        tokenizer_path='/data/coding/model/Shanghai_AI_Laboratory/internlm2_5-1_8b-chat',
        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),
    )
]

执行run.py:

python run.py --datasets ceval_gen --models hf_internlm2_chat_1_8b --debug

4.2 命令行形式

python run.py --datasets ceval_gen --hf-path /data/coding/model/Shanghai_AI_Laboratory/internlm2_5-1_8b-chat --tokenizer-path /data/coding/model/Shanghai_AI_Laboratory/internlm2_5-1_8b-chat --tokenizer-kwargs padding_side='left' truncation='left' trust_remote_code=True --model-kwargs trust_remote_code=True device_map='auto' --max-seq-len 2048 --max-out-len 16 --batch-size 4 --num-gpus 1 --debug

5 执行结果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Laccoliths

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值