LiLei
commited on
Commit
•
b282208
1
Parent(s):
215d4fe
update
Browse files
VEC.py
CHANGED
@@ -62,8 +62,8 @@ _URLS = {
|
|
62 |
|
63 |
|
64 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
65 |
-
class
|
66 |
-
"""
|
67 |
|
68 |
VERSION = datasets.Version("1.1.0")
|
69 |
|
@@ -160,23 +160,23 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
160 |
# Yields examples as (key, example) tuples
|
161 |
# {"sub": "jacket", "obj": "black", "alt": "purple"}
|
162 |
yield f"{self.config.name}-{key}", {
|
163 |
-
"obj": data['sub'],
|
164 |
-
"positive": data['obj'],
|
165 |
-
"negative": data['alt'],
|
166 |
"relation": self.config.name # change to prompt template later
|
167 |
}
|
168 |
elif self.config.name in ["shape", "height"]: # shape
|
169 |
#{"text": "An ant and a bird.", "question": "Is an ant taller than a bird?", "obj_a": "ant", "obj_b": "bird", "label": 0, "obj1": "ant", "obj2": "bird"}
|
170 |
yield f"{self.config.name}-{key}", {
|
171 |
-
"obj1": data['obj1'],
|
172 |
-
"obj2": data['obj2'],
|
173 |
"relation": self.config.name, # change to prompt template later
|
174 |
"label": data['label']
|
175 |
}
|
176 |
else: # hardness, mass, temperature
|
177 |
yield f"{self.config.name}-{key}", {
|
178 |
-
"obj1": data['obj1'],
|
179 |
-
"obj2": data['obj2'],
|
180 |
"relation": self.config.name,
|
181 |
"label": data['label'],
|
182 |
}
|
|
|
62 |
|
63 |
|
64 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
65 |
+
class VECDataset(datasets.GeneratorBasedBuilder):
|
66 |
+
"""VEC dataset for evaluating visual and embodied concepts"""
|
67 |
|
68 |
VERSION = datasets.Version("1.1.0")
|
69 |
|
|
|
160 |
# Yields examples as (key, example) tuples
|
161 |
# {"sub": "jacket", "obj": "black", "alt": "purple"}
|
162 |
yield f"{self.config.name}-{key}", {
|
163 |
+
"obj": data['sub'].strip(),
|
164 |
+
"positive": data['obj'].strip(),
|
165 |
+
"negative": data['alt'].strip(),
|
166 |
"relation": self.config.name # change to prompt template later
|
167 |
}
|
168 |
elif self.config.name in ["shape", "height"]: # shape
|
169 |
#{"text": "An ant and a bird.", "question": "Is an ant taller than a bird?", "obj_a": "ant", "obj_b": "bird", "label": 0, "obj1": "ant", "obj2": "bird"}
|
170 |
yield f"{self.config.name}-{key}", {
|
171 |
+
"obj1": data['obj1'].strip(),
|
172 |
+
"obj2": data['obj2'].strip(),
|
173 |
"relation": self.config.name, # change to prompt template later
|
174 |
"label": data['label']
|
175 |
}
|
176 |
else: # hardness, mass, temperature
|
177 |
yield f"{self.config.name}-{key}", {
|
178 |
+
"obj1": data['obj1'].strip(),
|
179 |
+
"obj2": data['obj2'].strip(),
|
180 |
"relation": self.config.name,
|
181 |
"label": data['label'],
|
182 |
}
|