mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-23 16:55:05 +00:00
feat(env): String Synthesis Curriculum (#308)
* string synthesis curriculum * difficulty metadata
This commit is contained in:
parent
037905667e
commit
a1dc28aa73
3 changed files with 63 additions and 5 deletions
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from reasoning_gym.algorithmic.string_synthesis import StringSynthesisConfig, StringSynthesisDataset
|
||||
from reasoning_gym.algorithmic.string_synthesis import (
|
||||
StringSynthesisConfig,
|
||||
StringSynthesisCurriculum,
|
||||
StringSynthesisDataset,
|
||||
)
|
||||
|
||||
|
||||
def test_string_synthesis_config_validation():
|
||||
|
|
@ -117,3 +121,24 @@ def test_string_synthesis_answer():
|
|||
[0, 1, 1, 2, 0, 0, 0, 0, 0], # Rule 1 again
|
||||
[0, 0, 0, 2, 1, 0, 0, 0, 0], # Rule 3 (final state)
|
||||
]
|
||||
|
||||
|
||||
def test_string_synthesis_curriculum():
|
||||
curriculum = StringSynthesisCurriculum()
|
||||
|
||||
base_value = {"size": 150, "seed": 1}
|
||||
|
||||
base_cfg: StringSynthesisConfig = curriculum.generate_configuration(base_value)
|
||||
assert base_cfg.seed == 1
|
||||
assert base_cfg.size == 150
|
||||
assert base_cfg.min_initial_blocks == 10 and base_cfg.max_initial_blocks == 50
|
||||
|
||||
# test incrementing attribute levels
|
||||
curriculum.increment_attr_level("initial_blocks")
|
||||
increased_cfg = curriculum.generate_configuration(base_value)
|
||||
assert increased_cfg.min_initial_blocks == 10 and increased_cfg.max_initial_blocks == 100
|
||||
|
||||
# test decrementing attribute level for initial_blocks again
|
||||
curriculum.decrement_attr_level("initial_blocks")
|
||||
partially_decreased_cfg = curriculum.generate_configuration(base_value)
|
||||
assert partially_decreased_cfg.min_initial_blocks == 10 and partially_decreased_cfg.max_initial_blocks == 50
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue