Commit c74e2761 authored by lintangsutawika's avatar lintangsutawika
Browse files

reformat

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