Skip to content

LLM-Dev-Open/opencompass_new

Repository files navigation

OpenCompass 基于HuggingFace🤗大模型评测

构建一键式脚本对大模型效果进行评测

更多详细信息请参阅lark文档:https://mgf127vt7ge.sg.larksuite.com/docx/J4W4djHR6oYPulx2mAQlhNZtgSd

🛠️ 安装

  1. 虚拟环境配置
conda create --name opencompass python=3.10 pytorch torchvision pytorch-cuda -c nvidia -c pytorch -y
conda activate opencompass
  1. 下载opencompass
# 创建evaluation目录
mkdir evaluation
cd evaluation
# 下载
git clone https://github.com/HKGAI/EmergentAbilityEval.git opencompass
cd opencompass
  1. 安装依赖
pip install -e .
  1. 下载数据集到 data/
# wget https://github.com/open-compass/opencompass/releases/download/0.1.1/OpenCompassData.zip
# 下载0.1.8数据集
wget https://github.com/open-compass/opencompass/releases/download/0.1.8.rc1/OpenCompassData-core-20231110.zip
unzip OpenCompassData-core-20231110.zip
  1. 下载humaneval数据集
git clone https://github.com/openai/human-eval.git
cd human-eval
pip install -r requirements.txt
pip install -e .
cd ..

⚠️注意:使用humaneval时需要手动到human-eval/human_eval/execution.py 文件的第 58 行取消注释才能正常评测。

🏗️ 评测

确保按照上述步骤正确安装 OpenCompass 并准备好数据集后,可以通过以下命令评测 llama-7b-hf 模型在数据集上的性能:

#命令行方式
python run.py eval_llama_7b_test.py -p slurm_conifg.py
nohup python run.py eval_llama_7b_test.py -l > xxx_log 2>&1 # 使用lark bot
#脚本方式
./eval_llama.sh

🏁提高GPU内存使用:设置max-workers-per-gpu(可以在hf_llama_7b.py中设置,也可以在命令行中直接传)

nohup python run.py eval_llama_7b_test.py --max-workers-per-gpu 6 > xxx_log 2>&1

前后效果对比:

image
默认max-workers-per-gpu=1
image
max-workers-per-gpu=6

📖 结果

所有运行输出将定向到 /home/hkustadmin/evaluation/opencompass/outputs/default/ 目录,结构如下:

outputs/default/
├── 20231113_164612
├── 20231113_183030     # 每个实验一个文件夹
│   ├── configs         # 用于记录的已转储的配置文件。如果在同一个实验文件夹中重新运行了不同的实验,可能会保留多个配置
│   ├── logs            # 推理和评估阶段的日志文件
│   │   ├── eval
│   │   └── infer
│   ├── predictions   # 每个任务的推理结果
│   ├── results       # 每个任务的评估结果
│   └── summary       # 单个实验的汇总评估结果
├── ...

结果预览:

截屏2023-11-15 16 07 24

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages