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
|
|
@ -16,7 +16,7 @@ class PrimeFactorizationConfig:
|
|||
seed: Optional[int] = None
|
||||
size: int = 500 # Virtual dataset size
|
||||
|
||||
def validate(self):
|
||||
def validate(self) -> None:
|
||||
"""Validate configuration parameters"""
|
||||
assert self.min_value >= 2, "min_value must be >= 2"
|
||||
assert self.max_value >= self.min_value, "max_value must be >= min_value"
|
||||
|
|
@ -26,9 +26,7 @@ class PrimeFactorizationDataset(ProceduralDataset):
|
|||
"""Generates prime factorization tasks"""
|
||||
|
||||
def __init__(self, config: PrimeFactorizationConfig):
|
||||
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 _prime_factors(self, n: int) -> List[int]:
|
||||
"""Compute prime factors of a number"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue