holylovenia commited on
Commit
d8920f4
1 Parent(s): bbfac91

Upload indonli.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. indonli.py +13 -13
indonli.py CHANGED
@@ -35,9 +35,9 @@ from typing import List
35
  import datasets
36
  import jsonlines
37
 
38
- from nusacrowd.utils import schemas
39
- from nusacrowd.utils.configs import NusantaraConfig
40
- from nusacrowd.utils.constants import Tasks
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 nusantara 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,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
- _NUSANTARA_VERSION = "1.0.0"
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
- NUSANTARA_VERSION = datasets.Version(_NUSANTARA_VERSION)
94
 
95
  BUILDER_CONFIGS = [
96
- NusantaraConfig(
97
  name="indonli_source",
98
  version=SOURCE_VERSION,
99
  description="indonli source schema",
100
  schema="source",
101
  subset_id="indonli",
102
  ),
103
- NusantaraConfig(
104
- name="indonli_nusantara_pairs",
105
- version=NUSANTARA_VERSION,
106
  description="indonli Nusantara schema",
107
- schema="nusantara_pairs",
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 == "nusantara_pairs":
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 == "nusantara_pairs":
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