system HF staff commited on
Commit
cff2f9e
1 Parent(s): cb6d728

Update files from the datasets library (from 1.6.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.6.0

Files changed (1) hide show
  1. clue.py +3 -8
clue.py CHANGED
@@ -16,15 +16,12 @@
16
  # Lint as: python3
17
  """A Chinese Language Understanding Evaluation Benchmark (CLUE) benchmark."""
18
 
19
- from __future__ import absolute_import, division, print_function
20
 
21
  import json
22
  import os
23
  import re
24
  import textwrap
25
 
26
- import six
27
-
28
  import datasets
29
 
30
 
@@ -335,9 +332,7 @@ class Clue(datasets.GeneratorBasedBuilder):
335
 
336
  def _info(self):
337
  if self.config.name in ["afqmc", "tnews", "iflytek", "cmnli", "diagnostics", "ocnli"]:
338
- features = {
339
- text_feature: datasets.Value("string") for text_feature in six.iterkeys(self.config.text_features)
340
- }
341
  if self.config.label_classes:
342
  features["label"] = datasets.features.ClassLabel(names=self.config.label_classes)
343
  else:
@@ -514,7 +509,7 @@ class Clue(datasets.GeneratorBasedBuilder):
514
  else:
515
  for n, line in enumerate(f):
516
  row = json.loads(line)
517
- example = {feat: row[col] for feat, col in six.iteritems(self.config.text_features)}
518
  example["idx"] = n if self.config.name != "diagnostics" else int(row["index"])
519
  if self.config.name == "chid": # CHID has a separate gold label file
520
  contents = example["content"]
@@ -546,7 +541,7 @@ class Clue(datasets.GeneratorBasedBuilder):
546
  example["label"] = process_label(-1)
547
 
548
  # Filter out corrupted rows.
549
- for value in six.itervalues(example):
550
  if value is None:
551
  break
552
  else:
 
16
  # Lint as: python3
17
  """A Chinese Language Understanding Evaluation Benchmark (CLUE) benchmark."""
18
 
 
19
 
20
  import json
21
  import os
22
  import re
23
  import textwrap
24
 
 
 
25
  import datasets
26
 
27
 
 
332
 
333
  def _info(self):
334
  if self.config.name in ["afqmc", "tnews", "iflytek", "cmnli", "diagnostics", "ocnli"]:
335
+ features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features.keys()}
 
 
336
  if self.config.label_classes:
337
  features["label"] = datasets.features.ClassLabel(names=self.config.label_classes)
338
  else:
 
509
  else:
510
  for n, line in enumerate(f):
511
  row = json.loads(line)
512
+ example = {feat: row[col] for feat, col in self.config.text_features.items()}
513
  example["idx"] = n if self.config.name != "diagnostics" else int(row["index"])
514
  if self.config.name == "chid": # CHID has a separate gold label file
515
  contents = example["content"]
 
541
  example["label"] = process_label(-1)
542
 
543
  # Filter out corrupted rows.
544
+ for value in example.values():
545
  if value is None:
546
  break
547
  else: