mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-05-01 17:45:24 +00:00
implemented family_relationships score ans (#260)
This commit is contained in:
parent
478646622e
commit
bf24999bb0
1 changed files with 15 additions and 1 deletions
|
|
@ -2,7 +2,7 @@ import random
|
|||
from dataclasses import dataclass, field
|
||||
from enum import StrEnum
|
||||
from itertools import count
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from ..factory import ProceduralDataset, register_dataset
|
||||
|
||||
|
|
@ -356,5 +356,19 @@ class FamilyRelationshipsDataset(ProceduralDataset):
|
|||
|
||||
return " ".join(story_parts)
|
||||
|
||||
def score_answer(self, answer: Optional[str], entry: dict[str, Any]) -> float:
|
||||
reward = 0.0
|
||||
if answer is not None:
|
||||
try:
|
||||
answer_formatted = answer.strip().lower()
|
||||
solved = answer_formatted == entry["answer"].strip().lower()
|
||||
if solved:
|
||||
reward = 1.0
|
||||
else:
|
||||
reward = 0.01
|
||||
except:
|
||||
reward = 0.01
|
||||
return reward
|
||||
|
||||
|
||||
register_dataset("family_relationships", FamilyRelationshipsDataset, FamilyRelationshipsConfig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue