命令行配置实验:通过以下命令评测 InternLM-Chat-7B 模型在 C-Eval 数据集上的性能。由于 OpenCompass 默认并行启动评估过程,我们可以在第一次运行时以 --debug
模式启动评估,并检查是否存在问题。在 --debug
模式下,任务将按顺序执行,并实时打印输出。
python run.py --datasets ceval_gen --hf-path /share/temp/model_repos/internlm-chat-7b/ --tokenizer-path /share/temp/model_repos/internlm-chat-7b/ --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
python run.py --datasets ceval_gen \\
--hf-path /root/share/model_repos/internlm2-chat-7b/ \\
--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 2
# 注意显存的使用情况,超了后不容易从日志里面看到,可以调小max-seq-len和batch-size。上面命令就相对教程调小了很多。
命令解析
--datasets ceval_gen \\
--hf-path /share/temp/model_repos/internlm-chat-7b/ \\ # HuggingFace 模型路径
--tokenizer-path /share/temp/model_repos/internlm-chat-7b/ \\ # HuggingFace tokenizer 路径(如果与模型路径相同,可以省略)
--tokenizer-kwargs padding_side='left' truncation='left' trust_remote_code=True \\ # 构建 tokenizer 的参数
--model-kwargs device_map='auto' trust_remote_code=True \\ # 构建模型的参数
--max-seq-len 2048 \\ # 模型可以接受的最大序列长度
--max-out-len 16 \\ # 生成的最大 token 数
--batch-size 2 \\ # 批量大小
--num-gpus 1 # 运行模型所需的 GPU 数量
--debug
如果一切正常,您应该看到屏幕上显示 “Starting inference process”:
[2024-01-12 18:23:55,076] [opencompass.openicl.icl_inferencer.icl_gen_inferencer] [INFO] Starting inference process...
评测完成后