Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lighteval/tasks/tasks/asdiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def asdiv_prompt(line, task_name: str = None):
return Doc(
task_name=task_name,
query=f"{line['body']}\nQuestion:{line['question']}\nAnswer:",
choices=line["answer"].split(" (")[0],
choices=[line["answer"].split(" (")[0]],
gold_index=[0],
)

Expand Down
15 changes: 15 additions & 0 deletions tests/unit/tasks/test_asdiv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from lighteval.tasks.tasks.asdiv import asdiv_prompt


def test_asdiv_prompt_keeps_full_gold_answer():
# asdiv stored choices as a bare string, so Doc.get_golds() indexed the
# string and truncated a multi-character answer to its first character
# (e.g. "35" -> "3"). choices must be a list so the gold answer survives.
line = {
"body": "There are some apples.",
"question": "How many apples are there?",
"answer": "35 (apples)",
}
doc = asdiv_prompt(line)
assert doc.choices == ["35"]
assert doc.get_golds() == ["35"]