Datasets:
Modalities:
Text
Size:
10K - 100K
test
Browse files
testcm.py
CHANGED
@@ -93,17 +93,17 @@ class CodeMMLU(datasets.GeneratorBasedBuilder):
|
|
93 |
def _generate_examples(self, data_path):
|
94 |
"""This function returns the examples in the raw (text) form."""
|
95 |
if data_path.endswith(".jsonl"):
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
93 |
def _generate_examples(self, data_path):
|
94 |
"""This function returns the examples in the raw (text) form."""
|
95 |
if data_path.endswith(".jsonl"):
|
96 |
+
with open(data_path, "r", encoding="utf-8") as f:
|
97 |
+
for idx, line in enumerate(f):
|
98 |
+
data = json.loads(line)
|
99 |
+
return_dict = {
|
100 |
+
"task_id": data['task_id'],
|
101 |
+
"question": data['question'],
|
102 |
+
"choices": data['choices'],
|
103 |
+
}
|
104 |
+
|
105 |
+
if "fill_in_the_middle" in data_path:
|
106 |
+
return_dict['problem_description'] = data['problem_description']
|
107 |
+
|
108 |
+
return_dict['answer'] = data['answer']
|
109 |
+
yield idx, return_dict
|