albertvillanova HF staff commited on
Commit
b8b80d7
1 Parent(s): d6e8397

Fix DuplicatedKeysError

Browse files

Fix DuplicatedKeysError, by using a unique key for each example.

Files changed (1) hide show
  1. ESCI-product-dataset.py +3 -1
ESCI-product-dataset.py CHANGED
@@ -71,8 +71,10 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
71
 
72
  def _generate_examples(self, files):
73
  """Yields examples."""
 
74
  for filepath in files:
75
  with open(filepath, encoding="utf-8") as f:
76
  for line in f:
77
  data = json.loads(line)
78
- yield data['query_id'], data
 
 
71
 
72
  def _generate_examples(self, files):
73
  """Yields examples."""
74
+ key = 0
75
  for filepath in files:
76
  with open(filepath, encoding="utf-8") as f:
77
  for line in f:
78
  data = json.loads(line)
79
+ yield key, data
80
+ key += 1