Fix streaming (#6)
Browse files- Fix streaming (041d8f53b7ef7ff2a2f936b1d426219dcf10ea9e)
Co-authored-by: Quentin Lhoest <[email protected]>
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']
|