"vscode:/vscode.git/clone" did not exist on "23bd3449624883fa3d6322d8444ca3bfa76eaa97"
Commit af6e46fd authored by lintangsutawika's avatar lintangsutawika
Browse files

added prompt and output variations

parent 66421b57
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_06 group: mathqa_alt_ov_06
group_alias: style_06 task: mathqa_alt_ov_06b
task: mathqa_06b
task_alias: b
doc_to_text: !function ../styles.template_06 doc_to_text: !function ../styles.template_06
doc_to_choice: !function ../styles.choice_06b doc_to_choice: !function ../styles.choice_06b
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_06 group: mathqa_alt_ov_06
group_alias: style_06 task: mathqa_alt_ov_06c
task: mathqa_06c
task_alias: c
doc_to_text: !function ../styles.template_06 doc_to_text: !function ../styles.template_06
doc_to_choice: !function ../styles.choice_06c doc_to_choice: !function ../styles.choice_06c
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_07 group: mathqa_alt_ov_07
group_alias: style_07 task: mathqa_alt_ov_07a
task: mathqa_07a
task_alias: a
doc_to_text: !function ../styles.template_07 doc_to_text: !function ../styles.template_07
doc_to_choice: !function ../styles.choice_07a doc_to_choice: !function ../styles.choice_07a
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_07 group: mathqa_alt_ov_07
group_alias: style_07 task: mathqa_alt_ov_07b
task: mathqa_07b
task_alias: b
doc_to_text: !function ../styles.template_07 doc_to_text: !function ../styles.template_07
doc_to_choice: !function ../styles.choice_07b doc_to_choice: !function ../styles.choice_07b
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_07 group: mathqa_alt_ov_07
group_alias: style_07 task: mathqa_alt_ov_07c
task: mathqa_07c
task_alias: c
doc_to_text: !function ../styles.template_07 doc_to_text: !function ../styles.template_07
doc_to_choice: !function ../styles.choice_07c doc_to_choice: !function ../styles.choice_07c
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_08 group: mathqa_alt_ov_08
group_alias: style_08 task: mathqa_alt_ov_08a
task: mathqa_08a
task_alias: a
doc_to_text: !function ../styles.template_08 doc_to_text: !function ../styles.template_08
doc_to_choice: !function ../styles.choice_08a doc_to_choice: !function ../styles.choice_08a
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_08 group: mathqa_alt_ov_08
group_alias: style_08 task: mathqa_alt_ov_08b
task: mathqa_08b
task_alias: b
doc_to_text: !function ../styles.template_08 doc_to_text: !function ../styles.template_08
doc_to_choice: !function ../styles.choice_08b doc_to_choice: !function ../styles.choice_08b
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_08 group: mathqa_alt_ov_08
group_alias: style_08 task: mathqa_alt_ov_08c
task: mathqa_08c
task_alias: c
doc_to_text: !function ../styles.template_08 doc_to_text: !function ../styles.template_08
doc_to_choice: !function ../styles.choice_08c doc_to_choice: !function ../styles.choice_08c
...@@ -2,7 +2,6 @@ import re ...@@ -2,7 +2,6 @@ import re
import string import string
from functools import partial from functools import partial
def parse_choices(doc): def parse_choices(doc):
choices = [ choices = [
c[4:].rstrip(" ,") c[4:].rstrip(" ,")
...@@ -10,58 +9,43 @@ def parse_choices(doc): ...@@ -10,58 +9,43 @@ def parse_choices(doc):
] ]
return choices return choices
def doc_to_text_base(alphabet, style, doc): def doc_to_text_base(alphabet, style, doc):
choices = parse_choices(doc) choices = parse_choices(doc)
num = len(choices) num = len(choices)
letter_list = [style.format(letter) for letter in alphabet[0:num]] letter_list = [style.format(letter) for letter in alphabet[0:num]]
if "\t" in style: if "\t" in style:
choice_string = "{}{}" choice_string = "{}{}"
else: else:
choice_string = "{} {}" choice_string = "{} {}"
doc_to_text = "\n\n".join( doc_to_text = "\n".join(
[doc["Problem"]] ["Question: " + doc["Problem"]]
+ [choice_string.format(i, j) for i, j in zip(letter_list, choices)] + [choice_string.format(i, j) for i, j in zip(letter_list, choices)]
+ ["Answer:"]
) )
return doc_to_text return doc_to_text
# Full continuation # Full continuation
def choice_A(doc): def choice_A(doc):
return parse_choices(doc) return parse_choices(doc)
# Letters only # Letters only
def choice_B(alphabet, style, doc): def choice_B(alphabet, style, doc):
choices = parse_choices(doc) choices = parse_choices(doc)
num = len(choices) num = len(choices)
letter_list = [style.format(letter) for letter in alphabet[0:num]] letter_list = [style.format(letter) for letter in alphabet[0:num]]
if "\t" in style: if "\t" in style:
letter_list = [letter.replace("\t", "") for letter in letter_list] letter_list = [letter.replace("\t", "") for letter in letter_list]
return letter_list return letter_list
# Letters + Full continuation # Letters + Full continuation
def choice_C(alphabet, style, doc): def choice_C(alphabet, style, doc):
choices = parse_choices(doc) choices = parse_choices(doc)
num = len(choices) num = len(choices)
letter_list = [style.format(letter) for letter in alphabet[0:num]] letter_list = [style.format(letter) for letter in alphabet[0:num]]
if "\t" not in style: if "\t" not in style:
letter_list = [letter + " " for letter in letter_list] letter_list = [letter + " " for letter in letter_list]
return [letter + choice for letter, choice in zip(letter_list, choices)] return [letter + choice for letter, choice in zip(letter_list, choices)]
template_01 = partial(doc_to_text_base, string.ascii_lowercase, "({})") template_01 = partial(doc_to_text_base, string.ascii_lowercase, "({})")
choice_01a = choice_A choice_01a = choice_A
choice_01b = partial(choice_B, string.ascii_lowercase, "({})") choice_01b = partial(choice_B, string.ascii_lowercase, "({})")
......
group: mathqa_alt_pv
task: mathqa_alt_pv_01
dataset_path: math_qa
output_type: multiple_choice
training_split: train
validation_split: validation
test_split: test
doc_to_text: "{{Problem}}"
doc_to_target: "{{['a', 'b', 'c', 'd', 'e'].index(correct)}}"
doc_to_choice: !function ../../utils.doc_to_choice
should_decontaminate: true
doc_to_decontamination_query: "{{Problem}}"
metric_list:
- metric: acc
- metric: acc_norm
- metric: brier_score
group: mathqa_alt_pv
task: mathqa_alt_pv_02
dataset_path: math_qa
output_type: multiple_choice
training_split: train
validation_split: validation
test_split: test
doc_to_text: "Q: {{Problem}}\nA:"
doc_to_target: "{{['a', 'b', 'c', 'd', 'e'].index(correct)}}"
doc_to_choice: !function ../../utils.doc_to_choice
should_decontaminate: true
doc_to_decontamination_query: "Q: {{Problem}}\nA:"
metric_list:
- metric: acc
- metric: acc_norm
- metric: brier_score
group: mathqa_alt_pv
task: mathqa_alt_pv_03
dataset_path: math_qa
output_type: multiple_choice
training_split: train
validation_split: validation
test_split: test
doc_to_text: "Question: {{Problem}}\nAnswer:"
doc_to_target: "{{['a', 'b', 'c', 'd', 'e'].index(correct)}}"
doc_to_choice: !function ../../utils.doc_to_choice
should_decontaminate: true
doc_to_decontamination_query: "Question: {{Problem}}\nAnswer:"
metric_list:
- metric: acc
- metric: acc_norm
- metric: brier_score
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment