mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-28 17:29:39 +00:00
fix: Ensure color cube rotation dataset always includes valid rotations
This commit is contained in:
parent
7715cd228f
commit
a4181a5ad4
1 changed files with 8 additions and 5 deletions
|
|
@ -119,11 +119,14 @@ class ColorCubeRotationDataset(ProceduralDataset):
|
||||||
# Generate sequence of rotations
|
# Generate sequence of rotations
|
||||||
num_rotations = rng.randint(self.config.min_rotations, self.config.max_rotations)
|
num_rotations = rng.randint(self.config.min_rotations, self.config.max_rotations)
|
||||||
rotations = []
|
rotations = []
|
||||||
for _ in range(num_rotations):
|
|
||||||
from_side = rng.choice(list(Side))
|
# Keep trying until we have at least one valid rotation
|
||||||
if from_side != Side.TOP: # Skip meaningless top-to-top rotation
|
while len(rotations) < num_rotations:
|
||||||
rotations.append(from_side)
|
# Get all sides except TOP
|
||||||
self._rotate_to_top(cube, from_side)
|
available_sides = [s for s in Side if s != Side.TOP]
|
||||||
|
from_side = rng.choice(available_sides)
|
||||||
|
rotations.append(from_side)
|
||||||
|
self._rotate_to_top(cube, from_side)
|
||||||
|
|
||||||
# Select target side for question
|
# Select target side for question
|
||||||
target_side = rng.choice(list(Side))
|
target_side = rng.choice(list(Side))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue