mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-27 17:23:19 +00:00
BF Curricula and More (#309)
* bf curricula * modulo grid curricula * minor changes to how difficulty is stored --------- Co-authored-by: Andreas Koepf <andreas.koepf@provisio.com>
This commit is contained in:
parent
7c7c783883
commit
46013e4640
5 changed files with 122 additions and 7 deletions
|
|
@ -4,6 +4,7 @@ from typing import Any, Optional
|
|||
|
||||
import bfi
|
||||
|
||||
from ..coaching import AttributeType, BaseCurriculum, ScalarAttributeDefinition
|
||||
from ..data.wordle_words import wordle_words
|
||||
from ..factory import ProceduralDataset, register_dataset
|
||||
from .contrib.bfit.Compiler import Compiler, Minify
|
||||
|
|
@ -51,7 +52,11 @@ class BFDataset(ProceduralDataset):
|
|||
return {
|
||||
"question": rng.choice(self._prompt_templates).format(bf_program=bf_program),
|
||||
"answer": result,
|
||||
"metadata": {"bfit_code": bfit_code, "bf_program": bf_program},
|
||||
"metadata": {
|
||||
"bfit_code": bfit_code,
|
||||
"bf_program": bf_program,
|
||||
"difficulty": {"difficulty": self.config.difficulty},
|
||||
},
|
||||
}
|
||||
|
||||
def generate_bfit_code(self, difficulty, rng: Random) -> str:
|
||||
|
|
@ -139,5 +144,23 @@ int main() {{
|
|||
return 0.0
|
||||
|
||||
|
||||
class BFCurriculum(BaseCurriculum):
|
||||
def __init__(self):
|
||||
super().__init__(BFCurriculum.__name__, BFConfig)
|
||||
|
||||
# Define attributes
|
||||
self._define_attributes(
|
||||
ScalarAttributeDefinition(
|
||||
name="difficulty",
|
||||
field_name="difficulty",
|
||||
levels=[1, 2, 3],
|
||||
default_level=0,
|
||||
description="Difficulty level",
|
||||
attr_type=AttributeType.STATIC,
|
||||
min_value=1,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# Register the dataset
|
||||
register_dataset("bf", BFDataset, BFConfig)
|
||||
register_dataset("bf", BFDataset, BFConfig, BFCurriculum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue