Fix streaming

#6
by lhoestq HF staff - opened
Files changed (1) hide show
  1. pmc_oa.py +3 -2
pmc_oa.py CHANGED
@@ -108,8 +108,9 @@ class PMC_OA(datasets.GeneratorBasedBuilder):
108
  def _generate_examples(self, filepath, image_dir):
109
  """Yields examples."""
110
  logger.info("generating examples from = %s", filepath)
111
-
112
- with jsonlines.open(filepath) as reader:
 
113
  for _id, obj in enumerate(reader):
114
  if self.config.name == "pmc_oa_beta":
115
  relative_image_path = obj['image']
 
108
  def _generate_examples(self, filepath, image_dir):
109
  """Yields examples."""
110
  logger.info("generating examples from = %s", filepath)
111
+
112
+ with open(filepath, encoding="utf-8") as f:
113
+ reader = jsonlines.open(f)
114
  for _id, obj in enumerate(reader):
115
  if self.config.name == "pmc_oa_beta":
116
  relative_image_path = obj['image']