akommula commited on
Commit
2628555
·
1 Parent(s): c8bfa06

Adding Tasks 1, 3, 4, 7

Browse files
Files changed (1) hide show
  1. openpi_v2.py +121 -16
openpi_v2.py CHANGED
@@ -106,7 +106,101 @@ class OpenpiV2(datasets.GeneratorBasedBuilder):
106
  }"""
107
  ),
108
  url = _HOMEPAGE
109
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  ]
111
 
112
  def _info(self):
@@ -145,20 +239,31 @@ class OpenpiV2(datasets.GeneratorBasedBuilder):
145
  def _generate_examples(self, filepath):
146
  logger.info("generating examples from = %s", filepath)
147
 
148
- with open(filepath) as f:
149
- dataset = json.load(f)
 
 
 
 
 
 
150
 
151
- for id_ in dataset:
152
- print (dataset[id_])
153
- print ("--------------")
154
- print (filepath)
155
-
156
- yield int(id_), {
157
- "goal": dataset[id_]["goal"],
158
- "steps": dataset[id_]["steps"],
159
- "topics": dataset[id_]["topics"],
160
- "image_urls": dataset[id_]["image_urls"],
161
- "states": dataset[id_]["states"],
162
- }
163
-
 
 
 
164
 
 
 
 
106
  }"""
107
  ),
108
  url = _HOMEPAGE
109
+ ),
110
+ OpenpiConfig(
111
+ name = "Task 1"
112
+ description = textrwap.dedent(
113
+ """\
114
+ Given paragraph (e.g., with 5 steps), identify entities that change
115
+ (challenge: implicit entities, some explicit entities that don’t change)."""
116
+ ),
117
+ features = dataset.Features({
118
+ "steps": [datasets.Value("string")]
119
+ "entity_changes": [datasets.Value("string")]
120
+ })
121
+ data_url = _URLS,
122
+ citation = textwrap.dedent(
123
+ """\
124
+ @inproceedings{
125
+ title={},
126
+ author={},
127
+ booktitle={},
128
+ year={}
129
+ }"""
130
+ ),
131
+ url = _HOMEPAGE
132
+ ),
133
+ OpenpiConfig(
134
+ name = "Task 3"
135
+ description = textrwap.dedent(
136
+ """\
137
+ Given paragraph (e.g., with 5 steps), identify the attributes of entity that change
138
+ (challenge: implicit entities, attributes & many combinations)."""
139
+ ),
140
+ features = dataset.Features({
141
+ "steps": [datasets.Value("string")]
142
+ "attr_entity_changes": [datasets.Value("string")]
143
+ })
144
+ data_url = _URLS,
145
+ citation = textwrap.dedent(
146
+ """\
147
+ @inproceedings{
148
+ title={},
149
+ author={},
150
+ booktitle={},
151
+ year={}
152
+ }"""
153
+ ),
154
+ url = _HOMEPAGE
155
+ ),
156
+ OpenpiConfig(
157
+ name = "Task 4"
158
+ description = textrwap.dedent(
159
+ """\
160
+ Task 4: Given paragraph & an entity, identify the sequence of attribute value changes
161
+ (challenge: implicit attributes)."""
162
+ ),
163
+ features = dataset.Features({
164
+ "steps": [datasets.Value("string")]
165
+ "entity": datasets.Value("string")
166
+ "attribute_changes": [datasets.Value("string")]
167
+ })
168
+ data_url = _URLS,
169
+ citation = textwrap.dedent(
170
+ """\
171
+ @inproceedings{
172
+ title={},
173
+ author={},
174
+ booktitle={},
175
+ year={}
176
+ }"""
177
+ ),
178
+ url = _HOMEPAGE
179
+ ),
180
+ OpenpiConfig(
181
+ name = "Task 7"
182
+ description = textrwap.dedent(
183
+ """\
184
+ Task 7: Given image url, identify the visual attributes of entity and
185
+ non-visual attributes of entity that change."""
186
+ ),
187
+ features = dataset.Features({
188
+ "image_url": datasets.Value("string")
189
+ "visual_attr": [datasets.Value("string")]
190
+ "non_visual_attr": [datasets.Value("string")]
191
+ })
192
+ data_url = _URLS,
193
+ citation = textwrap.dedent(
194
+ """\
195
+ @inproceedings{
196
+ title={},
197
+ author={},
198
+ booktitle={},
199
+ year={}
200
+ }"""
201
+ ),
202
+ url = _HOMEPAGE
203
+ ),
204
  ]
205
 
206
  def _info(self):
 
239
  def _generate_examples(self, filepath):
240
  logger.info("generating examples from = %s", filepath)
241
 
242
+ if self.config.name == "openpi_text":
243
+ with open(filepath) as f:
244
+ dataset = json.load(f)
245
+
246
+ for id_ in dataset:
247
+ print (dataset[id_])
248
+ print ("--------------")
249
+ print (filepath)
250
 
251
+ yield int(id_), {
252
+ "goal": dataset[id_]["goal"],
253
+ "steps": dataset[id_]["steps"],
254
+ "topics": dataset[id_]["topics"],
255
+ "image_urls": dataset[id_]["image_urls"],
256
+ "states": dataset[id_]["states"],
257
+ }
258
+
259
+ elif self.config.name == "Task 1":
260
+ pass
261
+
262
+ elif self.config.name == "Task 3":
263
+ pass
264
+
265
+ elif self.config.name == "Task 4":
266
+ pass
267
 
268
+ elif self.config.name == "Task 7":
269
+ pass