update
Browse files- hpo_anno.py +6 -5
hpo_anno.py
CHANGED
@@ -74,10 +74,10 @@ class HPOAnno(datasets.GeneratorBasedBuilder):
|
|
74 |
)
|
75 |
|
76 |
def _split_generators(self, dl_manager):
|
77 |
-
|
78 |
-
|
79 |
return [
|
80 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"
|
81 |
]
|
82 |
|
83 |
def _generate_examples(self, filepath):
|
@@ -86,8 +86,9 @@ class HPOAnno(datasets.GeneratorBasedBuilder):
|
|
86 |
with open(filepath, encoding="utf-8") as f:
|
87 |
obj = json.load(f)
|
88 |
for item in obj:
|
89 |
-
|
90 |
-
|
|
|
91 |
"corpus": item["corpus"],
|
92 |
"ann": item["ann"]
|
93 |
}
|
|
|
74 |
)
|
75 |
|
76 |
def _split_generators(self, dl_manager):
|
77 |
+
task_name = self.config.name
|
78 |
+
local_file = dl_manager.download_and_extract(os.path.join(_DATA_URL, f"{task_name}.json"))
|
79 |
return [
|
80 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": local_file}),
|
81 |
]
|
82 |
|
83 |
def _generate_examples(self, filepath):
|
|
|
86 |
with open(filepath, encoding="utf-8") as f:
|
87 |
obj = json.load(f)
|
88 |
for item in obj:
|
89 |
+
id_ = item["id"]
|
90 |
+
yield id_, {
|
91 |
+
"id": id_,
|
92 |
"corpus": item["corpus"],
|
93 |
"ann": item["ann"]
|
94 |
}
|