Datasets:
Upload dataset.py with huggingface_hub
Browse files- dataset.py +9 -1
dataset.py
CHANGED
|
@@ -27,7 +27,15 @@ class CocoBaseEval(datasets.GeneratorBasedBuilder):
|
|
| 27 |
]
|
| 28 |
|
| 29 |
def _generate_examples(self, data_file):
|
|
|
|
| 30 |
with open(data_file, "r") as f:
|
| 31 |
for idx, line in enumerate(f):
|
| 32 |
item = json.loads(line)
|
| 33 |
-
yield
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
]
|
| 28 |
|
| 29 |
def _generate_examples(self, data_file):
|
| 30 |
+
import json
|
| 31 |
with open(data_file, "r") as f:
|
| 32 |
for idx, line in enumerate(f):
|
| 33 |
item = json.loads(line)
|
| 34 |
+
# Make sure we yield the full item with all fields
|
| 35 |
+
yield idx, {
|
| 36 |
+
"image_id": item["image_id"],
|
| 37 |
+
"image": item["image"],
|
| 38 |
+
"input_prompt": item["input_prompt"],
|
| 39 |
+
"gt_objects": item["gt_objects"],
|
| 40 |
+
"gt_captions": item["gt_captions"]
|
| 41 |
+
}
|