Support streaming ocnli config

#3
by albertvillanova HF staff - opened
Files changed (1) hide show
  1. clue.py +18 -2
clue.py CHANGED
@@ -299,8 +299,12 @@ class Clue(datasets.GeneratorBasedBuilder):
299
  text_features={"sentence1": "sentence1", "sentence2": "sentence2"},
300
  label_classes=["neutral", "entailment", "contradiction"],
301
  label_column="label",
302
- data_url="https://github.com/CLUEbenchmark/OCNLI/archive/02d55cb3c7dc984682677b8dd81db6a1e4710720.zip",
303
- data_dir="OCNLI-02d55cb3c7dc984682677b8dd81db6a1e4710720/data/ocnli",
 
 
 
 
304
  url="https://arxiv.org/abs/2010.05444",
305
  citation=textwrap.dedent(
306
  """\
@@ -405,6 +409,18 @@ class Clue(datasets.GeneratorBasedBuilder):
405
  )
406
 
407
  def _split_generators(self, dl_manager):
 
 
 
 
 
 
 
 
 
 
 
 
408
  dl_dir = dl_manager.download_and_extract(self.config.data_url)
409
  data_dir = os.path.join(dl_dir, self.config.data_dir)
410
 
 
299
  text_features={"sentence1": "sentence1", "sentence2": "sentence2"},
300
  label_classes=["neutral", "entailment", "contradiction"],
301
  label_column="label",
302
+ # From: https://github.com/CLUEbenchmark/OCNLI/archive/02d55cb3c7dc984682677b8dd81db6a1e4710720.zip
303
+ data_url={
304
+ "test": "https://raw.githubusercontent.com/CLUEbenchmark/OCNLI/02d55cb3c7dc984682677b8dd81db6a1e4710720/data/ocnli/test.json",
305
+ "train": "https://raw.githubusercontent.com/CLUEbenchmark/OCNLI/02d55cb3c7dc984682677b8dd81db6a1e4710720/data/ocnli/train.json",
306
+ "validation": "https://raw.githubusercontent.com/CLUEbenchmark/OCNLI/02d55cb3c7dc984682677b8dd81db6a1e4710720/data/ocnli/dev.json",
307
+ },
308
  url="https://arxiv.org/abs/2010.05444",
309
  citation=textwrap.dedent(
310
  """\
 
409
  )
410
 
411
  def _split_generators(self, dl_manager):
412
+ if self.config.name == "ocnli":
413
+ data_dir = dl_manager.download_and_extract(self.config.data_url)
414
+ return [
415
+ datasets.SplitGenerator(
416
+ name=split,
417
+ gen_kwargs={
418
+ "data_file": data_dir[split],
419
+ "split": split,
420
+ },
421
+ )
422
+ for split in [datasets.Split.TEST, datasets.Split.TRAIN, datasets.Split.VALIDATION]
423
+ ]
424
  dl_dir = dl_manager.download_and_extract(self.config.data_url)
425
  data_dir = os.path.join(dl_dir, self.config.data_dir)
426