mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-24 17:05:03 +00:00
added quantum lock curriculum (#324)
This commit is contained in:
parent
e9944149bd
commit
91b3347d53
3 changed files with 94 additions and 6 deletions
|
|
@ -4,6 +4,7 @@ from dataclasses import dataclass
|
|||
from random import Random
|
||||
from typing import Any, Optional
|
||||
|
||||
from ..coaching import AttributeType, BaseCurriculum, ScalarAttributeDefinition
|
||||
from ..factory import ProceduralDataset, register_dataset
|
||||
|
||||
|
||||
|
|
@ -47,14 +48,15 @@ Buttons:
|
|||
- metadata: dict with generation parameters
|
||||
"""
|
||||
rng = Random(self.seed + idx)
|
||||
difficulty = rng.randint(1, self.config.difficulty)
|
||||
|
||||
puzzle_data = self.generate_quantum_puzzle(rng, self.config.difficulty)
|
||||
puzzle_data = self.generate_quantum_puzzle(rng, difficulty)
|
||||
|
||||
return {
|
||||
"question": self.format_puzzle(rng.choice(self._prompt_templates), puzzle=puzzle_data),
|
||||
"answer": " → ".join(puzzle_data["solution"]),
|
||||
"metadata": {
|
||||
"difficulty": self.config.difficulty,
|
||||
"metadata": {"difficulty": difficulty},
|
||||
"solution_path": puzzle_data["solution"],
|
||||
"target_value": puzzle_data["target_value"],
|
||||
"buttons": puzzle_data["buttons"],
|
||||
|
|
@ -233,5 +235,21 @@ Buttons:
|
|||
)
|
||||
|
||||
|
||||
class QuantumLockCurriculum(BaseCurriculum):
|
||||
def __init__(self):
|
||||
super().__init__(QuantumLockCurriculum.__name__, QuantumLockConfig)
|
||||
self._define_attributes(
|
||||
ScalarAttributeDefinition(
|
||||
name="difficulty",
|
||||
field_name="difficulty",
|
||||
levels=list(range(1, 11)),
|
||||
default_level=0,
|
||||
attr_type=AttributeType.STATIC,
|
||||
description="The difficulty of the puzzle",
|
||||
min_value=1,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# Register the dataset
|
||||
register_dataset("quantum_lock", QuantumLockDataset, QuantumLockConfig)
|
||||
register_dataset("quantum_lock", QuantumLockDataset, QuantumLockConfig, QuantumLockCurriculum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue