Datasets:
Update csatqa.py
Browse files
csatqa.py
CHANGED
|
@@ -35,12 +35,15 @@ class CSATQA(datasets.GeneratorBasedBuilder):
|
|
| 35 |
features = datasets.Features(
|
| 36 |
{
|
| 37 |
"question": datasets.Value("string"),
|
|
|
|
| 38 |
"option#1": datasets.Value("string"),
|
| 39 |
"option#2": datasets.Value("string"),
|
| 40 |
"option#3": datasets.Value("string"),
|
| 41 |
"option#4": datasets.Value("string"),
|
| 42 |
"option#5": datasets.Value("string"),
|
| 43 |
"gold": datasets.Value("int8"),
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
)
|
| 46 |
return datasets.DatasetInfo(
|
|
@@ -67,13 +70,18 @@ class CSATQA(datasets.GeneratorBasedBuilder):
|
|
| 67 |
buffer = []
|
| 68 |
for key, row in enumerate(f):
|
| 69 |
data = json.loads(row)
|
| 70 |
-
buffer.append({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
for idx, dat in enumerate(buffer):
|
| 72 |
yield idx,dat
|
| 73 |
|
| 74 |
-
# def _generate_examples(self, filepath):
|
| 75 |
-
# with open(filepath, encoding="utf-8") as f:
|
| 76 |
-
# for key, row in enumerate(f):
|
| 77 |
-
# data = json.loads(row)
|
| 78 |
-
# if data["Category"] == self.config.name:
|
| 79 |
-
# yield key, data
|
|
|
|
| 35 |
features = datasets.Features(
|
| 36 |
{
|
| 37 |
"question": datasets.Value("string"),
|
| 38 |
+
"context" : datasets.Value("string"),
|
| 39 |
"option#1": datasets.Value("string"),
|
| 40 |
"option#2": datasets.Value("string"),
|
| 41 |
"option#3": datasets.Value("string"),
|
| 42 |
"option#4": datasets.Value("string"),
|
| 43 |
"option#5": datasets.Value("string"),
|
| 44 |
"gold": datasets.Value("int8"),
|
| 45 |
+
"category": datasets.Value("string"),
|
| 46 |
+
"human_peformance": datasets.Value("float16"),
|
| 47 |
}
|
| 48 |
)
|
| 49 |
return datasets.DatasetInfo(
|
|
|
|
| 70 |
buffer = []
|
| 71 |
for key, row in enumerate(f):
|
| 72 |
data = json.loads(row)
|
| 73 |
+
buffer.append({
|
| 74 |
+
"question": data["question"],
|
| 75 |
+
"context" : data["context"],
|
| 76 |
+
"option#1": data["option#1"],
|
| 77 |
+
"option#2": data["option#2"],
|
| 78 |
+
"option#3": data["option#3"],
|
| 79 |
+
"option#4": data["option#4"],
|
| 80 |
+
"option#5": data["option#5"],
|
| 81 |
+
"gold": data["gold"],
|
| 82 |
+
"category": data["category"],
|
| 83 |
+
"human_peformance": data["human_performance"]})
|
| 84 |
+
|
| 85 |
for idx, dat in enumerate(buffer):
|
| 86 |
yield idx,dat
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|