书生·浦语 大模型实战营(第三期) 基础岛 第6关 OpenCompass 评测 InternLM-1.8B 实践

如何通过MT-Bench评估大模型 从源代码层面分析如何通过MT-Bench对大模型能力进行评估 阅读详情

概览

在 OpenCompass 中评估一个模型通常包括以下几个阶段:配置 -> 推理 -> 评估 -> 可视化。

  • 配置:这是整个工作流的起点。您需要配置整个评估过程,选择要评估的模型和数据集。此外,还可以选择评估策略、计算后端等,并定义显示结果的方式。
  • 推理与评估:在这个阶段,OpenCompass 将会开始对模型和数据集进行并行推理和评估。推理阶段主要是让模型从数据集产生输出,而评估阶段则是衡量这些输出与标准答案的匹配程度。这两个过程会被拆分为多个同时运行的“任务”以提高效率。
  • 可视化:评估完成后,OpenCompass 将结果整理成易读的表格,并将其保存为 CSV 和 TXT 文件。

接下来,我们将展示 OpenCompass 的基础用法,分别用命令行方式和配置文件的方式评测InternLM2-Chat-1.8B,展示书生浦语在 C-Eval 基准任务上的评估。更多评测技巧请查看 https://opencompass.readthedocs.io/zh-cn/latest/get_started/quick_start.html 文档。

 在创建开发机界面选择镜像为 Cuda11.7-conda,并选择 GPU 为10% A100

安装——面向GPU的环境安装

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

# 注意:一定要先 cd /root
cd /root
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

数据准备

评测数据集

解压评测数据集到 /root/opencompass/data/ 处。(注意: 上方在git clone opencompass 时一定要将 opencompass clone 到 /root 路径下)

cp /share/temp/datasets/OpenCompassData-core-20231110.zip /root/opencompass/
unzip OpenCompassData-core-20231110.zip

将会在 OpenCompass 下看到data文件夹

InternLM和ceval 相关的配置文件

列出所有跟 InternLM 及 C-Eval 相关的配置

python tools/list_configs.py internlm ceval

 

启动评测 (10% A100 8GB 资源)

使用命令行配置参数法进行评测

打开 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),
    )
]

确保按照上述步骤正确安装 OpenCompass 并准备好数据集后,可以通过以下命令评测 InternLM2-Chat-1.8B 模型在 C-Eval 数据集上的性能。由于 OpenCompass 默认并行启动评估过程,我们可以在第一次运行时以 --debug 模式启动评估,并检查是否存在问题。在 --debug 模式下,任务将按顺序执行,并实时打印输出。

#环境变量配置
export MKL_SERVICE_FORCE_INTEL=1
#或
export MKL_THREADING_LAYER=GNU
python run.py --datasets ceval_gen --models hf_internlm2_chat_1_8b --debug

命令解析

python run.py
--datasets ceval_gen \ # 数据集准备
--models hf_internlm2_chat_1_8b \  # 模型准备
--debug

如果一切正常,您应该看到屏幕上显示:

评测结果                  (运行4个小时 ) 哭脸

运行时间长 不妨先看一下 评测数据 

 实际上 通过很多步的传参      路径 path="./data/ceval/formal_ceval"

使用配置文件修改参数法进行评测

除了通过命令行配置实验外,OpenCompass 还允许用户在配置文件中编写实验的完整配置,并通过 run.py 直接运行它。配置文件是以 Python 格式组织的,并且必须包括 datasets 和 models 字段。本次测试配置在 configs文件夹 中。此配置通过 继承机制 引入所需的数据集和模型配置,并以所需格式组合 datasets 和 models 字段。 运行以下代码,在configs文件夹下创建eval_tutorial_demo.py

cd /root/opencompass/configs
touch eval_tutorial_demo.py

打开eval_tutorial_demo.py 贴入以下代码

from mmengine.config import read_base

with read_base():
    from .datasets.ceval.ceval_gen import ceval_datasets
    from .models.hf_internlm.hf_internlm2_chat_1_8b import models as hf_internlm2_chat_1_8b_models

datasets = ceval_datasets
models = hf_internlm2_chat_1_8b_models

因此,运行任务时,我们只需将配置文件的路径传递给 run.py:

cd /root/opencompass
python run.py configs/eval_tutorial_demo.py --debug

如果一切正常,您应该看到屏幕上显示:

评测结果

 进阶任务

主观评测旨在评估模型在符合人类偏好的能力上的表现。这种评估的黄金准则是人类喜好,但标注成本很高。

