From a1e2e2324ce6df49d3b5a4273764db0dd9bef757 Mon Sep 17 00:00:00 2001 From: Zafir Stojanovski Date: Sun, 16 Feb 2025 15:39:10 +0100 Subject: [PATCH] strip answer and solution --- reasoning_gym/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reasoning_gym/dataset.py b/reasoning_gym/dataset.py index 78ab7fc2..7c929454 100644 --- a/reasoning_gym/dataset.py +++ b/reasoning_gym/dataset.py @@ -53,9 +53,10 @@ class ProceduralDataset(ABC, Sized, Iterable[Dict[str, Any]]): def score_answer(self, answer: Optional[str], entry: Dict[str, any]) -> float: """Overwrite this method in derived classes if a single oracle answer is not available.""" - oracle_answer = entry["answer"] + oracle_answer = entry["answer"].strip() reward = 0.0 if answer is not None and len(answer) > 0: + answer = answer.strip() if answer == oracle_answer: reward = 1.0 elif oracle_answer in answer: