Skip to content

Commit

Permalink
fix gen_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
baberabb committed Jan 22, 2025
1 parent 2bc9aa6 commit 6580aab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lm_eval/tasks/ruler/cwe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def sys_word_pair_random(
)

gen_prefix_index = input_text.rfind(" Answer")
gen_prefix = input_text[gen_prefix_index:].strip()
# gen_prefix = input_text[gen_prefix_index:].strip()
input_text = input_text[:gen_prefix_index]
formatted_output = {
"index": index,
Expand All @@ -154,7 +154,7 @@ def sys_word_pair_random(
"outputs": answer,
"length": length,
"max_length": max_seq_length,
"gen_prefix": gen_prefix,
"gen_prefix": "Answer: The top 10 words that appear most often in the list are:",
}
write_jsons.append(formatted_output)

Expand Down
2 changes: 1 addition & 1 deletion lm_eval/tasks/ruler/fwe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
"tokens_to_generate": 50,
"template": """Read the following coded text and track the frequency of each coded word. Find the three most frequently appeared coded words. {context}\nQuestion: Do not provide any explanation. Please ignore the dots '....'. What are the three most frequently appeared words in the above coded text?""",
"answer_prefix": """ Answer: According to the coded text above, the three most frequently appeared words are:""",
"answer_prefix": """Answer: According to the coded text above, the three most frequently appeared words are:""",
},
)

Expand Down
2 changes: 1 addition & 1 deletion lm_eval/tasks/ruler/qa_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
config = {
"tokens_to_generate": 32,
"template": """Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}""",
"answer_prefix": """ Answer:""",
"answer_prefix": """Answer:""",
}
SEED = 42
TEMPLATE = """Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}"""
Expand Down
4 changes: 2 additions & 2 deletions lm_eval/tasks/ruler/vt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"variable_tracking": {
"tokens_to_generate": 30,
"template": """Memorize and track the chain(s) of variable assignment hidden in the following text.\n\n{context}\nQuestion: Find all variables that are assigned the value {query} in the text above.""",
"answer_prefix": """ Answer: According to the chain(s) of variable assignment in the text above, {num_v} variables are assgined the value {query}, they are: """,
"answer_prefix": """Answer: According to the chain(s) of variable assignment in the text above, {num_v} variables are assigned the value {query}, they are:""",
},
}

Expand Down Expand Up @@ -215,7 +215,7 @@ def sys_vartrack_w_noise_random(
"outputs": answer,
"length": length,
"max_length": max_seq_length,
"gen_prefix": gen_prefix,
"gen_prefix": gen_prefix.strip(),
}
write_jsons.append(formatted_output)

Expand Down

0 comments on commit 6580aab

Please sign in to comment.