Commit c74e2761 authored by lintangsutawika's avatar lintangsutawika
Browse files

reformat

parent cc572624
include: ../_hellaswag_alt_yaml include: ../_hellaswag_alt_yaml
group: hellaswag_08 group: hellaswag_08
group_alias: style_08 group_alias: style_08
task: hellaswag_08b task: hellaswag_08b
task_alias: b 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
\ No newline at end of file
include: ../_hellaswag_alt_yaml include: ../_hellaswag_alt_yaml
group: hellaswag_08 group: hellaswag_08
group_alias: style_08 group_alias: style_08
task: hellaswag_08c task: hellaswag_08c
task_alias: c 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
\ No newline at end of file
import string import string
from functools import partial from functools import partial
def doc_to_text_base(alphabet, style, doc): def doc_to_text_base(alphabet, style, doc):
choices = doc["choices"] choices = doc["choices"]
...@@ -13,20 +14,22 @@ def doc_to_text_base(alphabet, style, doc): ...@@ -13,20 +14,22 @@ def doc_to_text_base(alphabet, style, doc):
else: else:
choice_string = "{} {}" choice_string = "{} {}"
doc_to_text = "\n\n".join([ doc_to_text = "\n\n".join(
doc["query"]+"...", [
" What is the most appropriate continuation?", doc["query"] + "...",
] + [ " What is the most appropriate continuation?",
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)]
) )
return doc_to_text return doc_to_text
# Full continuation # Full continuation
def choice_A(doc): def choice_A(doc):
return doc["choices"] return doc["choices"]
# Letters only # Letters only
def choice_B(alphabet, style, doc): def choice_B(alphabet, style, doc):
...@@ -35,10 +38,11 @@ def choice_B(alphabet, style, doc): ...@@ -35,10 +38,11 @@ def choice_B(alphabet, style, doc):
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):
...@@ -47,9 +51,10 @@ def choice_C(alphabet, style, doc): ...@@ -47,9 +51,10 @@ def choice_C(alphabet, style, doc):
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, doc["choices"])]
return [letter+choice for letter, choice in zip(letter_list, doc["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
...@@ -83,5 +88,3 @@ template_08 = partial(doc_to_text_base, string.ascii_uppercase, "{}\t") ...@@ -83,5 +88,3 @@ template_08 = partial(doc_to_text_base, string.ascii_uppercase, "{}\t")
choice_08a = choice_A choice_08a = choice_A
choice_08b = partial(choice_B, string.ascii_uppercase, "{}\t") choice_08b = partial(choice_B, string.ascii_uppercase, "{}\t")
choice_08c = partial(choice_C, string.ascii_uppercase, "{}\t") choice_08c = partial(choice_C, string.ascii_uppercase, "{}\t")
...@@ -15,6 +15,6 @@ Answer types: ...@@ -15,6 +15,6 @@ Answer types:
- original option - original option
- just letter - just letter
- letters + continuation - letters + continuation
- original option - original option
- just letter - just letter
- continuation - continuation
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_01 group: mathqa_01
group_alias: style_01 group_alias: style_01
task: mathqa_01a task: mathqa_01a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_01 doc_to_text: !function ../styles.template_01
doc_to_choice: !function ../styles.choice_01a doc_to_choice: !function ../styles.choice_01a
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_01 group: mathqa_01
group_alias: style_01 group_alias: style_01
task: mathqa_01b task: mathqa_01b
task_alias: b task_alias: b
doc_to_text: !function ../styles.template_01 doc_to_text: !function ../styles.template_01
doc_to_choice: !function ../styles.choice_01b doc_to_choice: !function ../styles.choice_01b
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_01 group: mathqa_01
group_alias: style_01 group_alias: style_01
task: mathqa_01c task: mathqa_01c
task_alias: c task_alias: c
doc_to_text: !function ../styles.template_01 doc_to_text: !function ../styles.template_01
doc_to_choice: !function ../styles.choice_01c doc_to_choice: !function ../styles.choice_01c
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_02 group: mathqa_02
group_alias: style_02 group_alias: style_02
task: mathqa_02a task: mathqa_02a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_02 doc_to_text: !function ../styles.template_02
doc_to_choice: !function ../styles.choice_02a doc_to_choice: !function ../styles.choice_02a
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_02 group: mathqa_02
group_alias: style_02 group_alias: style_02
task: mathqa_02b task: mathqa_02b
task_alias: b task_alias: b
doc_to_text: !function ../styles.template_02 doc_to_text: !function ../styles.template_02
doc_to_choice: !function ../styles.choice_02b doc_to_choice: !function ../styles.choice_02b
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_02 group: mathqa_02
group_alias: style_02 group_alias: style_02
task: mathqa_02c task: mathqa_02c
task_alias: c task_alias: c
doc_to_text: !function ../styles.template_02 doc_to_text: !function ../styles.template_02
doc_to_choice: !function ../styles.choice_02c doc_to_choice: !function ../styles.choice_02c
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_03 group: mathqa_03
group_alias: style_03 group_alias: style_03
task: mathqa_03a task: mathqa_03a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_03 doc_to_text: !function ../styles.template_03
doc_to_choice: !function ../styles.choice_03a doc_to_choice: !function ../styles.choice_03a
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_03 group: mathqa_03
group_alias: style_03 group_alias: style_03
task: mathqa_03b task: mathqa_03b
task_alias: b task_alias: b
doc_to_text: !function ../styles.template_03 doc_to_text: !function ../styles.template_03
doc_to_choice: !function ../styles.choice_03b doc_to_choice: !function ../styles.choice_03b
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_03 group: mathqa_03
group_alias: style_03 group_alias: style_03
task: mathqa_03c task: mathqa_03c
task_alias: c task_alias: c
doc_to_text: !function ../styles.template_03 doc_to_text: !function ../styles.template_03
doc_to_choice: !function ../styles.choice_03c doc_to_choice: !function ../styles.choice_03c
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_04 group: mathqa_04
group_alias: style_04 group_alias: style_04
task: mathqa_04a task: mathqa_04a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_04 doc_to_text: !function ../styles.template_04
doc_to_choice: !function ../styles.choice_04a doc_to_choice: !function ../styles.choice_04a
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_04 group: mathqa_04
group_alias: style_04 group_alias: style_04
task: mathqa_04b task: mathqa_04b
task_alias: b task_alias: b
doc_to_text: !function ../styles.template_04 doc_to_text: !function ../styles.template_04
doc_to_choice: !function ../styles.choice_04b doc_to_choice: !function ../styles.choice_04b
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_04 group: mathqa_04
group_alias: style_04 group_alias: style_04
task: mathqa_04c task: mathqa_04c
task_alias: c task_alias: c
doc_to_text: !function ../styles.template_04 doc_to_text: !function ../styles.template_04
doc_to_choice: !function ../styles.choice_04c doc_to_choice: !function ../styles.choice_04c
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_05 group: mathqa_05
group_alias: style_05 group_alias: style_05
task: mathqa_05a task: mathqa_05a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_05 doc_to_text: !function ../styles.template_05
doc_to_choice: !function ../styles.choice_05a doc_to_choice: !function ../styles.choice_05a
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_05 group: mathqa_05
group_alias: style_05 group_alias: style_05
task: mathqa_05b task: mathqa_05b
task_alias: b task_alias: b
doc_to_text: !function ../styles.template_05 doc_to_text: !function ../styles.template_05
doc_to_choice: !function ../styles.choice_05b doc_to_choice: !function ../styles.choice_05b
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_05 group: mathqa_05
group_alias: style_05 group_alias: style_05
task: mathqa_05c task: mathqa_05c
task_alias: c task_alias: c
doc_to_text: !function ../styles.template_05 doc_to_text: !function ../styles.template_05
doc_to_choice: !function ../styles.choice_05c doc_to_choice: !function ../styles.choice_05c
\ No newline at end of file
include: ../_mathqa_alt_yaml include: ../_mathqa_alt_yaml
group: mathqa_06 group: mathqa_06
group_alias: style_06 group_alias: style_06
task: mathqa_06a task: mathqa_06a
task_alias: a task_alias: a
doc_to_text: !function ../styles.template_06 doc_to_text: !function ../styles.template_06
doc_to_choice: !function ../styles.choice_06a doc_to_choice: !function ../styles.choice_06a
\ No newline at end of file
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