| 280 | |
| 281 | |
| 282 | def parse_question(example, data_name): |
| 283 | question = "" |
| 284 | if data_name == "asdiv": |
| 285 | question = f"{example['body'].strip()} {example['question'].strip()}" |
| 286 | elif data_name == "svamp": |
| 287 | body = example["Body"].strip() |
| 288 | if not body.endswith("."): |
| 289 | body = body + "." |
| 290 | question = f'{body} {example["Question"].strip()}' |
| 291 | elif data_name == "tabmwp": |
| 292 | title_str = f'regarding "{example["table_title"]}" ' if example['table_title'] else "" |
| 293 | question = f'Read the following table {title_str}and answer a question:\n' |
| 294 | question += f'{example["table"]}\n{example["question"]}' |
| 295 | if example['choices']: |
| 296 | question += f' Please select from the following options: {example["choices"]}' |
| 297 | else: |
| 298 | for key in ['question', 'problem', 'Question', 'input']: |
| 299 | if key in example: |
| 300 | question = example[key] |
| 301 | break |
| 302 | assert question != "" |
| 303 | return question.strip() |
| 304 | |
| 305 | |
| 306 | def run_execute(executor, result, prompt_type, execute=False): |