holylovenia
commited on
Commit
•
d8920f4
1
Parent(s):
bbfac91
Upload indonli.py with huggingface_hub
Browse files- indonli.py +13 -13
indonli.py
CHANGED
@@ -35,9 +35,9 @@ from typing import List
|
|
35 |
import datasets
|
36 |
import jsonlines
|
37 |
|
38 |
-
from
|
39 |
-
from
|
40 |
-
from
|
41 |
|
42 |
_CITATION = """\
|
43 |
@inproceedings{mahendra-etal-2021-indonli,
|
@@ -68,7 +68,7 @@ _HOMEPAGE = "https://github.com/ir-nlp-csui/indonli"
|
|
68 |
_LICENSE = "Creative Common Attribution Share-Alike 4.0 International"
|
69 |
|
70 |
# For publicly available datasets you will most likely end up passing these URLs to dl_manager in _split_generators.
|
71 |
-
# In most cases the URLs will be the same for the source and
|
72 |
# However, if you need to access different files for each config you can have multiple entries in this dict.
|
73 |
# This can be an arbitrarily nested dict/list of URLs (see below in `_split_generators` method)
|
74 |
_URLS = {
|
@@ -83,28 +83,28 @@ _SUPPORTED_TASKS = [Tasks.TEXTUAL_ENTAILMENT]
|
|
83 |
|
84 |
_SOURCE_VERSION = "1.1.0" # Mentioned in https://github.com/huggingface/datasets/blob/main/datasets/indonli/indonli.py
|
85 |
|
86 |
-
|
87 |
|
88 |
|
89 |
class IndoNli(datasets.GeneratorBasedBuilder):
|
90 |
"""IndoNLI, a human-elicited NLI dataset for Indonesian containing ~18k sentence pairs annotated by crowd workers."""
|
91 |
|
92 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
93 |
-
|
94 |
|
95 |
BUILDER_CONFIGS = [
|
96 |
-
|
97 |
name="indonli_source",
|
98 |
version=SOURCE_VERSION,
|
99 |
description="indonli source schema",
|
100 |
schema="source",
|
101 |
subset_id="indonli",
|
102 |
),
|
103 |
-
|
104 |
-
name="
|
105 |
-
version=
|
106 |
description="indonli Nusantara schema",
|
107 |
-
schema="
|
108 |
subset_id="indonli",
|
109 |
),
|
110 |
]
|
@@ -126,7 +126,7 @@ class IndoNli(datasets.GeneratorBasedBuilder):
|
|
126 |
"label": datasets.Value("string"),
|
127 |
}
|
128 |
)
|
129 |
-
elif self.config.schema == "
|
130 |
features = schemas.pairs_features(self.labels)
|
131 |
|
132 |
return datasets.DatasetInfo(
|
@@ -178,7 +178,7 @@ class IndoNli(datasets.GeneratorBasedBuilder):
|
|
178 |
}
|
179 |
yield example["pair_id"], example
|
180 |
|
181 |
-
elif self.config.schema == "
|
182 |
print(filepath)
|
183 |
with jsonlines.open(filepath) as f:
|
184 |
skip = [] # To avoid duplicate IDs
|
|
|
35 |
import datasets
|
36 |
import jsonlines
|
37 |
|
38 |
+
from seacrowd.utils import schemas
|
39 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
40 |
+
from seacrowd.utils.constants import Tasks
|
41 |
|
42 |
_CITATION = """\
|
43 |
@inproceedings{mahendra-etal-2021-indonli,
|
|
|
68 |
_LICENSE = "Creative Common Attribution Share-Alike 4.0 International"
|
69 |
|
70 |
# For publicly available datasets you will most likely end up passing these URLs to dl_manager in _split_generators.
|
71 |
+
# In most cases the URLs will be the same for the source and seacrowd config.
|
72 |
# However, if you need to access different files for each config you can have multiple entries in this dict.
|
73 |
# This can be an arbitrarily nested dict/list of URLs (see below in `_split_generators` method)
|
74 |
_URLS = {
|
|
|
83 |
|
84 |
_SOURCE_VERSION = "1.1.0" # Mentioned in https://github.com/huggingface/datasets/blob/main/datasets/indonli/indonli.py
|
85 |
|
86 |
+
_SEACROWD_VERSION = "2024.06.20"
|
87 |
|
88 |
|
89 |
class IndoNli(datasets.GeneratorBasedBuilder):
|
90 |
"""IndoNLI, a human-elicited NLI dataset for Indonesian containing ~18k sentence pairs annotated by crowd workers."""
|
91 |
|
92 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
93 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
94 |
|
95 |
BUILDER_CONFIGS = [
|
96 |
+
SEACrowdConfig(
|
97 |
name="indonli_source",
|
98 |
version=SOURCE_VERSION,
|
99 |
description="indonli source schema",
|
100 |
schema="source",
|
101 |
subset_id="indonli",
|
102 |
),
|
103 |
+
SEACrowdConfig(
|
104 |
+
name="indonli_seacrowd_pairs",
|
105 |
+
version=SEACROWD_VERSION,
|
106 |
description="indonli Nusantara schema",
|
107 |
+
schema="seacrowd_pairs",
|
108 |
subset_id="indonli",
|
109 |
),
|
110 |
]
|
|
|
126 |
"label": datasets.Value("string"),
|
127 |
}
|
128 |
)
|
129 |
+
elif self.config.schema == "seacrowd_pairs":
|
130 |
features = schemas.pairs_features(self.labels)
|
131 |
|
132 |
return datasets.DatasetInfo(
|
|
|
178 |
}
|
179 |
yield example["pair_id"], example
|
180 |
|
181 |
+
elif self.config.schema == "seacrowd_pairs":
|
182 |
print(filepath)
|
183 |
with jsonlines.open(filepath) as f:
|
184 |
skip = [] # To avoid duplicate IDs
|