mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-27 17:23:19 +00:00
Merge pull request #136 from zafstojano/fix/leg-counting
fix(env): Leg Counting
This commit is contained in:
commit
a9f5c2dea4
1 changed files with 19 additions and 6 deletions
|
|
@ -54,14 +54,29 @@ ANIMALS = {
|
||||||
"woodlouse": 14,
|
"woodlouse": 14,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUESTION_TEMPLATE = """Your task is to count how many legs there are in total when given a list of animals.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Input: How many legs are there in total if you have 1 duck, 2 deers, 1 spider, 3 cows?
|
||||||
|
- Output: 30
|
||||||
|
- Explanation:
|
||||||
|
- Ducks have 2 legs each, so 1 duck has 2 legs.
|
||||||
|
- Deers have 4 legs each, so 2 deers have 8 legs.
|
||||||
|
- Spiders have 8 legs each, so 1 spider has 8 legs.
|
||||||
|
- Cows have 4 legs each, so 3 cows have 12 legs.
|
||||||
|
- Therefore, the total number of legs is 2 + 8 + 8 + 12 = 30
|
||||||
|
|
||||||
|
Now, how many legs are there in total if you have {animals}?
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LegCountingConfig:
|
class LegCountingConfig:
|
||||||
"""Configuration for leg counting task generation"""
|
"""Configuration for leg counting task generation"""
|
||||||
|
|
||||||
min_animals: int = 2 # Minimum number of animals in problem
|
min_animals: int = 3 # Minimum number of animals in problem
|
||||||
max_animals: int = 5 # Maximum number of animals
|
max_animals: int = 10 # Maximum number of animals
|
||||||
max_instances: int = 3 # Maximum instances of each animal
|
max_instances: int = 15 # Maximum instances of each animal
|
||||||
seed: Optional[int] = None
|
seed: Optional[int] = None
|
||||||
size: int = 500 # Virtual dataset size
|
size: int = 500 # Virtual dataset size
|
||||||
|
|
||||||
|
|
@ -106,10 +121,8 @@ class LegCountingDataset(ProceduralDataset):
|
||||||
for animal, count in animals.items():
|
for animal, count in animals.items():
|
||||||
animal_list.append(f"{count} {animal}{'s' if count > 1 else ''}")
|
animal_list.append(f"{count} {animal}{'s' if count > 1 else ''}")
|
||||||
|
|
||||||
question = "How many legs are there in total if you have " + ", ".join(animal_list) + "?"
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"question": question,
|
"question": QUESTION_TEMPLATE.format(animals=", ".join(animal_list)),
|
||||||
"answer": str(total_legs),
|
"answer": str(total_legs),
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"difficulty": {
|
"difficulty": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue