Update fixtures-captioning.py
Browse files- fixtures-captioning.py +3 -2
fixtures-captioning.py
CHANGED
|
@@ -31,6 +31,7 @@ class FixturesCaptioningConfig(datasets.BuilderConfig):
|
|
| 31 |
self.data_url = data_url
|
| 32 |
self.url = url
|
| 33 |
self.task_templates = task_templates
|
|
|
|
| 34 |
class FixturesCaptioning(datasets.GeneratorBasedBuilder):
|
| 35 |
"""Fixtures for captioning and VQA models. Includes 4 images."""
|
| 36 |
BUILDER_CONFIGS = [
|
|
@@ -58,7 +59,7 @@ class FixturesCaptioning(datasets.GeneratorBasedBuilder):
|
|
| 58 |
def _split_generators(self, dl_manager):
|
| 59 |
DL_URLS = [
|
| 60 |
f"https://huggingface.co/datasets/hf-internal-testing/fixtures-captioning/raw/main/{name}"
|
| 61 |
-
for name in
|
| 62 |
]
|
| 63 |
archive_path = dl_manager.download_and_extract(DL_URLS)
|
| 64 |
return [
|
|
@@ -70,7 +71,7 @@ class FixturesCaptioning(datasets.GeneratorBasedBuilder):
|
|
| 70 |
def _generate_examples(self, archive_path):
|
| 71 |
"""Generate examples."""
|
| 72 |
for i, filename in enumerate(archive_path):
|
| 73 |
-
key =
|
| 74 |
example = {
|
| 75 |
"id": key,
|
| 76 |
"file": filename,
|
|
|
|
| 31 |
self.data_url = data_url
|
| 32 |
self.url = url
|
| 33 |
self.task_templates = task_templates
|
| 34 |
+
self.ordered_images_list = ["bbox_sample_image.jpeg", "bus.png", "chart.png", "skateboard.png"]
|
| 35 |
class FixturesCaptioning(datasets.GeneratorBasedBuilder):
|
| 36 |
"""Fixtures for captioning and VQA models. Includes 4 images."""
|
| 37 |
BUILDER_CONFIGS = [
|
|
|
|
| 59 |
def _split_generators(self, dl_manager):
|
| 60 |
DL_URLS = [
|
| 61 |
f"https://huggingface.co/datasets/hf-internal-testing/fixtures-captioning/raw/main/{name}"
|
| 62 |
+
for name in self.ordered_images_list
|
| 63 |
]
|
| 64 |
archive_path = dl_manager.download_and_extract(DL_URLS)
|
| 65 |
return [
|
|
|
|
| 71 |
def _generate_examples(self, archive_path):
|
| 72 |
"""Generate examples."""
|
| 73 |
for i, filename in enumerate(archive_path):
|
| 74 |
+
key = self.ordered_images_list[i]
|
| 75 |
example = {
|
| 76 |
"id": key,
|
| 77 |
"file": filename,
|