import json from tqdm import tqdm dataset = [] data_path = "data/chatglm_dev_3_prompt.json" with open(data_path, "r", encoding="utf-8") as fh: for i, line in enumerate(fh): # print(line) sample = json.loads(line.strip()) dataset.append( {"input": sample["prompt"] + sample["query"], "answer": sample["response"]}) print(dataset)