Datasets:

Modalities:
Text
Languages:
English
ArXiv:
Libraries:
Datasets
License:
Clémentine commited on
Commit
e24764f
1 Parent(s): 27d6bc8

added topic to examples

Browse files
Files changed (1) hide show
  1. mmlu.py +3 -1
mmlu.py CHANGED
@@ -112,6 +112,7 @@ class Mmlu(datasets.GeneratorBasedBuilder):
112
  features = datasets.Features(
113
  {
114
  "question": datasets.Value("string"),
 
115
  "choices": datasets.features.Sequence(datasets.Value("string")),
116
  "answer": datasets.features.ClassLabel(num_classes=4, names=["A", "B", "C", "D"]),
117
  }
@@ -160,11 +161,12 @@ class Mmlu(datasets.GeneratorBasedBuilder):
160
  for id_file, (path, file) in enumerate(iter_archive):
161
  if f"/{split}/" in path:
162
  if split == "auxiliary_train" or (self.config.name in path or self.config.name == "all"):
 
163
  n_yielded_files += 1
164
  lines = (line.decode("utf-8") for line in file)
165
  reader = csv.reader(lines)
166
  for id_line, data in enumerate(reader):
167
- yield f"{id_file}_{id_line}", {"question": data[0], "choices": data[1:5], "answer": data[5]}
168
  #else:
169
  #print("KO", path)
170
  #else:
 
112
  features = datasets.Features(
113
  {
114
  "question": datasets.Value("string"),
115
+ "subject": datasets.Value("string"),
116
  "choices": datasets.features.Sequence(datasets.Value("string")),
117
  "answer": datasets.features.ClassLabel(num_classes=4, names=["A", "B", "C", "D"]),
118
  }
 
161
  for id_file, (path, file) in enumerate(iter_archive):
162
  if f"/{split}/" in path:
163
  if split == "auxiliary_train" or (self.config.name in path or self.config.name == "all"):
164
+ subset = path.split("/")[-1].rsplit("_",1)[0] if split != "auxiliary_train" else ""
165
  n_yielded_files += 1
166
  lines = (line.decode("utf-8") for line in file)
167
  reader = csv.reader(lines)
168
  for id_line, data in enumerate(reader):
169
+ yield f"{id_file}_{id_line}", {"question": data[0], "choices": data[1:5], "answer": data[5], "subject": subset}
170
  #else:
171
  #print("KO", path)
172
  #else: