FranciscoLozDataScience
commited on
Commit
·
15a6da2
1
Parent(s):
f1f47d6
changed prompt and choice features settings
Browse files- smokedataset_QA.py +8 -6
smokedataset_QA.py
CHANGED
@@ -41,8 +41,8 @@ class smokedataset_QA(datasets.GeneratorBasedBuilder):
|
|
41 |
{
|
42 |
"image": datasets.Image(),
|
43 |
"label": datasets.ClassLabel(names=_NAMES),
|
44 |
-
"prompt":
|
45 |
-
"choices":
|
46 |
}
|
47 |
),
|
48 |
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
@@ -71,13 +71,15 @@ class smokedataset_QA(datasets.GeneratorBasedBuilder):
|
|
71 |
# These kwargs will be passed to _generate_examples
|
72 |
gen_kwargs={
|
73 |
"images": dl_manager.iter_archive(data_dir),
|
74 |
-
"split": "test"
|
|
|
|
|
75 |
},
|
76 |
)
|
77 |
]
|
78 |
|
79 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
80 |
-
def _generate_examples(self, images, split):
|
81 |
for file_path, file_obj in images:
|
82 |
label = file_path.split("/")[1]
|
83 |
splitfolder = file_path.split("/")[0]
|
@@ -85,6 +87,6 @@ class smokedataset_QA(datasets.GeneratorBasedBuilder):
|
|
85 |
yield file_path,{
|
86 |
"image": {"path": file_path, "bytes": file_obj.read()},
|
87 |
"label": label,
|
88 |
-
"prompt":
|
89 |
-
"choices":
|
90 |
}
|
|
|
41 |
{
|
42 |
"image": datasets.Image(),
|
43 |
"label": datasets.ClassLabel(names=_NAMES),
|
44 |
+
"prompt": datasets.prompt(),
|
45 |
+
"choices": datasets.choices()
|
46 |
}
|
47 |
),
|
48 |
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
|
|
71 |
# These kwargs will be passed to _generate_examples
|
72 |
gen_kwargs={
|
73 |
"images": dl_manager.iter_archive(data_dir),
|
74 |
+
"split": "test",
|
75 |
+
"prompt": _PROMPT,
|
76 |
+
"choices": _CHOICES
|
77 |
},
|
78 |
)
|
79 |
]
|
80 |
|
81 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
82 |
+
def _generate_examples(self, images, prompt, choices, split):
|
83 |
for file_path, file_obj in images:
|
84 |
label = file_path.split("/")[1]
|
85 |
splitfolder = file_path.split("/")[0]
|
|
|
87 |
yield file_path,{
|
88 |
"image": {"path": file_path, "bytes": file_obj.read()},
|
89 |
"label": label,
|
90 |
+
"prompt": prompt,
|
91 |
+
"choices": choices
|
92 |
}
|