mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-28 17:29:39 +00:00
added family relatinship curriculum (#359)
This commit is contained in:
parent
9df5aabbcc
commit
4df3a3b92b
3 changed files with 78 additions and 7 deletions
|
|
@ -1,7 +1,12 @@
|
|||
import pytest
|
||||
|
||||
from reasoning_gym import create_dataset
|
||||
from reasoning_gym.graphs.family_relationships import FamilyRelationshipsDataset, Relationship
|
||||
from reasoning_gym.graphs.family_relationships import (
|
||||
FamilyRelationshipsConfig,
|
||||
FamilyRelationshipsCurriculum,
|
||||
FamilyRelationshipsDataset,
|
||||
Relationship,
|
||||
)
|
||||
|
||||
|
||||
def test_family_relationships_generation():
|
||||
|
|
@ -83,3 +88,46 @@ def test_relationship_consistency():
|
|||
Relationship.FATHER_IN_LAW.value,
|
||||
]:
|
||||
assert "married to" in item["question"] or "child" in item["question"]
|
||||
|
||||
|
||||
def test_family_relationships_curriculum():
|
||||
"""Test the family relationships curriculum functionality"""
|
||||
curriculum = FamilyRelationshipsCurriculum()
|
||||
|
||||
base_value = {"size": 50, "seed": 42}
|
||||
|
||||
# Test default configuration
|
||||
base_cfg: FamilyRelationshipsConfig = curriculum.generate_configuration(base_value)
|
||||
assert base_cfg.seed == 42
|
||||
assert base_cfg.size == 50
|
||||
assert base_cfg.min_family_size == 3 and base_cfg.max_family_size == 3 # Default level 0
|
||||
|
||||
# Test incrementing family_size attribute
|
||||
curriculum.increment_attr_level("family_size")
|
||||
first_level_cfg = curriculum.generate_configuration(base_value)
|
||||
assert first_level_cfg.min_family_size == 3 and first_level_cfg.max_family_size == 4 # Level 1
|
||||
|
||||
# Test incrementing family_size attribute again
|
||||
curriculum.increment_attr_level("family_size")
|
||||
second_level_cfg = curriculum.generate_configuration(base_value)
|
||||
assert second_level_cfg.min_family_size == 3 and second_level_cfg.max_family_size == 5 # Level 2
|
||||
|
||||
# Test decrementing family_size attribute
|
||||
curriculum.decrement_attr_level("family_size")
|
||||
back_to_first_cfg = curriculum.generate_configuration(base_value)
|
||||
assert back_to_first_cfg.min_family_size == 3 and back_to_first_cfg.max_family_size == 4 # Back to level 1
|
||||
|
||||
# Test global level setting
|
||||
curriculum.set_global_level(5) # Set to level 5
|
||||
level_five_cfg = curriculum.generate_configuration(base_value)
|
||||
assert level_five_cfg.min_family_size == 3 and level_five_cfg.max_family_size == 8 # Level 5
|
||||
|
||||
# Test increment global level
|
||||
curriculum.increment_global_level() # Should go to level 6
|
||||
level_six_cfg = curriculum.generate_configuration(base_value)
|
||||
assert level_six_cfg.min_family_size == 3 and level_six_cfg.max_family_size == 9 # Level 6
|
||||
|
||||
# Test decrement global level
|
||||
curriculum.decrement_global_level() # Should go back to level 5
|
||||
back_to_five_cfg = curriculum.generate_configuration(base_value)
|
||||
assert back_to_five_cfg.min_family_size == 3 and back_to_five_cfg.max_family_size == 8 # Back to level 5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue