realZillionX commited on
Commit
f750715
·
verified ·
1 Parent(s): b33bc01

Add files using upload-large-folder tool

Browse files
Files changed (49) hide show
  1. .gitattributes +4 -21
  2. README.md +299 -0
  3. data/in_context_learning/spiral_matrix-00000-of-00001.parquet +3 -0
  4. data/in_context_learning/tile_color_sequence-00000-of-00001.parquet +3 -0
  5. data/in_context_learning/venn_intersection_count-00000-of-00001.parquet +3 -0
  6. data/rearrangement_game/bookshelf_sort_by_height-00000-of-00001.parquet +3 -0
  7. data/rearrangement_game/bus_stops_dispatch-00000-of-00003.parquet +3 -0
  8. data/rearrangement_game/bus_stops_dispatch-00001-of-00003.parquet +3 -0
  9. data/rearrangement_game/bus_stops_dispatch-00002-of-00003.parquet +3 -0
  10. data/rearrangement_game/chess_pawn_swap-00000-of-00002.parquet +3 -0
  11. data/rearrangement_game/chess_pawn_swap-00001-of-00002.parquet +3 -0
  12. data/rearrangement_game/color_group_with_locks-00000-of-00002.parquet +3 -0
  13. data/rearrangement_game/color_group_with_locks-00001-of-00002.parquet +3 -0
  14. data/rearrangement_game/crane_block_stack-00000-of-00002.parquet +3 -0
  15. data/rearrangement_game/dock_yard_crane_swap-00000-of-00002.parquet +3 -0
  16. data/rearrangement_game/dock_yard_crane_swap-00001-of-00002.parquet +3 -0
  17. data/rearrangement_game/filing_cabinet_alphabet_lock-00000-of-00002.parquet +3 -0
  18. data/rearrangement_game/filing_cabinet_alphabet_lock-00001-of-00002.parquet +3 -0
  19. data/rearrangement_game/jumping_frog_swap-00000-of-00002.parquet +3 -0
  20. data/rearrangement_game/jumping_frog_swap-00001-of-00002.parquet +3 -0
  21. data/rearrangement_game/lever_crane_swap-00000-of-00002.parquet +3 -0
  22. data/rearrangement_game/lever_crane_swap-00001-of-00002.parquet +3 -0
  23. data/rearrangement_game/maze_rush_hour-00001-of-00003.parquet +3 -0
  24. data/rearrangement_game/maze_rush_hour-00002-of-00003.parquet +3 -0
  25. data/rearrangement_game/meal_train_pass_serve-00000-of-00003.parquet +3 -0
  26. data/rearrangement_game/meal_train_pass_serve-00001-of-00003.parquet +3 -0
  27. data/rearrangement_game/meal_train_pass_serve-00002-of-00003.parquet +3 -0
  28. data/rearrangement_game/office_inbox_priority_pull-00000-of-00002.parquet +3 -0
  29. data/rearrangement_game/office_inbox_priority_pull-00001-of-00002.parquet +3 -0
  30. data/rearrangement_game/pancake_flip-00000-of-00002.parquet +3 -0
  31. data/rearrangement_game/pancake_flip-00001-of-00002.parquet +3 -0
  32. data/rearrangement_game/parking_2d_n_by_n-00000-of-00002.parquet +3 -0
  33. data/rearrangement_game/parking_2d_n_by_n-00001-of-00002.parquet +3 -0
  34. data/rearrangement_game/pipeline_hold_cells_3-00000-of-00003.parquet +3 -0
  35. data/rearrangement_game/pipeline_hold_cells_3-00001-of-00003.parquet +3 -0
  36. data/rearrangement_game/pipeline_hold_cells_3-00002-of-00003.parquet +3 -0
  37. data/rearrangement_game/sliding_tile_15-00000-of-00002.parquet +3 -0
  38. data/rearrangement_game/sliding_tile_15-00001-of-00002.parquet +3 -0
  39. data/rearrangement_game/stack_reversal_minimal_moves-00000-of-00002.parquet +3 -0
  40. data/rearrangement_game/stack_reversal_minimal_moves-00001-of-00002.parquet +3 -0
  41. data/rearrangement_game/token_trade_matrix-00000-of-00003.parquet +3 -0
  42. data/rearrangement_game/token_trade_matrix-00001-of-00003.parquet +3 -0
  43. data/rearrangement_game/token_trade_matrix-00002-of-00003.parquet +3 -0
  44. data/rearrangement_game/tower_of_hanoi-00001-of-00002.parquet +3 -0
  45. data/rearrangement_game/train_couple_swap-00000-of-00002.parquet +3 -0
  46. data/rearrangement_game/train_couple_swap-00001-of-00002.parquet +3 -0
  47. data/rearrangement_game/vending_dispense_fifo-00000-of-00002.parquet +3 -0
  48. data/rearrangement_game/vending_dispense_fifo-00001-of-00002.parquet +3 -0
  49. unpack.py +158 -0
.gitattributes CHANGED
@@ -1,6 +1,5 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.avro filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
5
  *.bz2 filter=lfs diff=lfs merge=lfs -text
6
  *.ckpt filter=lfs diff=lfs merge=lfs -text
@@ -10,7 +9,6 @@
10
  *.joblib filter=lfs diff=lfs merge=lfs -text
11
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
  *.lz4 filter=lfs diff=lfs merge=lfs -text
13
- *.mds filter=lfs diff=lfs merge=lfs -text
14
  *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
  *.model filter=lfs diff=lfs merge=lfs -text
16
  *.msgpack filter=lfs diff=lfs merge=lfs -text
@@ -36,25 +34,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  *.zip filter=lfs diff=lfs merge=lfs -text
37
  *.zst filter=lfs diff=lfs merge=lfs -text
38
  *tfevents* filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - uncompressed
40
- *.pcm filter=lfs diff=lfs merge=lfs -text
41
- *.sam filter=lfs diff=lfs merge=lfs -text
42
- *.raw filter=lfs diff=lfs merge=lfs -text
43
- # Audio files - compressed
44
- *.aac filter=lfs diff=lfs merge=lfs -text
45
- *.flac filter=lfs diff=lfs merge=lfs -text
46
- *.mp3 filter=lfs diff=lfs merge=lfs -text
47
- *.ogg filter=lfs diff=lfs merge=lfs -text
48
- *.wav filter=lfs diff=lfs merge=lfs -text
49
- # Image files - uncompressed
50
- *.bmp filter=lfs diff=lfs merge=lfs -text
51
- *.gif filter=lfs diff=lfs merge=lfs -text
52
  *.png filter=lfs diff=lfs merge=lfs -text
53
- *.tiff filter=lfs diff=lfs merge=lfs -text
54
- # Image files - compressed
55
  *.jpg filter=lfs diff=lfs merge=lfs -text
56
  *.jpeg filter=lfs diff=lfs merge=lfs -text
57
- *.webp filter=lfs diff=lfs merge=lfs -text
58
- # Video files - compressed
59
- *.mp4 filter=lfs diff=lfs merge=lfs -text
60
- *.webm filter=lfs diff=lfs merge=lfs -text
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
 
3
  *.bin filter=lfs diff=lfs merge=lfs -text
4
  *.bz2 filter=lfs diff=lfs merge=lfs -text
5
  *.ckpt filter=lfs diff=lfs merge=lfs -text
 
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
  *.lz4 filter=lfs diff=lfs merge=lfs -text
 
12
  *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
  *.model filter=lfs diff=lfs merge=lfs -text
14
  *.msgpack filter=lfs diff=lfs merge=lfs -text
 
34
  *.zip filter=lfs diff=lfs merge=lfs -text
35
  *.zst filter=lfs diff=lfs merge=lfs -text
36
  *tfevents* filter=lfs diff=lfs merge=lfs -text
37
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
39
  *.png filter=lfs diff=lfs merge=lfs -text
 
 
40
  *.jpg filter=lfs diff=lfs merge=lfs -text
41
  *.jpeg filter=lfs diff=lfs merge=lfs -text
42
+ canonical_manifest.jsonl filter=lfs diff=lfs merge=lfs -text
43
+ training_profile.json filter=lfs diff=lfs merge=lfs -text
 
 
README.md CHANGED
@@ -1,3 +1,302 @@
1
  ---
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
  license: apache-2.0
5
+ pretty_name: VideoGym-Train
6
+ size_categories:
7
+ - 100K<n<1M
8
+ task_categories:
9
+ - image-to-video
10
+ - text-to-video
11
+ tags:
12
+ - video-generation
13
+ - image-to-video
14
+ - visual-reasoning
15
+ - procedural-generation
16
+ - sft
17
+ - rlvr
18
+ - videogym
19
+ configs:
20
+ - config_name: default
21
+ default: true
22
+ data_files:
23
+ - split: train
24
+ path: data/*/*.parquet
25
+ - config_name: geometry
26
+ data_files:
27
+ - split: train
28
+ path: data/geometry/*.parquet
29
+ - config_name: next_state_prediction
30
+ data_files:
31
+ - split: train
32
+ path: data/next_state_prediction/*.parquet
33
+ - config_name: spatial_navigation
34
+ data_files:
35
+ - split: train
36
+ path: data/spatial_navigation/*.parquet
37
+ - config_name: rearrangement_game
38
+ data_files:
39
+ - split: train
40
+ path: data/rearrangement_game/*.parquet
41
+ - config_name: in_context_learning
42
+ data_files:
43
+ - split: train
44
+ path: data/in_context_learning/*.parquet
45
+ - config_name: graph_theory
46
+ data_files:
47
+ - split: train
48
+ path: data/graph_theory/*.parquet
49
+ - config_name: dynamics_game
50
+ data_files:
51
+ - split: train
52
+ path: data/dynamics_game/*.parquet
53
+ - config_name: constraint_grid
54
+ data_files:
55
+ - split: train
56
+ path: data/constraint_grid/*.parquet
57
+ - config_name: board_game
58
+ data_files:
59
+ - split: train
60
+ path: data/board_game/*.parquet
61
+ - config_name: physics
62
+ data_files:
63
+ - split: train
64
+ path: data/physics/*.parquet
65
+ - config_name: spatial_3d
66
+ data_files:
67
+ - split: train
68
+ path: data/spatial_3d/*.parquet
69
  ---
70
+
71
+ <div align="center">
72
+
73
+ # VideoGym-Train: Procedural Visual Reasoning Dataset for Video Generation
74
+
75
+ ### Official Training Dataset of *Can Video Generation Models Really Learn to Reason?*
76
+
77
+ <p align="center">
78
+ <img src="https://img.shields.io/badge/arXiv-Paper_(Coming_Soon)-B31B1B?style=flat-square&logo=arxiv&logoColor=white" alt="arXiv Paper">
79
+ <a href="https://videogym.github.io/VideoGym/"><img src="https://img.shields.io/badge/Project-Website-2E5AA8?style=flat-square" alt="Project Website"></a>
80
+ <a href="https://github.com/VideoGym/VideoGym"><img src="https://img.shields.io/badge/GitHub-VideoGym-181717?style=flat-square&logo=github&logoColor=white" alt="GitHub Code"></a>
81
+ <br>
82
+ <a href="https://huggingface.co/datasets/OpenMOSS-Team/VideoGym-Train"><img src="https://img.shields.io/badge/%F0%9F%A4%97_Dataset-VideoGym--Train-D99B26?style=flat-square" alt="VideoGym-Train"></a>
83
+ <a href="https://huggingface.co/datasets/OpenMOSS-Team/VideoGym-Test"><img src="https://img.shields.io/badge/%F0%9F%A4%97_Benchmark-VideoGym--Test-D99B26?style=flat-square" alt="VideoGym-Test"></a>
84
+ <a href="https://huggingface.co/OpenMOSS-Team/VideoGym-LTX-2.3"><img src="https://img.shields.io/badge/%F0%9F%A4%97_Model-VideoGym--LTX--2.3-D99B26?style=flat-square" alt="VideoGym-LTX-2.3"></a>
85
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-4B5563?style=flat-square" alt="License: Apache-2.0"></a>
86
+ </p>
87
+
88
+ [**Overview**](#overview) · [**Task Families**](#families) · [**Data Contract**](#contract) · [**Repository & Schema**](#schema) · [**Quick Start**](#quick-start) · [**Citation**](#citation)
89
+
90
+ </div>
91
+
92
+ ---
93
+
94
+ <p>
95
+ <img src="assets/figures/fig2_tasks.png" alt="Representative VideoGym tasks in the Single-Step Group and Multi-Step Group showing Input Image, Mid-Video Frame, and Final State" width="100%">
96
+ <sub><b>Figure 1. Representative In-Domain Tasks in VideoGym-Train.</b> Examples from the <b>Single-Step Group</b> (left: marking one fixed answer on an unchanging puzzle) and <b>Multi-Step Group</b> (right: sequential state transitions where each move updates the visual scene) across five task families.</sub>
97
+ </p>
98
+
99
+ <a id="overview"></a>
100
+
101
+ ## 🔎 Overview
102
+
103
+ **VideoGym-Train** is the official large-scale procedural video reasoning dataset of [**VideoGym**](https://github.com/VideoGym/VideoGym), comprising **245,884** verified examples across **246 In-Domain tasks** and **11 task families** (~1,000 instances per task). Each example pairs a clean `512×512` initial puzzle image <i>I</i><sub>0</sub>, a structured rule prompt <i>P</i> (`Input Image`, `Rule`, and `Required Output`) where the answer is never stated in advance, a `16 FPS` VP9 `.webm` reference solution video, and exact symbolic ground-truth state for deterministic full-video verification and RLVR reward scoring.
104
+
105
+ Together with the 6-level generalization benchmark [**VideoGym-Test**](https://huggingface.co/datasets/OpenMOSS-Team/VideoGym-Test) and the 22B full-DiT post-trained model [**VideoGym-LTX-2.3**](https://huggingface.co/OpenMOSS-Team/VideoGym-LTX-2.3), `VideoGym-Train` provides a controlled foundation for studying what SFT and RLVR actually teach video generation models.
106
+
107
+ <div style="overflow-x: auto;">
108
+
109
+ | Property | Specification |
110
+ | :--- | :--- |
111
+ | **Total&nbsp;Scale** | **245,884** training instances across **246** procedural tasks and **11** task families |
112
+ | **Task&nbsp;Groups** | **132** `Single-Step Group` tasks (131,992 videos) · **114** `Multi-Step Group` tasks (113,892 videos) |
113
+ | **Visual&nbsp;&&nbsp;Video&nbsp;Format** | `512×512` RGB PNG input image <i>I</i><sub>0</sub> · `512×512`, `16 FPS` VP9 `.webm` silent reference video |
114
+ | **Prompt&nbsp;Structure** | Explicit `Input Image`, `Rule`, and `Required Output` sections without answer leakage |
115
+ | **Symbolic&nbsp;Annotations** | Exact `semantic_input`, typed `ground_truth`, seed, and precomputed `training_profile.json` |
116
+ | **Storage&nbsp;Format** | Sharded Hugging Face Parquet (`Image()` + `Video()`) + `canonical_manifest.jsonl` + `unpack.py` |
117
+
118
+ </div>
119
+
120
+ <a id="families"></a>
121
+
122
+ ## 🧩 Task Groups & 11 Task Families
123
+
124
+ `VideoGym-Train` partitions its 246 tasks into two groups by rule-defined visual execution ("single-step" and "multi-step" describe visual scene execution rather than internal search depth or frame count):
125
+
126
+ <div style="overflow-x: auto;">
127
+
128
+ | Task&nbsp;Group | Tasks | Videos | Rule-Defined Visual Execution |
129
+ | :--- | ---: | ---: | :--- |
130
+ | **Single&#8209;Step&nbsp;Group** | 132&nbsp;(53.66%) | 131,992&nbsp;(53.68%) | Marks one fixed answer on an unchanging puzzle (e.g., N-Queens, Eulerian trail, circumcenter) or applies one simultaneous update; progressive stroke drawing never alters the underlying puzzle state. |
131
+ | **Multi&#8209;Step&nbsp;Group** | 114&nbsp;(46.34%) | 113,892&nbsp;(46.32%) | Executes sequential state transitions or chained transforms (e.g., Sokoban, mazes, Rush Hour, 3D net folding), where each stage updates the visual scene for the next. |
132
+
133
+ </div>
134
+
135
+ Across all 11 task families, `VideoGym-Train` covers both static geometric/combinatorial deduction and multi-step state-transition dynamics:
136
+
137
+ <div style="overflow-x: auto;">
138
+
139
+ | Family (`config_name`) | Single&#8209;Step | Multi&#8209;Step | Total&nbsp;Tasks | Videos | Representative Tasks & Domains |
140
+ | :--- | ---: | ---: | ---: | ---: | :--- |
141
+ | `geometry` | 72 | 4 | **76** | 75,998 | Euclidean constructions, loci, projections, inversions, and chained transforms |
142
+ | `next_state_prediction` | 8 | 24 | **32** | 31,952 | Cellular automata, state machines, BFS frontiers, and discrete grid rollouts |
143
+ | `spatial_navigation` | 0 | 31 | **31** | 30,998 | Mazes, keys/locks, bridges, portals, conveyors, and resource routing |
144
+ | `rearrangement_game` | 0 | 23 | **23** | 22,964 | Bookshelf sorting, Hanoi, pancake flips, crane stacks, and buffer queues |
145
+ | `in_context_learning` | 16 | 3 | **19** | 18,998 | Visual analogies, attribute progressions, set operations, and matrix rules |
146
+ | `graph_theory` | 17 | 0 | **17** | 16,998 | Shortest paths, tree diameter, LCA, bridges, Eulerian trails, bipartiteness |
147
+ | `dynamics_game` | 1 | 13 | **14** | 13,998 | Sokoban, Breakout, Snake, match-clear cascades, and Lemmings rollouts |
148
+ | `constraint_grid` | 13 | 0 | **13** | 12,998 | N-Queens, Star Battle, Akari, Slitherlink, Shikaku, Nurikabe, Masyu, Yin–Yang |
149
+ | `board_game` | 1 | 7 | **8** | 7,984 | Go capture search, Mancala, Gomoku, Lights Out, and knight tours |
150
+ | `physics` | 1 | 6 | **7** | 6,998 | Multi-mirror ray tracing, elastic collisions, spill cascades, and gear trains |
151
+ | `spatial_3d` | 3 | 3 | **6** | 5,998 | Cube-net folding, polycube rotations, orthographic views, and cross-sections |
152
+ | **Total** | **132** | **114** | **246** | **245,884** | **11 families spanning static answers and sequential state transitions** |
153
+
154
+ </div>
155
+
156
+ <p>
157
+ <img src="assets/figures/fig1_generalization.png" alt="VideoGym seven-level generalization framework and pass-rate curves" width="100%">
158
+ <sub><b>Figure 2. How VideoGym-Train Connects to Seven-Level Generalization Evaluation.</b> Every level in <a href="https://huggingface.co/datasets/OpenMOSS-Team/VideoGym-Test"><b>VideoGym-Test</b></a> is constructed relative to the exact task membership, parameter ranges, and rule sets recorded in <code>VideoGym-Train/training_profile.json</code>.</sub>
159
+ </p>
160
+
161
+ <a id="contract"></a>
162
+
163
+ ## 🎬 Data Generation & Video Contract
164
+
165
+ Every instance in `VideoGym-Train` follows a deterministic rendering and verification contract so models cannot exploit visual artifacts or prompt shortcuts:
166
+
167
+ - **Supersampled visual rendering (`512×512`):** Input puzzles and reference frames are rendered deterministically via 4× supersampled primitives (`data/common/render_primitives.py`), keeping essential labels and legends crisp while placing full solving rules in text prompt <i>P</i>.
168
+ - **Step-synchronized reference durations (`16 FPS`):** Reference videos hold the unchanged initial state <i>I</i><sub>0</sub>, execute each state transition or answer mark cleanly without motion blur, teleportation, or crossfade shortcuts, and hold the solved final state. Because step counts vary across problem instances, reference durations span multiple frame buckets rather than forcing all problems into one fixed clip length.
169
+ - **Cryptographic sample identity & zero evaluation overlap:** Each sample ID (`<task_name>-<24-hex-digest>`) hashes the task name, seed, `semantic_input`, `ground_truth`, prompt, and decoded RGB input pixels. The companion `training_profile.json` indexes all 245,884 sample IDs, seeds, parameter bounds, and mechanism sets so `videogym benchmark audit` guarantees zero overlap with `VideoGym-Test`.
170
+
171
+ <details>
172
+ <summary><b>View Figure 3: Why variable-duration reference videos matter during training and evaluation</b></summary>
173
+ <br>
174
+ <p>
175
+ <img src="assets/figures/fig3_duration.png" alt="Epoch scaling and duration sensitivity comparing Reference Length and Fixed Length" width="100%">
176
+ <sub><b>Figure 3. Epoch Scaling and Duration Sensitivity.</b> Training across variable step-matched durations teaches accurate pace under Reference Length (56.34% In-Domain at Epoch 10), whereas evaluating at a mismatched Fixed Length (81 frames) triggers multi-object shortcuts when shorter and post-solution over-painting when longer (32.20%).</sub>
177
+ </p>
178
+ </details>
179
+
180
+ <a id="schema"></a>
181
+
182
+ ## 🗂️ Repository Layout & Data Schema
183
+
184
+ ### Repository Structure
185
+
186
+ ```text
187
+ VideoGym-Train/
188
+ ├── README.md Dataset card and subset configuration index
189
+ ├── LICENSE Apache-2.0 license
190
+ ├── unpack.py Parallel CLI to extract Parquet media into families/ for videogym CLI
191
+ ├── canonical_manifest.jsonl All 245,884 canonical training records (JSONL)
192
+ ├── training_profile.json Exact training sample IDs, seeds, parameter ranges, and mechanisms
193
+ ├── assets/figures/ Dataset overview figures
194
+ └── data/ Sharded Parquet files (Image + Video) across 11 task families
195
+ ├── board_game/
196
+ ├── constraint_grid/
197
+ ├── dynamics_game/
198
+ ├── geometry/
199
+ ├── graph_theory/
200
+ ├── in_context_learning/
201
+ ├── next_state_prediction/
202
+ ├── physics/
203
+ ├── rearrangement_game/
204
+ ├── spatial_3d/
205
+ └── spatial_navigation/
206
+ ```
207
+
208
+ ### Parquet Column Schema
209
+
210
+ Each shard in `data/<task_family>/<task_name>-00000-of-NNNNN.parquet` exposes native Hugging Face `Image()` and `Video()` columns alongside structured metadata:
211
+
212
+ <div style="overflow-x: auto;">
213
+
214
+ | Column | Type | Description |
215
+ | :--- | :--- | :--- |
216
+ | `id` | `string` | Deterministic canonical sample ID (`<task_name>-<24-hex-digest>`) |
217
+ | `task_name` | `string` | Procedural task identifier (one of 246 In-Domain tasks) |
218
+ | `task_family` | `string` | Task family identifier (one of 11 families) |
219
+ | `task_group` | `string` | `Single-Step Group` or `Multi-Step Group` |
220
+ | `split` | `string` | Always `"train"` |
221
+ | `image` | `Image` | `512×512` PNG initial puzzle image <i>I</i><sub>0</sub> (`bytes` + relative `families/...` `path`) |
222
+ | `prompt` | `string` | Structured instruction prompt <i>P</i> (`Input Image`, `Rule`, `Required Output`) |
223
+ | `video` | `Video` | `16 FPS` VP9 `.webm` reference solution video (`bytes` + relative `families/...` `path`) |
224
+ | `video_fps` | `int32` | Reference frame rate (`16`) |
225
+ | `video_num_frames` | `int32` | Exact frame count of the reference video |
226
+ | `seed` | `int64` | Procedural generation seed |
227
+ | `answer_kind` | `string` | Typed ground-truth schema kind (`option`, `grid`, `path`, `position`, `positions`, etc.) |
228
+ | `ground_truth_json` | `string` | JSON-serialized `CanonicalAnswer` dictionary |
229
+ | `semantic_input_json` | `string` | JSON-serialized symbolic problem specification (`semantic_input`) |
230
+
231
+ </div>
232
+
233
+ <a id="quick-start"></a>
234
+
235
+ ## 🚀 Quick Start
236
+
237
+ ### 1. Stream or Load with Hugging Face `datasets`
238
+
239
+ Stream all 245,884 examples directly or load any of the 11 task-family subsets without downloading the entire repository upfront:
240
+
241
+ ```python
242
+ from datasets import load_dataset
243
+
244
+ # Stream across all 246 tasks (default config)
245
+ ds = load_dataset("OpenMOSS-Team/VideoGym-Train", split="train", streaming=True)
246
+ sample = next(iter(ds))
247
+ print(sample["id"], sample["task_family"], sample["task_group"], sample["video_num_frames"])
248
+
249
+ # Or stream / load a single task family (e.g., "geometry", "spatial_navigation", "dynamics_game")
250
+ geom_ds = load_dataset("OpenMOSS-Team/VideoGym-Train", "geometry", split="train", streaming=True)
251
+ ```
252
+
253
+ ### 2. Unpack for `VideoGym` CLI Training & Exposure Profiling
254
+
255
+ To run SFT, FlowGRPO RLVR, or zero-overlap benchmark auditing with the [`VideoGym`](https://github.com/VideoGym/VideoGym) CLI, download the dataset (or selected families) and run `unpack.py` to materialize the exact `families/<task_family>/tasks/<task_name>/...` media paths referenced by `canonical_manifest.jsonl`:
256
+
257
+ ```bash
258
+ # 1. Download the full dataset (or pass --include "data/geometry/*" "canonical_manifest.jsonl" "unpack.py")
259
+ hf download OpenMOSS-Team/VideoGym-Train \
260
+ --repo-type dataset --local-dir datasets/videogym-train
261
+
262
+ # 2. Unpack Parquet media into datasets/videogym-train/families/
263
+ python datasets/videogym-train/unpack.py \
264
+ --dataset-dir datasets/videogym-train --workers 16
265
+
266
+ # Optional: unpack only selected families, tasks, or first N samples per task
267
+ python datasets/videogym-train/unpack.py \
268
+ --dataset-dir datasets/videogym-train \
269
+ --tasks sokoban maze_square angle_bisector --samples-per-task 200 --workers 8
270
+ ```
271
+
272
+ Once unpacked, pass `canonical_manifest.jsonl` directly to `videogym` post-training:
273
+
274
+ ```bash
275
+ videogym training export-data \
276
+ --manifest datasets/videogym-train/canonical_manifest.jsonl \
277
+ --output outputs/train.jsonl --samples-per-task 1000
278
+
279
+ videogym training launch \
280
+ --config training/configuration/presets/ltx23.toml \
281
+ --manifest outputs/train.jsonl --output-dir outputs/sft-run \
282
+ --tuning full --sharding fsdp --processes 8
283
+ ```
284
+
285
+ <a id="citation"></a>
286
+
287
+ ## 📝 Citation
288
+
289
+ If you use **VideoGym-Train** in your research, please cite our paper:
290
+
291
+ ```bibtex
292
+ @article{chen2026videogym,
293
+ title={Can Video Generation Models Really Learn to Reason?},
294
+ author={Chen, Hongji and Tong, Jingqi and Li, Hangcheng and Li, Mingzhe and Mou, Yurong and Yang, Yongzhuo and Zhang, Haowei and Wang, Zile and Xie, Zhide and Qiu, Shenling and Chen, Ke and Hu, Xiaomeng and Li, Chenglin and Dou, Shihan and Deng, Hokin and Zheng, Yining and Ho, Tsung-Yi and Zhao, Jun and Chen, Xinchi},
295
+ journal={arXiv preprint},
296
+ year={2026}
297
+ }
298
+ ```
299
+
300
+ ## 📄 License
301
+
302
+ **VideoGym-Train** is released under the [Apache-2.0 License](LICENSE).
data/in_context_learning/spiral_matrix-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92dffaea5728f7182067258516294a9c19fcc9d39743da86b5b069004741e387
3
+ size 170649186
data/in_context_learning/tile_color_sequence-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dedcb7ed1de614859d90f54e13cd3eb3c936a9225646a1f22f0debde4bd908c9
3
+ size 34020332
data/in_context_learning/venn_intersection_count-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca85e489209394e8889821d31aa20ce8cbe1e21421e74a9924ddcd29450fadbe
3
+ size 122088230
data/rearrangement_game/bookshelf_sort_by_height-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb63e12621e880193e35042fb8e6ab6a9c8a9d57482fbe565548a4c734b0c83b
3
+ size 321449426
data/rearrangement_game/bus_stops_dispatch-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7707edc08d844d044cd3edb78b735fd5f4a13966b63aba1f31d32766226cbdf0
3
+ size 972174010
data/rearrangement_game/bus_stops_dispatch-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b75e63762fc4dc5ede3302539bfabb6ff51b99aecb8124b4ebc590bc6b0a1680
3
+ size 925470200
data/rearrangement_game/bus_stops_dispatch-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cde51d5311254e48f48d6351ff81f66464270af23208f0196e3864af0b1d5cc
3
+ size 980575258
data/rearrangement_game/chess_pawn_swap-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a559bed0b441b2ceb4dd537a4036fb5c256656c0135f4953543c02800237eec
3
+ size 761070527
data/rearrangement_game/chess_pawn_swap-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b117fd9f62c2d9d1dfbfe6c74848347eff702e85a7a8b9447c88fec3fc01f5a0
3
+ size 766359527
data/rearrangement_game/color_group_with_locks-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cae98a124b5398b4b4fdaf6ce49bbb0df4fed53ae1f541fcdf011cd91ee1829
3
+ size 710892281
data/rearrangement_game/color_group_with_locks-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a29e88f688437df35e147f755b9a394f855959032da387d4ae42e00977961ae4
3
+ size 729045814
data/rearrangement_game/crane_block_stack-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1a64089d5099d80ae7d966fdca11ebd275014ac7bb478327d794bb44cd12741
3
+ size 954467999
data/rearrangement_game/dock_yard_crane_swap-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a79ec3eb677c2010fe141259ea1eb51889d48ee36b0f54a4b498df52679e939e
3
+ size 755770250
data/rearrangement_game/dock_yard_crane_swap-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e99d1e4170b2765baa8da17ec974fab03c5a648b77842d02e782144c00151fec
3
+ size 754546827
data/rearrangement_game/filing_cabinet_alphabet_lock-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d4a48318f626c29371a4bb1dc6002fab8d3e9aedb922c83934311ec9d72d641
3
+ size 958364703
data/rearrangement_game/filing_cabinet_alphabet_lock-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:220696cd53d9ec57e1d37b6e7a5a1aad0544cec52e31a202ba06312b8922d3eb
3
+ size 958314984
data/rearrangement_game/jumping_frog_swap-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9e7bc1deb1506c29bdcf20a70b32c96204ceb98dcd3aeea3ed051438cc3c0f7
3
+ size 1137712957
data/rearrangement_game/jumping_frog_swap-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e09f0da6ec2d51fb1d52831a71dedce8b60dbd2b7b5bd87a979402c9273d463
3
+ size 1157480268
data/rearrangement_game/lever_crane_swap-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e110e6be11e6c2411b05bac24b77ab1fe775f650a163e2d05f7a547eda7765ae
3
+ size 802570920
data/rearrangement_game/lever_crane_swap-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9db44a92261c41eff97be2d5e09ee05c3988ab8a8723ad5ae86b3dbb65f8f8c1
3
+ size 838415036
data/rearrangement_game/maze_rush_hour-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d646d339cf7bceb8fbc202de9ffacc7d48937913694a355e4fbc29ac0fb4612
3
+ size 1081210066
data/rearrangement_game/maze_rush_hour-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc15c012dcc472eb188c5c6dc1c55d186121d8ba4d4df7eac7f2273b6f959a84
3
+ size 1091497181
data/rearrangement_game/meal_train_pass_serve-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f3f6f3a9be1cf53e03a374eb3f0021efbfb1442d821050b54fc8aecd770e73a
3
+ size 1147465364
data/rearrangement_game/meal_train_pass_serve-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39e1920fcef8ec974cd45e6e7d9d53918ef66194ac98696107598f03fc01cf45
3
+ size 1151236843
data/rearrangement_game/meal_train_pass_serve-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c588fec1d0356981f9288f2e39c2fbe6a6b696df6307621657e3bde7164c38b
3
+ size 1148364637
data/rearrangement_game/office_inbox_priority_pull-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68b7f943a3181e4d7ce6eabf2bc5a7ef4900c0349a4d282dd522eda609695da2
3
+ size 665302630
data/rearrangement_game/office_inbox_priority_pull-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5f71640fc25ad2a3db89bd16dfa4ea3893c8dd787db872c2efc3b69827ad881
3
+ size 671485153
data/rearrangement_game/pancake_flip-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:955701e036a8fbdb11cda219193397edf999a391d562d093a7d44246587d255d
3
+ size 853422431
data/rearrangement_game/pancake_flip-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b224960b4f9ccd76ef80a422f4232ccb20811121f512290651717020d2944f6
3
+ size 858045440
data/rearrangement_game/parking_2d_n_by_n-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32cbbf610fc252f0f33a0278890937625777980fd92f720bc5a3de698c413052
3
+ size 1038557072
data/rearrangement_game/parking_2d_n_by_n-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6745a5451f46e279303b38f4ee9e8175ddc1c3c91ab6e833494f0afcdec78742
3
+ size 1038722365
data/rearrangement_game/pipeline_hold_cells_3-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b9f101ab9c4ddfdbd8e08b95f745d7e834ac6ab3628d1d792a01e67383fa141
3
+ size 1067188063
data/rearrangement_game/pipeline_hold_cells_3-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e6b0c22649e4e2da5d2331bd551a8b99a358e22e14421ebca43872b38a93c49
3
+ size 1068066741
data/rearrangement_game/pipeline_hold_cells_3-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:502c2945bc74265288371c139487024aa07b698d56f39d9ecfe0d7f621c5d4a4
3
+ size 1069989588
data/rearrangement_game/sliding_tile_15-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be6a15601fef85a48855fce34916e1496672335950ed15d643176f61bc84e73b
3
+ size 905515410
data/rearrangement_game/sliding_tile_15-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f672c1083f596db161e81e8206e580f460b958c4f358bef1581b2dafc2d13309
3
+ size 904233531
data/rearrangement_game/stack_reversal_minimal_moves-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6f04125cc95de44b7f5ff8ceaddc7baa08cd587b8923217f2c7456170750d83
3
+ size 968249940
data/rearrangement_game/stack_reversal_minimal_moves-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd78a88345d921a454c94e5a80a67660f5a3c7e05ba3d89cebeeaf18221e4644
3
+ size 991383060
data/rearrangement_game/token_trade_matrix-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69b7b546757238cc5b2bec105097a0e5a0013a3556e955de2636bdb7ceb8231e
3
+ size 1395580152
data/rearrangement_game/token_trade_matrix-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e89b8d36704173176d6434031a665bcf9ebd0917523b894f81dcd81cb15860a
3
+ size 1389746337
data/rearrangement_game/token_trade_matrix-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9428a81f3a26cab6f38831d3f323b15dd10c87f19fb6a0294b86cdb20e8636d
3
+ size 1409250708
data/rearrangement_game/tower_of_hanoi-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce4cddadb0c9125687c6ef59a0356d065e46451e0127bd067f127d80dee85416
3
+ size 807939313
data/rearrangement_game/train_couple_swap-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f701effb2d1f4920fdc5ebf8b579589715fd21b6fe6394220c23ad56252db39a
3
+ size 1116163195
data/rearrangement_game/train_couple_swap-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1572df326d5a5ea93873d27fe70da4bfba72260c67705ab08e1e804653e3bf82
3
+ size 1113764857
data/rearrangement_game/vending_dispense_fifo-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27dbc6318610720c4ad4a3111e6b1410e1c60e66fd83c708e4ccbde7ab602eae
3
+ size 1307614597
data/rearrangement_game/vending_dispense_fifo-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:801e3e4951e44e6b76f68af3c695b5bb00f099863925b2735ae1dc462393a2b9
3
+ size 1308317555
unpack.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Unpack VideoGym-Train Parquet shards into the local families/ media tree.
3
+
4
+ Example usage:
5
+ python unpack.py --dataset-dir . --workers 16
6
+ python unpack.py --dataset-dir . --families geometry graph_theory --workers 8
7
+ python unpack.py --dataset-dir . --tasks sokoban angle_bisector --samples-per-task 100
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ from concurrent.futures import ProcessPoolExecutor, as_completed
14
+ import json
15
+ from pathlib import Path
16
+
17
+ import pyarrow.parquet as pq
18
+
19
+
20
+ def _safe_relative_destination(root: Path, rel_path: str) -> Path:
21
+ rel = Path(rel_path)
22
+ if rel.is_absolute() or ".." in rel.parts or not rel.parts or rel.parts[0] != "families":
23
+ raise ValueError(f"refusing unsafe relative media path: {rel_path!r}")
24
+ return root / rel
25
+
26
+
27
+ def _unpack_shard(
28
+ shard_path: str,
29
+ output_root: str,
30
+ allowed_tasks: set[str] | None,
31
+ samples_per_task: int | None,
32
+ initial_task_offset: int,
33
+ ) -> tuple[int, int]:
34
+ root = Path(output_root)
35
+ pf = pq.ParquetFile(shard_path)
36
+ written_rows = 0
37
+ written_files = 0
38
+ seen_for_task = initial_task_offset
39
+
40
+ for rg_idx in range(pf.num_row_groups):
41
+ table = pf.read_row_group(rg_idx, columns=["task_name", "image", "video"])
42
+ tasks = table["task_name"].to_pylist()
43
+ images = table["image"].to_pylist()
44
+ videos = table["video"].to_pylist()
45
+ for task_name, img, vid in zip(tasks, images, videos):
46
+ if allowed_tasks is not None and task_name not in allowed_tasks:
47
+ continue
48
+ if samples_per_task is not None and seen_for_task >= samples_per_task:
49
+ return written_rows, written_files
50
+ seen_for_task += 1
51
+ for entry in (img, vid):
52
+ dest = _safe_relative_destination(root, entry["path"])
53
+ payload = entry["bytes"]
54
+ if dest.exists() and dest.stat().st_size == len(payload):
55
+ continue
56
+ dest.parent.mkdir(parents=True, exist_ok=True)
57
+ tmp = dest.with_name(dest.name + ".part")
58
+ tmp.write_bytes(payload)
59
+ tmp.replace(dest)
60
+ written_files += 1
61
+ written_rows += 1
62
+ return written_rows, written_files
63
+
64
+
65
+ def _task_name_from_shard(path: Path) -> str:
66
+ stem = path.stem
67
+ parts = stem.rsplit("-", 3)
68
+ if len(parts) == 4 and parts[2] == "of" and parts[1].isdigit() and parts[3].isdigit():
69
+ return parts[0]
70
+ return stem
71
+
72
+
73
+ def main() -> None:
74
+ parser = argparse.ArgumentParser(description=__doc__)
75
+ parser.add_argument(
76
+ "--dataset-dir",
77
+ type=Path,
78
+ default=Path(__file__).resolve().parent,
79
+ help="Root directory of the downloaded VideoGym-Train dataset",
80
+ )
81
+ parser.add_argument(
82
+ "--output-dir",
83
+ type=Path,
84
+ default=None,
85
+ help="Target directory for unpacked families/ (defaults to --dataset-dir)",
86
+ )
87
+ parser.add_argument("--families", nargs="+", help="Unpack only specific task families")
88
+ parser.add_argument("--tasks", nargs="+", help="Unpack only specific task names")
89
+ parser.add_argument(
90
+ "--samples-per-task",
91
+ type=int,
92
+ default=None,
93
+ help="Unpack only the first N samples per task in manifest order",
94
+ )
95
+ parser.add_argument("--workers", type=int, default=8, help="Parallel worker processes")
96
+ args = parser.parse_args()
97
+
98
+ dataset_dir = args.dataset_dir.expanduser().resolve()
99
+ output_dir = (args.output_dir or dataset_dir).expanduser().resolve()
100
+ data_dir = dataset_dir / "data"
101
+ if not data_dir.is_dir():
102
+ raise FileNotFoundError(f"missing Parquet data/ directory under {dataset_dir}")
103
+ if args.samples_per_task is not None and args.samples_per_task < 1:
104
+ raise ValueError("--samples-per-task must be a positive integer")
105
+
106
+ family_filter = set(args.families) if args.families else None
107
+ task_filter = set(args.tasks) if args.tasks else None
108
+
109
+ grouped_shards: dict[str, list[Path]] = {}
110
+ for fam_dir in sorted(p for p in data_dir.iterdir() if p.is_dir()):
111
+ if family_filter is not None and fam_dir.name not in family_filter:
112
+ continue
113
+ for shard in sorted(fam_dir.glob("*.parquet")):
114
+ tname = _task_name_from_shard(shard)
115
+ if task_filter is not None and tname not in task_filter:
116
+ continue
117
+ grouped_shards.setdefault(tname, []).append(shard)
118
+
119
+ if not grouped_shards:
120
+ raise ValueError("no matching Parquet shards found for the requested filters")
121
+
122
+ jobs: list[tuple[str, str, set[str] | None, int | None, int]] = []
123
+ for tname, shards in sorted(grouped_shards.items()):
124
+ offset = 0
125
+ for shard in shards:
126
+ if args.samples_per_task is not None and offset >= args.samples_per_task:
127
+ break
128
+ nrows = pq.read_metadata(shard).num_rows
129
+ jobs.append(
130
+ (str(shard), str(output_dir), task_filter, args.samples_per_task, offset)
131
+ )
132
+ offset += nrows
133
+
134
+ total_rows = 0
135
+ total_files = 0
136
+ workers = max(1, min(args.workers, len(jobs)))
137
+ with ProcessPoolExecutor(max_workers=workers) as pool:
138
+ futures = [pool.submit(_unpack_shard, *job) for job in jobs]
139
+ for idx, fut in enumerate(as_completed(futures), 1):
140
+ rows, files = fut.result()
141
+ total_rows += rows
142
+ total_files += files
143
+ if idx % 25 == 0 or idx == len(jobs):
144
+ print(
145
+ json.dumps(
146
+ {
147
+ "completed_shards": idx,
148
+ "total_shards": len(jobs),
149
+ "unpacked_samples": total_rows,
150
+ "written_files": total_files,
151
+ }
152
+ ),
153
+ flush=True,
154
+ )
155
+
156
+
157
+ if __name__ == "__main__":
158
+ main()