MCPcopy Create free account
hub / github.com/PRIME-RL/PRIME / load_data

Function load_data

eval/Math/Qwen25-Math/evaluation/data_loader.py:9–86  ·  view source on GitHub ↗
(data_name, split, data_dir="../../../data")

Source from the content-addressed store, hash-verified

7
8
9def load_data(data_name, split, data_dir="../../../data"):
10 data_file = f"{data_dir}/{data_name}/{split}.jsonl"
11 print(data_file)
12 if os.path.exists(data_file):
13 examples = list(load_jsonl(data_file))
14 else:
15 if data_name == "math":
16 dataset = load_dataset(
17 "competition_math",
18 split=split,
19 name="main",
20 cache_dir=f"{data_dir}/temp",
21 )
22 elif data_name == "gsm8k":
23 dataset = load_dataset(data_name, split=split)
24 elif data_name == "svamp":
25 # evaluate on training set + test set
26 dataset = load_dataset("ChilleD/SVAMP", split="train")
27 dataset = concatenate_datasets(
28 [dataset, load_dataset("ChilleD/SVAMP", split="test")]
29 )
30 elif data_name == "asdiv":
31 dataset = load_dataset("EleutherAI/asdiv", split="validation")
32 dataset = dataset.filter(
33 lambda x: ";" not in x["answer"]
34 ) # remove multi-answer examples
35 elif data_name == "mawps":
36 examples = []
37 # four sub-tasks
38 for data_name in ["singleeq", "singleop", "addsub", "multiarith"]:
39 sub_examples = list(load_jsonl(f"{data_dir}/mawps/{data_name}.jsonl"))
40 for example in sub_examples:
41 example["type"] = data_name
42 examples.extend(sub_examples)
43 dataset = Dataset.from_list(examples)
44 elif data_name == "mmlu_stem":
45 dataset = load_dataset("hails/mmlu_no_train", "all", split="test")
46 # only keep stem subjects
47 stem_subjects = [
48 "abstract_algebra",
49 "astronomy",
50 "college_biology",
51 "college_chemistry",
52 "college_computer_science",
53 "college_mathematics",
54 "college_physics",
55 "computer_security",
56 "conceptual_physics",
57 "electrical_engineering",
58 "elementary_mathematics",
59 "high_school_biology",
60 "high_school_chemistry",
61 "high_school_computer_science",
62 "high_school_mathematics",
63 "high_school_physics",
64 "high_school_statistics",
65 "machine_learning",
66 ]

Callers 1

prepare_dataFunction · 0.90

Calls 3

load_jsonlFunction · 0.90
lower_keysFunction · 0.90
filterMethod · 0.80

Tested by

no test coverage detected