zyznull commited on
Commit
3b243dd
1 Parent(s): 84b35d6

Update msmarco-passage-corpus.py

Browse files
Files changed (1) hide show
  1. msmarco-passage-corpus.py +7 -7
msmarco-passage-corpus.py CHANGED
@@ -62,16 +62,16 @@ class MsMarcoPassage(datasets.GeneratorBasedBuilder):
62
  datasets.SplitGenerator(
63
  name=split,
64
  gen_kwargs={
65
- "filepath": [downloaded_files[split]] if isinstance(downloaded_files[split], str) else downloaded_files[split],
66
  },
67
  ) for split in downloaded_files
68
  ]
69
  return splits
70
 
71
- def _generate_examples(self, filepath):
72
  """Yields examples."""
73
- with open(filepath, encoding="utf-8") as f:
74
- texts = f.readlines()
75
- for i, text in enumerate(texts):
76
- text = json.loads(text)
77
- yield i, text
 
62
  datasets.SplitGenerator(
63
  name=split,
64
  gen_kwargs={
65
+ "files": [downloaded_files[split]] if isinstance(downloaded_files[split], str) else downloaded_files[split],
66
  },
67
  ) for split in downloaded_files
68
  ]
69
  return splits
70
 
71
+ def _generate_examples(self, files):
72
  """Yields examples."""
73
+ for filepath in files:
74
+ with open(filepath, encoding="utf-8") as f:
75
+ for i, text in enumerate(f):
76
+ text = json.loads(text)
77
+ yield i, text