Datasets:
Update csatqa.py
Browse files
csatqa.py
CHANGED
@@ -16,8 +16,7 @@ _HOMEPAGE = "https://huggingface.co/HAERAE-HUB"
|
|
16 |
|
17 |
_LICENSE = "Proprietary"
|
18 |
|
19 |
-
split_names = ["WR", "GR", "RCS", "RCSS", "RCH", "LI"]
|
20 |
-
print(os.curdir)
|
21 |
|
22 |
class CSATQAConfig(datasets.BuilderConfig):
|
23 |
def __init__(self, **kwargs):
|
@@ -53,21 +52,21 @@ class CSATQA(datasets.GeneratorBasedBuilder):
|
|
53 |
)
|
54 |
|
55 |
def _split_generators(self, dl_manager):
|
56 |
-
|
57 |
train_path = dl_manager.download_and_extract("./data/csatqa_eval.json")
|
58 |
return [
|
59 |
-
|
60 |
-
name=datasets.Split.
|
61 |
gen_kwargs={
|
62 |
"filepath": train_path,
|
63 |
},
|
64 |
),
|
65 |
]
|
66 |
-
|
67 |
def _generate_examples(self, filepath):
|
68 |
with open(filepath, encoding="utf-8") as f:
|
69 |
for key, row in enumerate(f):
|
70 |
data = json.loads(row)
|
71 |
-
if data["
|
72 |
-
data
|
73 |
-
|
|
|
|
16 |
|
17 |
_LICENSE = "Proprietary"
|
18 |
|
19 |
+
split_names = ["all","WR", "GR", "RCS", "RCSS", "RCH", "LI"]
|
|
|
20 |
|
21 |
class CSATQAConfig(datasets.BuilderConfig):
|
22 |
def __init__(self, **kwargs):
|
|
|
52 |
)
|
53 |
|
54 |
def _split_generators(self, dl_manager):
|
|
|
55 |
train_path = dl_manager.download_and_extract("./data/csatqa_eval.json")
|
56 |
return [
|
57 |
+
datasets.SplitGenerator(
|
58 |
+
name=datasets.Split.TEST,
|
59 |
gen_kwargs={
|
60 |
"filepath": train_path,
|
61 |
},
|
62 |
),
|
63 |
]
|
64 |
+
|
65 |
def _generate_examples(self, filepath):
|
66 |
with open(filepath, encoding="utf-8") as f:
|
67 |
for key, row in enumerate(f):
|
68 |
data = json.loads(row)
|
69 |
+
if data["split"] == self.config.name:
|
70 |
+
data["gold"] = int(data["gold"]) - 1
|
71 |
+
data.pop("split")
|
72 |
+
yield key, data
|