mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
pass config to ProceduralDataset base
This commit is contained in:
parent
df2b8d2809
commit
e9549f2a63
20 changed files with 45 additions and 80 deletions
|
|
@ -31,7 +31,7 @@ class NumberSequenceConfig:
|
|||
seed: Optional[int] = None
|
||||
size: int = 500 # Virtual dataset size
|
||||
|
||||
def validate(self):
|
||||
def validate(self) -> None:
|
||||
"""Validate configuration parameters"""
|
||||
assert self.min_terms >= 4, "need at least 4 terms to establish pattern"
|
||||
assert self.max_terms >= self.min_terms
|
||||
|
|
@ -155,9 +155,7 @@ class NumberSequenceDataset(ProceduralDataset):
|
|||
"""Generates number sequence completion tasks with dynamic pattern generation"""
|
||||
|
||||
def __init__(self, config: NumberSequenceConfig):
|
||||
self.config = config
|
||||
self.config.validate()
|
||||
super().__init__(seed=config.seed, size=config.size)
|
||||
super().__init__(config=config, seed=config.seed, size=config.size)
|
||||
|
||||
def __getitem__(self, idx: int) -> dict:
|
||||
"""Generate a sequence task with a newly generated pattern"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue