在Colab部署MT-Bench遇FileNotFoundError:如何解决文件缺失问题?
解决MT-Bench部署中FileNotFoundError: data/mt_bench/question.jsonl的问题
问题描述
在Colab笔记本中部署MT-Bench,执行命令:
python gen_model_answer.py --model-path lmsys/fastchat-t5-3b-v1.0 --model-id fastchat-t5-3b-v1.0
时触发FileNotFoundError,提示找不到文件data/mt_bench/question.jsonl,完整错误栈如下:
Output to data/mt_bench/model_answer/fastchat-t5-3b-v1.0.jsonl ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /content/FastChat/fastchat/llm_judge/gen_model_answer.py:236 in <module> │ │ │ │ 233 │ │ │ 234 │ print(f"Output to {answer_file}") │ │ 235 │ │ │ ❱ 236 │ run_eval( │ │ 237 │ │ args.model_path, │ │ 238 │ │ args.model_id, │ │ 239 │ │ question_file, │ │ │ │ /content/FastChat/fastchat/llm_judge/gen_model_answer.py:33 in run_eval │ │ │ │ 30 │ num_gpus_total, │ │ 31 │ max_gpu_memory, │ │ 32 ): │ │ ❱ 33 │ questions = load_questions(question_file, question_begin, question │ │ 34 │ # random shuffle the questions to balance the loading │ │ 35 │ random.shuffle(questions) │ │ 36 │ │ │ │ /usr/local/lib/python3.10/dist-packages/fastchat/llm_judge/common.py:86 in │ │ load_questions │ │ │ │ 83 def load_questions(question_file: str, begin: Optional[int], end: Opti │ │ 84 │ """Load questions from a file.""" │ │ 85 │ questions = [] │ │ ❱ 86 │ with open(question_file, "r") as ques_file: │ │ 87 │ │ for line in ques_file: │ │ 88 │ │ │ if line: │ │ 89 │ │ │ │ questions.append(json.loads(line)) │ ╰──────────────────────────────────────────────────────────────────────────────╯ FileNotFoundError: [Errno 2] No such file or directory: 'data/mt_bench/question.jsonl'
错误原因
data/mt_bench/question.jsonl是MT-Bench的标准问题数据集文件,该文件存储在Git子模块中,默认克隆FastChat主仓库时不会自动拉取子模块内容,因此导致文件缺失。
解决方法
方法一:拉取Git子模块
进入FastChat仓库根目录,执行以下命令拉取所有子模块内容:
git submodule update --init --recursive
执行完成后,data/mt_bench目录下会自动生成包括question.jsonl在内的数据集文件。
方法二:手动创建并填充文件
如果子模块拉取失败,可手动生成该文件:
- 先创建目标目录(若不存在):
mkdir -p data/mt_bench
- 创建
question.jsonl文件并填入MT-Bench官方问题数据集内容,或直接执行命令下载:
wget -P data/mt_bench https://raw.githubusercontent.com/lm-sys/FastChat/main/data/mt_bench/question.jsonl
内容的提问来源于stack exchange,提问作者kopilot100
相关产品推荐
相关产品推荐