为了探究模型的主观能力,我们采用了JudgeLLM作为人类评估者的替代品(LLM-as-a-Judge)。流行的评估方法主要有:

  • Compare模式:将模型的回答进行两两比较,以计算对战其胜率。

  • Score模式:针对单模型的回答进行打分(例如:Chatbot Arena)。

我们基于以上方法支持了JudgeLLM用于模型的主观能力评估(目前opencompass仓库里支持的所有模型都可以直接作为JudgeLLM进行调用,此外一些专用的JudgeLLM我们也在计划支持中)。

目前已支持的主观评测数据集

  1. AlignBench 中文Scoring数据集(https://github.com/THUDM/AlignBench)

  2. MTBench 英文Scoring数据集,两轮对话(https://github.com/lm-sys/FastChat)

  3. MTBench101 英文Scoring数据集,多轮对话(https://github.com/mtbench101/mt-bench-101)

  4. AlpacaEvalv2 英文Compare数据集(https://github.com/tatsu-lab/alpaca_eval)

  5. ArenaHard 英文Compare数据集,主要面向coding(https://github.com/lm-sys/arena-hard/tree/main)

  6. Fofo 英文Socring数据集(https://github.com/SalesforceAIResearch/FoFo/)

  7. Wildbench 英文Score和Compare数据集(https://github.com/allenai/WildBench)

2 启动主观评测

类似于已有的客观评测方式,可以在configs/eval_subjective.py中进行相关配置

运行以下代码,在configs文件夹下创建eval_subjective.py

opencompass/configs/eval_subjective_alignbench.py

打开eval_subjective.py 贴入以下代码

from mmengine.config import read_base

with read_base():
    from .datasets.ceval.ceval_gen import ceval_datasets
    from .models.hf_internlm.hf_internlm2_chat_1_8b import models as hf_internlm2_chat_1_8b_models

datasets = ceval_datasets      Alignbench
models = hf_internlm2_chat_1_8b_models  模型不变

设计 方案:

主观评测的具体流程如下:

  1. 评测数据集准备     使用AlignBench 中文Scoring数据集(https://github.com/THUDM/AlignBench)

  2. 使用API模型或者开源模型进行问题答案的推理   模型不变 internlm2_chat_1_8b_models

  3. 使用选定的评价模型(JudgeLLM)对模型输出进行评估

  4. 对评价模型返回的预测结果进行解析并计算数值指标

2.1数据准备 

 原文:

  1. 这一步需要准备好数据集文件以及在Opencompass/datasets/subjective/下实现自己数据集的类,将读取到的数据以list of dict的格式return

克隆 源  获取数据  opencompass/data目录 创建文件夹subjective

cd  data/subjective

git clone https://github.com/THUDM/AlignBench    

为了方便,我将数据名改了一下 alignment_bench.jsonl

 2.2 构建评测配置

以Alignbench为例configs/datasets/subjective/alignbench/alignbench_judgeby_critiquellm.py,

找到 -- 打开 -- 修改 -- 如图 

  1. 首先需要设置subjective_reader_cfg,用以接收从自定义的Dataset类里return回来的相关字段并指定保存文件时的output字段

  2. 然后需要指定数据集的根路径data_path以及数据集的文件名subjective_all_sets,如果有多个子文件,在这个list里进行添加即可

  3. 指定subjective_infer_cfg和subjective_eval_cfg,配置好相应的推理和评测的prompt

  4. 最后在相应的位置指定mode,summarizer等额外信息,注意,对于不同的主观数据集,所需指定的字段可能不尽相同。此外,相应数据集的summarizer类也需要自己实现以进行数据的统计,可以参考其他数据集的summarizer实现,位于opencompass/opencompass/summarizers/subjective

2.3 启动评测并输出评测结果 

python run.py configs/eval_subjective.py -r

-r 参数支持复用模型推理和评估结果

JudgeLLM的评测回复会保存在 output/.../results/timestamp/xxmodel/xxdataset/.json 评测报告则会输出到 output/.../summary/timestamp/report.csv。

评估结果显示如下:

实际上 当打开时发现 一些文件 opencompass 已有 评估文件eval_subjective_alignbench.py  

opencompass/configs/eval_subjective_alignbench.py 

添加导入

from opencompass.models import hf_internlm2_chat_1_8b

将原先 chatglm3-6b-hf 相关路径 改为 internlm2-1.8b-hf   , 在hf 找到模型   复制相对路径

opencompass/configs/models/hf_internlm/hf_internlm2_chat_1_8b.py 

配置完成,输入命令, 启动评测,期待输出评测结果 

 python run.py configs/eval_subjective_alignbench.py -r

 一共整了7小时多 ,最终一直报错    又哭

 修改路径 

data_path = "data/subjective/AlignBench/data/alignment_bench"

# data_path ="data/subjective/alignment_bench"

# alignment_bench_config_path = "data/subjective/alignment_bench/"

# opencompass/data/subjective/AlignBench/config

# alignment_bench_config_name = 'config/multi-dimension'

# opencompass/data/subjective/AlignBench/config/multi-dimension.json

# /root/opencompass/data/subjective/AlignBench/config


 

alignment_bench_config_path = "opencompass/data/subjective/AlignBench/config"

alignment_bench_config_name = 'dimension_definition'

subjective_datasets = []

文件找不到   又改了好多次  一直 是这两个报错  放弃  

ps 可能是我哪里考虑失误      也可能是有bug    

 如果有好的想法 或 发现 原因    欢迎大家评论留言  

 选做二

  • 使用 OpenCompass 评测 InternLM2-Chat-1.8B 模型使用 LMDeploy部署后在 ceval 数据集上的性能(选做)

 多了一步 使用 LMDeploy部署  

pip install lmdeploy

 LMDeploy部署   评测 LMDeploy 模型 — OpenCompass 0.3.0 文档

  • 如果评测 InternLM Chat 模型,请使用配置文件 eval_internlm_chat_turbomind.py

 吸取经验 先找一下 评测文件  真有opencompass/configs/eval_internlm_chat_turbomind.py(方案1) opencompass/configs/eval_internlm_chat_lmdeploy_apiserver.py(方案2)

 方案1 

conda activate opencompass

export MKL_SERVICE_FORCE_INTEL=1
#或
export MKL_THREADING_LAYER=GNU

python run.py configs/eval_internlm_chat_turbomind.py -w outputs/turbomind/internlm2_chat_1_8b --datasets ceval_gen

 eval_internlm_chat_turbomind.py  文件修改如下:

from mmengine.config import read_base
from opencompass.models.turbomind import TurboMindModel

with read_base():
    # choose a list of datasets
    # from .datasets.mmlu.mmlu_gen_a484b3 import mmlu_datasets
    from .datasets.ceval.ceval_gen_5f30c7 import ceval_datasets
    # from .datasets.SuperGLUE_WiC.SuperGLUE_WiC_gen_d06864 import WiC_datasets
    # from .datasets.SuperGLUE_WSC.SuperGLUE_WSC_gen_7902a7 import WSC_datasets
    # from .datasets.triviaqa.triviaqa_gen_2121ce import triviaqa_datasets
    # from .datasets.gsm8k.gsm8k_gen_1d7fe4 import gsm8k_datasets
    # from .datasets.race.race_gen_69ee4f import race_datasets
    # from .datasets.crowspairs.crowspairs_gen_381af0 import crowspairs_datasets
    # and output the results in a choosen format
    from .summarizers.medium import summarizer


datasets = sum((v for k, v in locals().items() if k.endswith('_datasets')), [])

internlm_meta_template = dict(round=[
    dict(role='HUMAN', begin='<|User|>:', end='\n'),
    dict(role='BOT', begin='<|Bot|>:', end='<eoa>\n', generate=True),
],
eos_token_id=103028)

internlm2_meta_template = dict(
    round=[
        dict(role='HUMAN', begin='<|im_start|>user\n', end='<|im_end|>\n'),
        dict(role='BOT', begin='<|im_start|>assistant\n', end='<|im_end|>\n', generate=True),
    ],
    eos_token_id=92542
)
# config for internlm2_chat_1_8b
internlm2_chat_1_8b = dict(
    type=TurboMindModel,
    abbr='internlm2_chat_1_8b-turbomind',
    path='internlm/internlm2_chat_1_8b',
    # api_addr='http://0.0.0.0:23333',
    engine_config=dict(session_len=2048,
                       max_batch_size=32,
                       rope_scaling_factor=1.0),
    gen_config=dict(top_k=1,
                    top_p=0.8,
                    temperature=1.0,
                    max_new_tokens=100),
    max_out_len=100,
    max_seq_len=2048,
    batch_size=32,
    concurrency=32,
    # meta_template=meta_template,
    meta_template=internlm_meta_template,
    run_cfg=dict(num_gpus=1, num_procs=1),
    end_str='<eoa>',
)

models = [internlm2_chat_1_8b]

# config for internlm-chat-7b
# internlm_chat_7b = dict(
#     type=TurboMindModel,
#     abbr='internlm-chat-7b-turbomind',
#     path='internlm/internlm-chat-7b',
#     engine_config=dict(session_len=2048,
#                        max_batch_size=32,
#                        rope_scaling_factor=1.0),
#     gen_config=dict(top_k=1,
#                     top_p=0.8,
#                     temperature=1.0,
#                     max_new_tokens=100),
#     max_out_len=100,
#     max_seq_len=2048,
#     batch_size=32,
#     concurrency=32,
#     meta_template=internlm_meta_template,
#     run_cfg=dict(num_gpus=1, num_procs=1),
#     end_str='<eoa>',
# )

# # config for internlm-chat-7b
# internlm2_chat_7b = dict(
#     type=TurboMindModel,
#     abbr='internlm2-chat-7b-turbomind',
#     path='internlm/internlm2-chat-7b',
#     engine_config=dict(session_len=2048,
#                        max_batch_size=32,
#                        rope_scaling_factor=1.0),
#     gen_config=dict(top_k=1,
#                     top_p=0.8,
#                     temperature=1.0,
#                     max_new_tokens=100),
#     max_out_len=100,
#     max_seq_len=2048,
#     batch_size=32,
#     concurrency=32,
#     meta_template=internlm2_meta_template,
#     run_cfg=dict(num_gpus=1, num_procs=1),
#     end_str='<|im_end|>'
# )

# # config for internlm-chat-20b
# internlm_chat_20b = dict(
#     type=TurboMindModel,
#     abbr='internlm-chat-20b-turbomind',
#     path='internlm/internlm-chat-20b',
#     engine_config=dict(session_len=2048,
#                        max_batch_size=8,
#                        rope_scaling_factor=1.0),
#     gen_config=dict(top_k=1,
#                     top_p=0.8,
#                     temperature=1.0,
#                     max_new_tokens=100),
#     max_out_len=100,
#     max_seq_len=2048,
#     batch_size=8,
#     concurrency=8,
#     meta_template=internlm_meta_template,
#     run_cfg=dict(num_gpus=1, num_procs=1),
#     end_str='<eoa>',
# )

# models = [internlm_chat_20b]

运行结果 

 

 方案2

 比葫芦画瓢 写  注释多余数据集  其他模型  eval_internlm_chat_lmdeploy_apiserver.py修改如下:

from mmengine.config import read_base
from opencompass.models.turbomind_api import TurboMindAPIModel

with read_base():
    # choose a list of datasets
    # from .datasets.mmlu.mmlu_gen_a484b3 import mmlu_datasets
    from .datasets.ceval.ceval_gen_5f30c7 import ceval_datasets     ##
    # from .datasets.SuperGLUE_WiC.SuperGLUE_WiC_gen_d06864 import WiC_datasets
    # from .datasets.SuperGLUE_WSC.SuperGLUE_WSC_gen_7902a7 import WSC_datasets
    # from .datasets.triviaqa.triviaqa_gen_2121ce import triviaqa_datasets
    # from .datasets.gsm8k.gsm8k_gen_1d7fe4 import gsm8k_datasets
    # from .datasets.race.race_gen_69ee4f import race_datasets
    # from .datasets.crowspairs.crowspairs_gen_381af0 import crowspairs_datasets
    # and output the results in a choosen format
    from .summarizers.medium import summarizer
    # from .models.hf_internlm.hf_internlm2_chat_1_8b import models as hf_internlm2_chat_1_8b_models

datasets = sum((v for k, v in locals().items() if k.endswith('_datasets')), [])


meta_template = dict(
    round=[
        dict(role='HUMAN', begin='<|User|>:', end='\n'),
        dict(role='BOT', begin='<|Bot|>:', end='<eoa>\n', generate=True),
    ],
    eos_token_id=103028)

# internlm_chat_20b = dict(
#     type=TurboMindAPIModel,
#     abbr='internlm-chat-20b-turbomind',
#     api_addr='http://0.0.0.0:23333',
#     max_out_len=100,
#     max_seq_len=2048,
#     batch_size=8,
#     meta_template=meta_template,
#     run_cfg=dict(num_gpus=1, num_procs=1),
#     end_str='<eoa>',
# )

# internlm_chat_7b = dict(
#     type=TurboMindAPIModel,
#     abbr='internlm-chat-7b-turbomind',
#     api_addr='http://0.0.0.0:23333',
#     max_out_len=100,
#     max_seq_len=2048,
#     batch_size=16,
#     meta_template=meta_template,
#     run_cfg=dict(num_gpus=1, num_procs=1),
#     end_str='<eoa>',
# )

internlm2_chat_1_8b = dict(
    type=TurboMindAPIModel,

    abbr='internlm2_chat_1_8b-turbomind',
    
    api_addr='http://0.0.0.0:23333',
    max_out_len=100,
    max_seq_len=2048,
    batch_size=8,
    meta_template=meta_template,
    run_cfg=dict(num_gpus=1, num_procs=1),
    end_str='<eoa>',
)

models = [internlm2_chat_1_8b]
# models = [internlm_chat_20b]

启动api服务 

conda activate opencompass 
CUDA_VISIBLE_DEVICES=0 lmdeploy serve api_server /share/new_models/Shanghai_AI_Laboratory/internlm2-chat-1_8b --server-port 23333

conda activate opencompass 
cd opencompass
export MKL_SERVICE_FORCE_INTEL=1  ## 参考大佬作业
python run.py configs/eval_internlm_chat_lmdeploy_apiserver.py -w outputs/turbomind/internlm2_chat_1_8b --datasets ceval_gen

报错     修改依然报错    玩游戏去

再次运行 

  终端一

 终端二

what      分来

 参考大佬作业             感谢

‬⁠​​​‌⁠​‌‍​⁠​‌​⁠​​‌‬‍​​​‬​​⁠​​​​​​⁠‌​‌‍‍‬​‍​浦语Camp3:基础6-OpenCompass 评测 InternLM-1.8B 实践 - 飞书云文档 (feishu.cn)

export MKL_SERVICE_FORCE_INTEL=1 

MKL_SERVICE_FORCE_INTEL=1

结果

  • 使用 OpenCompass 进行调用API评测(优秀学员必做)

 拥有经验 先找一下 评测文件  opencompass/configs/api_examples 下有许多模型的列子

这些模型 需要api key  

 

 新建文件夹 eval_api_internlm2_chat_1_8b.py

from mmengine.config import read_base
from opencompass.models import ERNIEBot
from opencompass.partitioners import NaivePartitioner
from opencompass.runners.local_api import LocalAPIRunner
from opencompass.tasks import OpenICLInferTask

with read_base():
    from ..summarizers.medium import summarizer
    from ..datasets.ceval.ceval_gen import ceval_datasets

datasets = [
    *ceval_datasets,
]

models = [
    dict(
        abbr='internlm2_chat_1_8b',
        type=TurboMindAPIModel,
        path='internlm2_chat_1_8b',
        # key='xxxxxx',  # please give you key
        # secretkey='xxxxxxxxx',  # please give your group_id
        url='http://0.0.0.0:23333/v1',
        api_key='YOUR_API_KEY',  # 替换为你的OpenAI API密钥,由于我们使用的本地API,无需密钥,任意填写即可
        generation_kwargs = {
            'temperature': 0.8,
        },
        query_per_second=1,
        max_out_len=2048,
        max_seq_len=2048,
        batch_size=8
    ),
]

infer = dict(
    partitioner=dict(type=NaivePartitioner),
    runner=dict(
        type=LocalAPIRunner,
        max_num_workers=2,
        concurrent_users=2,
        task=dict(type=OpenICLInferTask)),
)

work_dir = "outputs/api_internlm2_chat_1_8b/"

 借鉴于此文件

# 导入openai模块中的OpenAI类,这个类用于与OpenAI API进行交互
from openai import OpenAI


# 创建一个OpenAI的客户端实例,需要传入API密钥和API的基础URL
client = OpenAI(
    api_key='YOUR_API_KEY',  
    # 替换为你的OpenAI API密钥,由于我们使用的本地API,无需密钥,任意填写即可
    base_url="http://0.0.0.0:23333/v1"  
    # 指定API的基础URL,这里使用了本地地址和端口
)

# 调用client.models.list()方法获取所有可用的模型,并选择第一个模型的ID
# models.list()返回一个模型列表,每个模型都有一个id属性
model_name = client.models.list().data[0].id

# 使用client.chat.completions.create()方法创建一个聊天补全请求
# 这个方法需要传入多个参数来指定请求的细节
response = client.chat.completions.create(
  model=model_name,  
  # 指定要使用的模型ID
  messages=[  
  # 定义消息列表,列表中的每个字典代表一个消息
    {"role": "system", "content": "你是一个友好的小助手,负责解决问题."},  
    # 系统消息,定义助手的行为
    {"role": "user", "content": "帮我讲述一个关于狐狸和西瓜的小故事"},  
    # 用户消息,询问时间管理的建议
  ],
    temperature=0.8,  
    # 控制生成文本的随机性,值越高生成的文本越随机
    top_p=0.8  
    # 控制生成文本的多样性,值越高生成的文本越多样
)

# 打印出API的响应结果
print(response.choices[0].message.content)

启动api服务 

conda activate opencompass
lmdeploy serve api_server \
    /root/models/internlm2_5-7b-chat-w4a16-4bit \
    --model-format awq \
    --cache-max-entry-count 0.4 \
    --quant-policy 4 \
    --server-name 0.0.0.0 \
    --server-port 23333 \
    --tp 1

新建终端

conda activate opencompass

cd opencompass

export MKL_SERVICE_FORCE_INTEL=1
#或
export MKL_THREADING_LAYER=GNU

python run.py configs/api_examples/eval_api_internlm2_chat_1_8b.py -w outputs/turbomind/internlm2_chat_1_8b --datasets ceval_gen

 完

一直没有分  纳闷       两天两夜。。。。。

小结:  通过本次【评测实战】,充分了解评测流程  配置 -> 推理 -> 评估 -> 可视化,实战了主观评测,LMDeploy部署后用 OpenCompass 评测 InternLM2-Chat-1.8B 模型,以及调用API评测

尽管最终都没有的出分 哭脸, 然从小白到熟练评测配置,仍有意义。

鸣谢: 大佬

 ‌​​‍​‍​‍‬​‬​​‬​​​​​‌‍‍​‍​​⁠⁠⁠​​⁠​‬​‍‍​⁠‬​‬‬浦语Camp3:基础6-OpenCompass 评测 InternLM-1.8B 实践 - 飞书云文档 (feishu.cn)

OpenCompass 评测书生大模型实践 这种错误常见于 NumPy 更新后,其他依赖库未同步更新,导致了二进制接口的不兼容,我看了下。其中 API 模式评测针对那些以 API 服务形式部署的模型,而本地直接评测则面向那些可以获取到模型权重文件的情况。是上海人工智能实验室开源的大模型评测平台,涵盖学科、语言、知识、理解、推理等五大评测维度,可全面评估大模型能力。这样我们使用了 CMMLU Benchmark 的每个子数据集的 1 个样本进行评测.直接touch 可能不成功 我是进到openai目录再创建puyu_api.py的。 阅读详情

相关推荐

(第三期)书生大模型实战营——OpenCompass评测InternLM-1.8B

上海人工智能实验室科学家团队正式发布了大模型开源开放评测体系 “司南” (OpenCompass2.0),用于为大语言模型、多模态模型等提供一站式评测服务。开源可复现:提供公平、公开、可复现的大模型评测方案全面的能力维度:五大维度设计,提供 70+ 个数据集约 40 万题的的模型评测方案,全面评估模型能力丰富的模型支持:已支持 20+ HuggingFace 及 API 模型分布式高效评测:一行命令实现任务分割和分布式评测,数小时即可完成千亿模型全量评测。

a_blade_of_grass的博客 1163

聊天机器人竞技场排行榜第8周介绍MT-Bench和Vicuna-33B

本文介绍聊天机器人竞技场排行榜的更新,新增开源模型和三项评估指标:聊天机器人竞技场Elo、MT-Bench和MMLU。推出一系列Vicuna-v1.3模型。 提出多轮对话基准测试MT-Bench,包含80个高质量问题,评估模型会话流程和遵循指令能力。与基于用户投票的对战平台聊天机器人竞技场配合使用。两者主要评估指标为人类偏好。 探讨利用GPT-4等LLM作为评委的可靠性。显示谨慎使用下,LLM评委可以作为人类偏好的可扩展和可解释近似。基于GPT-4的MT-Bench单回答评分也能有效匹配人类偏好。

qq_41879372的博客 3933

MT-Bench-101: A Fine-Grained Benchmark for Evaluating Large Language Models in Multi-Turn Dialogues

大型语言模型(LLM)的出现极大地增强了对话系统。然而,全面评估LLM的对话能力仍然是一个挑战。以前的基准主要关注单轮对话,或对多轮对话进行粗粒度和不完整的评估,忽略了现实对话的复杂性和细粒度的细微差别。为了解决这个问题,我们介绍了MT-Bench101,它专门用于评估LLM在多轮对话中的细粒度能力。通过对真实的多轮对话数据进行详细分析,我们构建了一个三层能力分类法,包括13个不同任务中1388个多轮对话中的4208个回合。

c_cpp_csharp的专栏 1143

速看!2024 ACL 评测基准专场直播回顾&干货资料来了

评测集社区 CompssHub 作为司南 OpenCompass 大模型评测体系的重要组成部分,致力于简化并加快研究人员和行业人士搜索和使用评测集的过程。评测集社区 CompssHub 目前已收录了学科、推理、知识、代码等 12 个方向的评测集,欢迎大家探索。

OpenCompass的博客 1411

S32K314 EB配置MCAL全模块讲解【Autosar——1 MCU模块详解】持续更新中

FIRC(fast internal RC Oscillator) :高速内部时钟,固定48MHZ;SIRC(Slow Internal RC Oscillator):低速内部时钟,固定32KHZ;FXOSC(Fast Crystal Oscillator Digital Controller):高速外部晶振(8-40MHZ),根据原理图选型进行配置;SXOSC():外部低速外部时钟,固定输入32.768KHZ;PLL_PHIn_CLK:时钟倍频锁相环时钟范围(640-1280MHZ);

qq_40488886的博客 1793

TI毫米波雷达人体生命体征(呼吸、心跳)信号提取算法(IWR6843ISK+DCA1000EVM)

本篇内容介绍的算法主要为传统的提取算法,但可实现在1m内呈现良好的检测效果,能够提取出非常可观的呼吸和心跳波形,但在超出1m的距离后便不适用这个算法了。远距离检测呼吸和心跳始终是这个领域一个很大的挑战。要实现远距离检测可在提取相位信号、分离呼吸和心跳信号上进行改进处理,例如线性解调提取相位、改进的VMD分离呼吸和心跳算法。

m0_61934621的博客 3万+

书生大模型实训营第4期基础岛第六关:OpenCompass 评测书生大模型实践

书生大模型实训营第4期基础岛第六关任务笔记

weixin_54052852的博客 1627

告别手动转换!用腾讯云轻量服务器+QMT插件,5分钟搞定聚宽策略实盘(附完整源码)

本文详细介绍如何利用腾讯云轻量服务器和QMT插件快速实现聚宽策略的自动化实盘部署。通过云端信号中转站解决协议转换、信号缓存等核心问题,5分钟完成服务器配置,并附完整源码实现零改造实盘方案,显著提升量化交易效率。

weixin_28707739的博客 668

(作业)第三期书生·浦语大模型实战营(十一卷王场)–书生基础岛第6关---OpenCompass 评测 InternLM-1.8B 实践

OpenCompass 评测 InternLM-1.8B 实践记录复现过程并截图。

haidizym的博客 287

用Multisim和74HC系列芯片,手把手教你搭建一个能“算数”的简易CPU模型

本文详细介绍了如何使用Multisim仿真软件和74HC系列芯片搭建一个简易CPU模型,重点解析了74HC194寄存器和74HC283加法器的核心功能与连接方法。通过分步图解和实战调试,帮助读者理解CPU工作原理,掌握数字电路设计的基本技能,适合计算机组成原理初学者和电子爱好者实践学习。

weixin_26843605的博客 146

FPGA可重构技术

介绍FPGA 可重构技术的实现方法,包括全局重构和部分重构

航天领域资深码农,型号经验丰富,一线干货分享 1992

(笔记)第三期书生·浦语大模型实战营(十一卷王场)–书生基础岛第6关---OpenCompass 评测 InternLM-1.8B 实践

学员闯关手册:https://aicarrier.feishu.cn/wiki/ZcgkwqteZi9s4ZkYr0Gcayg1n1g?课程视频:https://www.bilibili.com/video/BV1RM4m1279j/课程文档:关卡作业:https://github.com/InternLM/Tutorial/blob/camp3/docs/L1/OpenCompass/task.md开发机平台:https://studio.intern-ai.org.cn/

haidizym的博客 473

交换机端口模式详解:Access、Hybrid、Trunk

交换机是网络中至关重要的组件之一,用于连接各种设备并启用数据的高效流动。为了更好地管理和控制网络流量,交换机提供了不同的端口模式,其中包括Access、Hybrid和Trunk。本文将深入探讨这三种端口模式,详细解释它们的配置、特性和应用场景,以帮助网络管理员更好地理解和优化网络架构。

网络技术联盟站 4023

第三期书生大模型实战营(【基础岛】- 第6关 | OpenCompass 评测 InternLM-1.8B 实践)

基础岛通关奖励:结营证书,解锁全部 50% A100 权限,1688 算力点奖励助力项目申请和落地。

博客 929

深入详解DICOM医学影像定位线相关知识:理解定位线的概念、定位线的作用以及定位线显示和计算原理

深入详解DICOM医学影像定位线相关知识:理解定位线的概念、定位线的作用以及定位线显示和计算原理

编程技术探索者,分享C/C++、C#、Java、数据库等开发经验,聚焦实战技巧与AI兴趣,助力编程爱好者成长。 2056

数字逻辑Fundamentals of Digital Logic with Verilog Design | 3rd Edition Solutins Chapter 6(step by step)

第六章6-1~6-42习题详解,缺少6-39和6-40

weixin_62651190的博客 1479

书生大模型—基础岛第6关:OpenCompass 书生大模型评测

OpenCompass 是一个面向大模型评测的一站式开源平台,由上海人工智能实验室研发推出。它主要由三大核心模块构建而成:CompassKit、CompassHub 以及 CompassRank。其中,CompassKit 提供丰富的评测基准和模型模板;CompassHub 是一个基准社区,用于发布和分享评测基准和排行榜;CompassRank 则提供全面、客观、中立的分数和排名。

qq_27520611的博客 1865

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

OpenCompass 评测 InternLM-1.8B 实践

OpenCompass 评测 internlm2-chat-1_8b 模型在 mmlu 数据集上的性能

2201_75335094的博客 1791

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

四期书生大模型实战营(【基础岛】- 第6关 | OpenCompass 评测书生大模型实践(降低transformers版本)

internlm_url = 'https://internlm-chat.intern-ai.org.cn/puyu/api/v1/' # 你前面获得的 api 服务地址。d['reader_cfg']['test_range'] = '[0:1]' # 这里每个数据集只取1个样本, 方便快速评测.export INTERNLM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxx # 填入你申请的 API Key。openai_api_base=internlm_url, # 服务地址。

qq_52928908的博客 2078

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

8.22 书生大模型实战营-基础岛6 - OpenCompass 评测 InternLM-1.8B 实践作业

在 OpenCompass 中评估一个模型通常包括以下几个阶段:配置 -> 推理 -> 评估 -> 可视化。配置:这是整个工作流的起点。您需要配置整个评估过程,选择要评估的模型和数据集。此外,还可以选择评估策略、计算后端等,并定义显示结果的方式。推理与评估:在这个阶段,OpenCompass 将会开始对模型和数据集进行并行推理和评估。推理阶段主要是让模型从数据集产生输出,而评估阶段则是衡量这些输出与标准答案的匹配程度。这两个过程会被拆分为多个同时运行的“任务”以提高效率。

zjzjsuus的博客 823

【书生·浦语实战营】基础岛第6关:OpenCompass 评测 InternLM-1.8B 实践

这两条命令都用于配置 Intel Math Kernel Library (MKL) 的行为。MKL 是一个用于加速数学运算的库,通常用于科学计算和机器学习应用程序。

qq_43959624的博客 1140

OpenCompass 来评测 InternLM2 1.8B实践

在 OpenCompass 中评估一个模型通常包括以下几个阶段:配置 -> 推理 -> 评估 -> 可视化。接下来,我们将展示 OpenCompass 的基础用法,分别用命令行方式和配置文件的方式评测InternLM2-Chat-1.8B,展示书生浦语在C-Eval基准任务上的评估。

weixin_40075522的博客 1618

基础岛第6关:OpenCompass 评测 InternLM-1.8B 实践

基础岛第6关:OpenCompass 评测 InternLM-1.8B 实践

weixin_62549128的博客 1078

L1G6000——OpenCompass 评测书生大模型实践

1)环境配置评测 API 模型:如果你想要评测通过 API 访问的大语言模型,整个过程其实很简单。首先你需要获取模型的 API 密钥(API Key)和接口地址。以 OpenAI 的 GPT 模型为例,你只需要在 OpenAI 官网申请一个 API Key,然后在评测配置文件中设置好这个密钥和相应的模型参数就可以开始评测了。评测过程中,评测框架会自动向模型服务发送测试用例,获取模型的回复并进行打分分析。整个过程你不需要准备任何模型文件,也不用担心本地计算资源是否足够,只要确保网络连接正常即可。

taoismimortal的博客 2381

书生实战营第四期-基础岛第六关-OpenCompass 评测书生大模型实践

OpenCompass 提供API 模式评测和本地直接评测两种方式。 API 模式评测针对以 API 服务形式部署的模型,本地直接评测面向可以获取到模型权重文件的情况。

m0_75009117的博客 1629
上一篇: 书生·浦语 大模型实战营(第三期) 进阶岛 第3关 LMDeploy 量化部署进阶实践
下一篇: 书生·浦语 大模型实战营(第三期) 进阶岛 第 4关 InternVL 多模态模型部署微调实践
毛克卜唠嗑
博客等级 码龄3年 301粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址