mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Fix bug in normalize_answer method (#444)
This commit is contained in:
parent
c0e98f93b4
commit
9053009dbe
2 changed files with 8 additions and 1 deletions
|
|
@ -49,7 +49,10 @@ class PrimeFactorizationDataset(ProceduralDataset):
|
|||
|
||||
def _normalize_answer(self, answer: str) -> list[int]:
|
||||
"""Parse and sort factors from a string"""
|
||||
return sorted([int(factor.strip()) for factor in answer.split("×")])
|
||||
if not answer or answer.strip() == "":
|
||||
return []
|
||||
|
||||
return sorted([int(factor.strip()) for factor in answer.split("×") if factor.strip() != ""])
|
||||
|
||||
def score_answer(self, answer: Optional[str], entry: dict[str, Any]) -> float:
|
||||
oracle_answer = entry["answer"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue