mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-28 17:29:39 +00:00
Template Abstraction
This commit is contained in:
parent
227319f1da
commit
c2e3dbc826
8 changed files with 325 additions and 387 deletions
|
|
@ -12,6 +12,7 @@ class AttributeType(Enum):
|
|||
STATIC = "static" # Each level is independent
|
||||
UBOUND = "ubound" # Each level is an upper bound
|
||||
APPEND = "append" # Each level includes all previous levels
|
||||
APPEND_LIST = "append_list" # Each level includes all previous levels
|
||||
|
||||
@dataclass
|
||||
class AttributeDefinition:
|
||||
|
|
@ -143,4 +144,9 @@ class AttributeDefinition:
|
|||
available_values = self.levels[:level + 1]
|
||||
return lambda: rng.choice(available_values)
|
||||
|
||||
case AttributeType.APPEND_LIST:
|
||||
# Returns random choice from accumulated values up to current level
|
||||
available_values = sum(self.levels[:level + 1], [])
|
||||
return lambda: rng.choice(available_values)
|
||||
|
||||
raise ValueError(f"Unknown attribute type: {self.attr_type} for attribute '{self.description}'")
|
||||
Loading…
Add table
Add a link
Reference in a new issue