Fix streaming
Browse filesWe extend `open` to work in streaming mode, but we don't extend `jsonlines.open`
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
|
|
|
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']
|