Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
clefourrier committed Jan 30, 2024
1 parent b52d6c0 commit 9146477
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/lighteval/tasks/tasks_prompt_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def bbh(line, instruction, choices, task_name: str = None):
target_for_fewshot_sorting=[f" {c}" for c in choices],
instruction=instruction
)

def bbh_boolean_expressions(line, task_name: str = None):
instruction = "Evaluate the result of a random Boolean expression.\n\n"
choices = ["False", "True"]
return bbh(line, instruction, choices, task_name)

def bbh_causal_judgement(line, task_name: str = None):
instruction = "Answer questions about causal attribution.\n\n"
choices = ["Yes", "No"]
Expand All @@ -145,128 +145,128 @@ def bbh_disambiguation_qa(line, task_name: str = None):
instruction = "Clarify the meaning of sentences with ambiguous pronouns.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:3]]
return bbh(line, instruction, choices, task_name)

def bbh_dyck_languages(line, task_name: str = None): # Can only be done in generative
instruction = "Correctly close a Dyck-n word.\n\n"
choices = [line["target"]]
return bbh(line, instruction, choices, task_name)

def bbh_formal_fallacies(line, task_name: str = None):
instruction = "Distinguish deductively valid arguments from formal fallacies.\n\n"
choices = ["valid", "invalid"]
return bbh(line, instruction, choices, task_name)

def bbh_geometric_shapes(line, task_name: str = None):
instruction = "Name geometric shapes from their SVG paths.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:11]]
return bbh(line, instruction, choices, task_name)

def bbh_hyperbaton(line, task_name: str = None):
instruction = "Order adjectives correctly in English sentences.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:2]]
return bbh(line, instruction, choices, task_name)

def bbh_logical_deduction_five_objects(line, task_name: str = None):
instruction = "A logical deduction task which requires deducing the order of a sequence of objects.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:5]]
return bbh(line, instruction, choices, task_name)

def bbh_logical_deduction_seven_objects(line, task_name: str = None):
instruction = "A logical deduction task which requires deducing the order of a sequence of objects.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:7]]
return bbh(line, instruction, choices, task_name)

def bbh_logical_deduction_three_objects(line, task_name: str = None):
instruction = "A logical deduction task which requires deducing the order of a sequence of objects.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:3]]
return bbh(line, instruction, choices, task_name)

def bbh_movie_recommendation(line, task_name: str = None):
if line["target"] == "Monsters, Inc": # this line is not correctly formatted
hlog_warn("One sample removed from task bbh:movie_recommentation because its line is incorrectly formatted.")
return []
instruction = "Recommend movies similar to the given list of movies.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:6]]
return bbh(line, instruction, choices, task_name)

def bbh_multistep_arithmetic_two(line, task_name: str = None):
instruction = "Solve multi-step arithmetic problems.\n\n" # Can only be done in generative
choices = [line["target"]]
return bbh(line, instruction, choices, task_name)

def bbh_navigate(line, task_name: str = None):
instruction = "Given a series of navigation instructions, determine whether one would end up back at the starting point.\n\n"
choices = ["Yes", "No"]
return bbh(line, instruction, choices, task_name)

def bbh_object_counting(line, task_name: str = None):
instruction = "Questions that involve enumerating objects and asking the model to count them.\n\n"
choices = [str(i) for i in range(1, 19)]
return bbh(line, instruction, choices, task_name)

def bbh_penguins_in_a_table(line, task_name: str = None):
instruction = "Answer questions about a table of penguins and their attributes.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:5]]
return bbh(line, instruction, choices, task_name)

def bbh_reasoning_about_colored_objects(line, task_name: str = None):
instruction = "Answer extremely simple questions about the colors of objects on a surface.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:18]]
return bbh(line, instruction, choices, task_name)

def bbh_ruin_names(line, task_name: str = None):
if line["target"] in ["dearth, wind, & fire", "rita, sue and bob poo"]: # line not correctly formatted
hlog_warn("One sample removed from task bbh:ruin_names because its line is incorrectly formatted.")
return []
instruction = "Select the humorous edit that 'ruins' the input movie or musical artist name.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:6]]
return bbh(line, instruction, choices, task_name)

def bbh_salient_translation_error_detection(line, task_name: str = None):
instruction = "Detect the type of error in an English translation of a German source sentence.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:6]]
return bbh(line, instruction, choices, task_name)

def bbh_snarks(line, task_name: str = None):
instruction = "Determine which of two sentences is sarcastic.\n\nAccording to Cambridge University Dictionary, sarcasm is \"the use of remarks that clearly mean the opposite of what they say, made in order to hurt someone's feelings or to criticize something in a humorous way.\" Sarcastic sentences often contain satirical or ironic utterances, hyperboles, ambivalent or witty remarks.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:2]]
return bbh(line, instruction, choices, task_name)

def bbh_sports_understanding(line, task_name: str = None):
instruction = "Determine whether an artificially constructed sentence relating to sports is plausible or not.\n\n"
choices = ["yes", "no"]
return bbh(line, instruction, choices, task_name)

def bbh_temporal_sequences(line, task_name: str = None):
instruction = "Task description: Answer questions about which times certain events could have occurred.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:4]]
return bbh(line, instruction, choices, task_name)

def bbh_tracking_shuffled_objects_five_objects(line, task_name: str = None):
instruction = "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:5]]
return bbh(line, instruction, choices, task_name)

def bbh_tracking_shuffled_objects_seven_objects(line, task_name: str = None):
instruction = "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:7]]
return bbh(line, instruction, choices, task_name)

def bbh_tracking_shuffled_objects_three_objects(line, task_name: str = None):
instruction = "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n"
choices = [f"({c})" for c in LETTER_INDICES[:3]]
return bbh(line, instruction, choices, task_name)

def bbh_web_of_lies(line, task_name: str = None):
instruction = "Evaluate a random boolean function expressed as a word problem.\n\n"
choices = ["Yes", "No"]
return bbh(line, instruction, choices, task_name)

def bbh_word_sorting(line, task_name: str = None):
instruction = "Sort a list of words.\n\n" # Can only be done in generative
choices = [line['target']]
return bbh(line, instruction, choices, task_name)


def bbq(line, task_name: str = None): # HELM
query = f"The following are multiple choice questions (with answers).\nPassage: {line['context']}\nQuestion: {line['question']}"
Expand Down

0 comments on commit 9146477

Please sign in to comment.