Publish direct-use target-aware GWAM training view v1
Browse files- README.md +8 -3
- SCHEMA.md +17 -0
- gwam_active13_gwam_training_v1_20260731/DATASET_SUMMARY.json +42 -0
- gwam_active13_gwam_training_v1_20260731/README.md +385 -0
- gwam_active13_gwam_training_v1_20260731/RGB_AND_REALTIME.md +215 -0
- gwam_active13_gwam_training_v1_20260731/SCHEMA.md +192 -0
- gwam_active13_gwam_training_v1_20260731/TRAINING_EPISODES.jsonl +0 -0
- gwam_active13_gwam_training_v1_20260731/download_training_data.py +96 -0
- gwam_active13_gwam_training_v1_20260731/examples/VALIDATED_OUTPUT.json +69 -0
- gwam_active13_gwam_training_v1_20260731/examples/current_frame_target_aware_eval.py +147 -0
- gwam_active13_gwam_training_v1_20260731/loader/target_aware_gwam_training_dataset.py +635 -0
- gwam_active13_gwam_training_v1_20260731/manifests/PUBLICATION_MANIFEST.json +72 -0
- gwam_active13_gwam_training_v1_20260731/receipts/PREPUBLICATION_VALIDATION_RECEIPT.json +137 -0
- gwam_active13_gwam_training_v1_20260731/tests/test_direct_training_view.py +205 -0
- scripts/setup_realtime_final_graph_env.sh +80 -27
README.md
CHANGED
|
@@ -40,6 +40,8 @@ This is principally a loader/derived-view update over data already stored on the
|
|
| 40 |
|
| 41 |
The key representation rule is one canonical physical graph per frame. Right, left, and wrist are camera-indexed observation records on the same persistent physical nodes; they are not three independent graphs. See the [full illustration](gwam_active13_target_physical_v2_0_1_20260731/guides/ONE_GRAPH_THREE_VIEWS.svg).
|
| 42 |
|
|
|
|
|
|
|
| 43 |
There is one narrowly scoped value overlay: for 146 selected episodes, only `graph/visual_features_sparse.npz::type_clip32` differs from the canonical ZIP. The normative loader verifies the canonical ZIP, the canonical NPZ member, and the overlay blob before applying that change to a temporary extraction. It never mutates the downloaded ZIP.
|
| 44 |
|
| 45 |
Use these files as the source of truth:
|
|
@@ -80,6 +82,7 @@ The excluded episode repeatedly failed RoboCasa environment initialization. It h
|
|
| 80 |
```text
|
| 81 |
canonical Active-13 tag: gwam-13task-data-v4
|
| 82 |
target-aware docs tag: gwam-target-v2.0.1-docs-v1
|
|
|
|
| 83 |
task names: 13
|
| 84 |
split/task collections: 16
|
| 85 |
selected episode ZIPs: 4,937
|
|
@@ -112,14 +115,14 @@ Three names occur independently in both `target` and `pretrain`: `PickPlaceCount
|
|
| 112 |
|
| 113 |
## Download the active 13 tasks
|
| 114 |
|
| 115 |
-
Use the immutable `gwam-target-v2.0.1-
|
| 116 |
|
| 117 |
### Python
|
| 118 |
|
| 119 |
```python
|
| 120 |
from huggingface_hub import snapshot_download
|
| 121 |
|
| 122 |
-
REVISION = "gwam-target-v2.0.1-
|
| 123 |
TASKS = [
|
| 124 |
"CoffeeSetupMug",
|
| 125 |
"OpenDrawer",
|
|
@@ -149,6 +152,7 @@ patterns += [
|
|
| 149 |
"gwam_13task_active_v1_20260728/**",
|
| 150 |
"training_splits/active13_gnn_v1/**",
|
| 151 |
"gwam_active13_target_physical_v2_0_1_20260731/**",
|
|
|
|
| 152 |
"loaders/**",
|
| 153 |
"tests/test_gwam_full_graph_window.py",
|
| 154 |
]
|
|
@@ -168,7 +172,7 @@ snapshot_download(
|
|
| 168 |
```bash
|
| 169 |
hf download ChangChrisLiu/GWAM_Data \
|
| 170 |
--repo-type dataset \
|
| 171 |
-
--revision gwam-target-v2.0.1-
|
| 172 |
--include 'gwam_v12_sparse_v2/episodes/*/CoffeeSetupMug/*.zip' \
|
| 173 |
--include 'gwam_v12_sparse_v2/episodes/*/OpenDrawer/*.zip' \
|
| 174 |
--include 'gwam_v12_sparse_v2/episodes/*/PickPlaceCabinetToCounter/*.zip' \
|
|
@@ -189,6 +193,7 @@ hf download ChangChrisLiu/GWAM_Data \
|
|
| 189 |
--include 'gwam_13task_active_v1_20260728/**' \
|
| 190 |
--include 'training_splits/active13_gnn_v1/**' \
|
| 191 |
--include 'gwam_active13_target_physical_v2_0_1_20260731/**' \
|
|
|
|
| 192 |
--include 'loaders/**' \
|
| 193 |
--include 'tests/test_gwam_full_graph_window.py' \
|
| 194 |
--include 'README.md' \
|
|
|
|
| 40 |
|
| 41 |
The key representation rule is one canonical physical graph per frame. Right, left, and wrist are camera-indexed observation records on the same persistent physical nodes; they are not three independent graphs. See the [full illustration](gwam_active13_target_physical_v2_0_1_20260731/guides/ONE_GRAPH_THREE_VIEWS.svg).
|
| 42 |
|
| 43 |
+
> **Direct-use target-aware GWAM training:** use [`gwam_active13_gwam_training_v1_20260731/`](gwam_active13_gwam_training_v1_20260731/README.md). Its executable loader joins all 2,699 resolved episodes into 702,094 legal temporal windows and returns a backward-compatible 344-D rich node tensor, typed three-view records, actions, future graph targets, and target bits. The graph ZIPs do **not** contain original RGB videos; the loader can join separately obtained RoboCasa/LeRobot videos by exact `source_frame`. The same guide provides the full `extract_final_graph()` current-frame evaluation path and aligned RGB outputs.
|
| 44 |
+
|
| 45 |
There is one narrowly scoped value overlay: for 146 selected episodes, only `graph/visual_features_sparse.npz::type_clip32` differs from the canonical ZIP. The normative loader verifies the canonical ZIP, the canonical NPZ member, and the overlay blob before applying that change to a temporary extraction. It never mutates the downloaded ZIP.
|
| 46 |
|
| 47 |
Use these files as the source of truth:
|
|
|
|
| 82 |
```text
|
| 83 |
canonical Active-13 tag: gwam-13task-data-v4
|
| 84 |
target-aware docs tag: gwam-target-v2.0.1-docs-v1
|
| 85 |
+
target-aware training tag: gwam-target-v2.0.1-training-v1
|
| 86 |
task names: 13
|
| 87 |
split/task collections: 16
|
| 88 |
selected episode ZIPs: 4,937
|
|
|
|
| 115 |
|
| 116 |
## Download the active 13 tasks
|
| 117 |
|
| 118 |
+
Use the immutable `gwam-target-v2.0.1-training-v1` tag for canonical Active-13 files, the target-aware sidecar, the direct training view, and student guides. It contains the same canonical episode bytes bound by `gwam-13task-data-v4`; the newer tag adds versioned target metadata, executable joins, and documentation. Download every matching source tier instead of assuming a task exists in only one tier.
|
| 119 |
|
| 120 |
### Python
|
| 121 |
|
| 122 |
```python
|
| 123 |
from huggingface_hub import snapshot_download
|
| 124 |
|
| 125 |
+
REVISION = "gwam-target-v2.0.1-training-v1"
|
| 126 |
TASKS = [
|
| 127 |
"CoffeeSetupMug",
|
| 128 |
"OpenDrawer",
|
|
|
|
| 152 |
"gwam_13task_active_v1_20260728/**",
|
| 153 |
"training_splits/active13_gnn_v1/**",
|
| 154 |
"gwam_active13_target_physical_v2_0_1_20260731/**",
|
| 155 |
+
"gwam_active13_gwam_training_v1_20260731/**",
|
| 156 |
"loaders/**",
|
| 157 |
"tests/test_gwam_full_graph_window.py",
|
| 158 |
]
|
|
|
|
| 172 |
```bash
|
| 173 |
hf download ChangChrisLiu/GWAM_Data \
|
| 174 |
--repo-type dataset \
|
| 175 |
+
--revision gwam-target-v2.0.1-training-v1 \
|
| 176 |
--include 'gwam_v12_sparse_v2/episodes/*/CoffeeSetupMug/*.zip' \
|
| 177 |
--include 'gwam_v12_sparse_v2/episodes/*/OpenDrawer/*.zip' \
|
| 178 |
--include 'gwam_v12_sparse_v2/episodes/*/PickPlaceCabinetToCounter/*.zip' \
|
|
|
|
| 193 |
--include 'gwam_13task_active_v1_20260728/**' \
|
| 194 |
--include 'training_splits/active13_gnn_v1/**' \
|
| 195 |
--include 'gwam_active13_target_physical_v2_0_1_20260731/**' \
|
| 196 |
+
--include 'gwam_active13_gwam_training_v1_20260731/**' \
|
| 197 |
--include 'loaders/**' \
|
| 198 |
--include 'tests/test_gwam_full_graph_window.py' \
|
| 199 |
--include 'README.md' \
|
SCHEMA.md
CHANGED
|
@@ -378,3 +378,20 @@ The current graph profile is exactly `active13_target_physical_v2` with relation
|
|
| 378 |
|
| 379 |
The static census is exactly 2,699/2,699 `RESOLVED`; the independent reset/static audit is 500 comparisons with 0 disagreements. Both operate on frozen outer-train/static metadata only. Validation/test dynamic data and all trajectory/outcome sources remain outside this release view. See the prefix `SCHEMA.md` for the executable file and receipt contract.
|
| 380 |
<!-- END GRAPHPACKET_SLIM_V2_0_1_SIDECAR_SCHEMA -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
|
| 379 |
The static census is exactly 2,699/2,699 `RESOLVED`; the independent reset/static audit is 500 comparisons with 0 disagreements. Both operate on frozen outer-train/static metadata only. Validation/test dynamic data and all trajectory/outcome sources remain outside this release view. See the prefix `SCHEMA.md` for the executable file and receipt contract.
|
| 380 |
<!-- END GRAPHPACKET_SLIM_V2_0_1_SIDECAR_SCHEMA -->
|
| 381 |
+
|
| 382 |
+
<!-- BEGIN ACTIVE13_DIRECT_GWAM_TRAINING_V1 -->
|
| 383 |
+
## Direct-use target-aware GWAM training view
|
| 384 |
+
|
| 385 |
+
The additive namespace `gwam_active13_gwam_training_v1_20260731/` is a lazy executable join over 2,699 immutable canonical episode ZIPs and their v2.0.1 target receipts. It enumerates 702,094 legal `L=8,H=8,stride=1` windows and exposes the inherited typed temporal graph plus `history.gwam_node_features float32[L,N,344]`:
|
| 386 |
+
|
| 387 |
+
```text
|
| 388 |
+
20 physical/state + 10 family one-hot + 256 SAM2 valid-view mean
|
| 389 |
+
+ 32 type_clip32 + 24 three-view evidence + 2 target fields = 344
|
| 390 |
+
```
|
| 391 |
+
|
| 392 |
+
The original non-averaged `sam2_visual[L,N,3,256]`, `view_evidence[L,N,3,8]`, and masks remain available. The convenience 344-D field preserves the prior 342-D full-final-graph interface and appends `is_task_target,task_target_valid`.
|
| 393 |
+
|
| 394 |
+
Original RGB/video is **not** stored in canonical graph ZIPs. Optional joint graph+video loading requires separately obtained RoboCasa/LeRobot videos and joins them using `source_tier/task/episode_id` plus `graph/frames.jsonl::source_frame`.
|
| 395 |
+
|
| 396 |
+
For online evaluation, root `RealtimeGWAMGraphExtractor.extract_final_graph()` constructs the current full 342-D physical/visual graph and returns aligned right/left/wrist RGB. A target helper appends only a complete pre-action task/reset target-slot set, producing `x_target_aware[N,344]`. `extract_current_graph()` remains Phase-1/debug only.
|
| 397 |
+
<!-- END ACTIVE13_DIRECT_GWAM_TRAINING_V1 -->
|
gwam_active13_gwam_training_v1_20260731/DATASET_SUMMARY.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"action_width": 12,
|
| 3 |
+
"artifact_type": "GWAMActive13DirectTrainingViewSummary",
|
| 4 |
+
"canonical_zip_bytes_referenced": 20339307035,
|
| 5 |
+
"episode_count": 2699,
|
| 6 |
+
"graph_payload_location": "referenced canonical_zip_path files already in ChangChrisLiu/GWAM_Data",
|
| 7 |
+
"history_length": 8,
|
| 8 |
+
"horizon": 8,
|
| 9 |
+
"index_sha256": "757b3320ba991a2ece0c0a2a431cfde84db24e6837871855072b28663d89859e",
|
| 10 |
+
"model_split": "train",
|
| 11 |
+
"rgb_in_graph_zip": false,
|
| 12 |
+
"rgb_requirement": "Joint graph+video training requires separately obtained source RoboCasa/LeRobot RGB videos joined by source_tier/task/episode_id and graph/frames.jsonl::source_frame.",
|
| 13 |
+
"source_group_counts": {
|
| 14 |
+
"CoffeeSetupMug": 8,
|
| 15 |
+
"OpenDrawer": 64,
|
| 16 |
+
"PickPlaceCabinetToCounter": 85,
|
| 17 |
+
"PickPlaceCounterToCabinet": 134,
|
| 18 |
+
"PickPlaceCounterToMicrowave": 86,
|
| 19 |
+
"PickPlaceCounterToSink": 83,
|
| 20 |
+
"PickPlaceCounterToStove": 93,
|
| 21 |
+
"PickPlaceMicrowaveToCounter": 87,
|
| 22 |
+
"PickPlaceSinkToCounter": 101,
|
| 23 |
+
"PickPlaceStoveToCounter": 87
|
| 24 |
+
},
|
| 25 |
+
"status": "LAZY_DERIVED_VIEW",
|
| 26 |
+
"target_payload_location": "referenced v2.0.1 sidecar receipts already in ChangChrisLiu/GWAM_Data",
|
| 27 |
+
"task_counts": {
|
| 28 |
+
"CoffeeSetupMug": 392,
|
| 29 |
+
"OpenDrawer": 409,
|
| 30 |
+
"PickPlaceCabinetToCounter": 85,
|
| 31 |
+
"PickPlaceCounterToCabinet": 488,
|
| 32 |
+
"PickPlaceCounterToMicrowave": 88,
|
| 33 |
+
"PickPlaceCounterToSink": 86,
|
| 34 |
+
"PickPlaceCounterToStove": 487,
|
| 35 |
+
"PickPlaceMicrowaveToCounter": 90,
|
| 36 |
+
"PickPlaceSinkToCounter": 487,
|
| 37 |
+
"PickPlaceStoveToCounter": 87
|
| 38 |
+
},
|
| 39 |
+
"version": "1.0.0",
|
| 40 |
+
"view_count": 3,
|
| 41 |
+
"window_count_L8_H8_stride1": 702094
|
| 42 |
+
}
|
gwam_active13_gwam_training_v1_20260731/README.md
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Active-13 direct-use target-aware GWAM training view v1
|
| 2 |
+
|
| 3 |
+
Status: **published-data join package prepared for direct graph training**.
|
| 4 |
+
|
| 5 |
+
This prefix makes the current target-aware graph release usable in a training loop without requiring students to manually join three manifests. It does not duplicate or rewrite the 20.34 GB of canonical graph ZIPs already stored in `ChangChrisLiu/GWAM_Data`.
|
| 6 |
+
|
| 7 |
+
## Direct answer
|
| 8 |
+
|
| 9 |
+
### Can a student directly train with the graph data?
|
| 10 |
+
|
| 11 |
+
**Yes.** Download this view and instantiate `TargetAwareGWAMTrainingDataset`. It exposes:
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
2,699 target-resolved training episodes
|
| 15 |
+
702,094 legal L=8, H=8, stride-1 windows
|
| 16 |
+
canonical physical graph history
|
| 17 |
+
three-view geometry, masks, and SAM2 records
|
| 18 |
+
typed/ragged edges
|
| 19 |
+
8 future actions
|
| 20 |
+
8 future physical/contact targets
|
| 21 |
+
task target bits joined to the same physical nodes
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
### Are RGB/video frames inside the graph ZIPs?
|
| 25 |
+
|
| 26 |
+
**No.** The canonical graph ZIPs include exact masks, three-view geometry, and extracted SAM2/CLIP features, but they do not contain original RGB videos.
|
| 27 |
+
|
| 28 |
+
Therefore:
|
| 29 |
+
|
| 30 |
+
| Training use | Immediately available after this graph download? |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Graph-only GNN / graph dynamics | Yes |
|
| 33 |
+
| GWAM using stored graph features as its observation | Yes |
|
| 34 |
+
| Joint RGB/video + graph GWAM | Graph side yes; original RoboCasa/LeRobot RGB must be obtained separately |
|
| 35 |
+
| Live RoboCasa evaluation | Yes, using the public realtime extractor plus a local RoboCasa installation |
|
| 36 |
+
|
| 37 |
+
When a local source RGB root is supplied, the unified loader can decode the exact aligned history/future video frames using:
|
| 38 |
+
|
| 39 |
+
```text
|
| 40 |
+
(source_tier, task, episode_id, graph/frames.jsonl::source_frame)
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
It never guesses frame alignment.
|
| 44 |
+
|
| 45 |
+
## What is in this prefix?
|
| 46 |
+
|
| 47 |
+
```text
|
| 48 |
+
TRAINING_EPISODES.jsonl
|
| 49 |
+
DATASET_SUMMARY.json
|
| 50 |
+
loader/target_aware_gwam_training_dataset.py
|
| 51 |
+
download_training_data.py
|
| 52 |
+
examples/current_frame_target_aware_eval.py
|
| 53 |
+
examples/VALIDATED_OUTPUT.json
|
| 54 |
+
README.md
|
| 55 |
+
SCHEMA.md
|
| 56 |
+
RGB_AND_REALTIME.md
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
`TRAINING_EPISODES.jsonl` references existing immutable files:
|
| 60 |
+
|
| 61 |
+
```text
|
| 62 |
+
canonical graph ZIP:
|
| 63 |
+
gwam_v12_sparse_v2/episodes/<tier>/<task>/episode_xxxxxx.zip
|
| 64 |
+
|
| 65 |
+
target receipt:
|
| 66 |
+
gwam_active13_target_physical_v2_0_1_20260731/sidecars/target_resolution/...
|
| 67 |
+
|
| 68 |
+
root temporal loader:
|
| 69 |
+
loaders/gwam_full_graph_window.py
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## 1. Download all directly usable graph-training data
|
| 73 |
+
|
| 74 |
+
Install the Hub client:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
pip install -U huggingface_hub
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Download all 2,699 referenced canonical graph ZIPs, sidecars, loaders, realtime code, and bundled SAM2/CLIP weights:
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
python gwam_active13_gwam_training_v1_20260731/download_training_data.py \
|
| 84 |
+
--local-dir ./GWAM_Data_target_training
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
The canonical ZIP payload referenced by this view is 20,339,307,035 bytes before Hub/cache overhead. Original RGB videos are not downloaded because they are not in this HF repository.
|
| 88 |
+
|
| 89 |
+
Immutable revision:
|
| 90 |
+
|
| 91 |
+
```text
|
| 92 |
+
gwam-target-v2.0.1-training-v1
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## 2. Load one directly usable training window
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
import sys
|
| 99 |
+
from pathlib import Path
|
| 100 |
+
|
| 101 |
+
root = Path("./GWAM_Data_target_training")
|
| 102 |
+
prefix = root / "gwam_active13_gwam_training_v1_20260731"
|
| 103 |
+
sys.path.insert(0, str(prefix / "loader"))
|
| 104 |
+
|
| 105 |
+
from target_aware_gwam_training_dataset import TargetAwareGWAMTrainingDataset
|
| 106 |
+
|
| 107 |
+
with TargetAwareGWAMTrainingDataset(
|
| 108 |
+
root,
|
| 109 |
+
as_torch=False,
|
| 110 |
+
strict=True,
|
| 111 |
+
verify_zip_on_first_open=True,
|
| 112 |
+
validate_all_target_receipts=True,
|
| 113 |
+
rgb_mode="none",
|
| 114 |
+
) as dataset:
|
| 115 |
+
sample = dataset[0]
|
| 116 |
+
|
| 117 |
+
print(len(dataset))
|
| 118 |
+
# 702094
|
| 119 |
+
|
| 120 |
+
print(sample["history"]["gwam_node_features"].shape)
|
| 121 |
+
# [8,N,344]
|
| 122 |
+
|
| 123 |
+
print(sample["history"]["view_evidence"].shape)
|
| 124 |
+
# [8,N,3,8]
|
| 125 |
+
|
| 126 |
+
print(sample["history"]["sam2_visual"].shape)
|
| 127 |
+
# [8,N,3,256]
|
| 128 |
+
|
| 129 |
+
print(sample["future_action"].shape)
|
| 130 |
+
# [8,12]
|
| 131 |
+
|
| 132 |
+
print(sample["targets"]["contact_pair_event"].shape)
|
| 133 |
+
# [8,Q], Q=N*(N-1)/2
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
The returned sample retains every typed field from `GWAMFullGraphEpisode`; `gwam_node_features` is an additional convenience tensor, not a replacement for the typed contract.
|
| 137 |
+
|
| 138 |
+
## 3. Ready-to-use rich node dimension
|
| 139 |
+
|
| 140 |
+
Per history frame and active node:
|
| 141 |
+
|
| 142 |
+
```text
|
| 143 |
+
20 physical state and visibility
|
| 144 |
+
10 family one-hot
|
| 145 |
+
256 view-valid mean of the three camera-indexed SAM2 records
|
| 146 |
+
32 type_clip32
|
| 147 |
+
24 right/left/wrist view evidence: 3 × 8
|
| 148 |
+
1 is_task_target
|
| 149 |
+
1 task_target_valid
|
| 150 |
+
-----------------------------------
|
| 151 |
+
344 total dimensions
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
The first 342 dimensions match the prior full-final-graph training representation. The final two dimensions add the target-aware contract.
|
| 155 |
+
|
| 156 |
+
The loader still returns the non-averaged source records:
|
| 157 |
+
|
| 158 |
+
```text
|
| 159 |
+
sam2_visual [L,N,3,256]
|
| 160 |
+
view_evidence [L,N,3,8]
|
| 161 |
+
mask_raster [L,N,3,1,16,16]
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
Use those typed records for a view-aware architecture. The 344-D convenience tensor uses the previous release's view-valid SAM2 mean only for backward compatibility with the established GWAM interface.
|
| 165 |
+
|
| 166 |
+
## 4. PyTorch batch
|
| 167 |
+
|
| 168 |
+
```python
|
| 169 |
+
from torch.utils.data import DataLoader
|
| 170 |
+
|
| 171 |
+
with TargetAwareGWAMTrainingDataset(root, as_torch=False) as dataset:
|
| 172 |
+
loader = DataLoader(
|
| 173 |
+
dataset,
|
| 174 |
+
batch_size=2,
|
| 175 |
+
shuffle=True,
|
| 176 |
+
num_workers=0, # raise after local storage/cache profiling
|
| 177 |
+
collate_fn=dataset.collate_torch,
|
| 178 |
+
)
|
| 179 |
+
batch = next(iter(loader))
|
| 180 |
+
|
| 181 |
+
print(batch["history"]["gwam_node_features"].shape)
|
| 182 |
+
# [B,8,N_batch_max,344]
|
| 183 |
+
|
| 184 |
+
print(batch["history"]["node_valid"].shape)
|
| 185 |
+
# [B,8,N_batch_max]
|
| 186 |
+
|
| 187 |
+
print(batch["future_action"].shape)
|
| 188 |
+
# [B,8,12]
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
The collator pads nodes only to the maximum `N` in that batch, offsets ragged edges, pads full-pair targets, preserves masks, and keeps metadata separate.
|
| 192 |
+
|
| 193 |
+
## 5. Joint graph + source RGB/video training
|
| 194 |
+
|
| 195 |
+
The graph release deliberately does not pretend RGB is present. To decode source video, provide the original RoboCasa dataset root:
|
| 196 |
+
|
| 197 |
+
```python
|
| 198 |
+
with TargetAwareGWAMTrainingDataset(
|
| 199 |
+
root,
|
| 200 |
+
rgb_root="/path/to/robocasa_datasets/v1.0",
|
| 201 |
+
rgb_mode="history_future",
|
| 202 |
+
) as dataset:
|
| 203 |
+
sample = dataset[0]
|
| 204 |
+
|
| 205 |
+
print(sample["rgb"]["frames"].shape)
|
| 206 |
+
# [16,3,256,256,3] = history+future, right/left/wrist, uint8 RGB
|
| 207 |
+
|
| 208 |
+
print(sample["rgb"]["source_frame_indices"])
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
Expected source layout follows RoboCasa/LeRobot:
|
| 212 |
+
|
| 213 |
+
```text
|
| 214 |
+
<rgb_root>/<tier>/.../<task>/.../lerobot/videos/chunk-*/
|
| 215 |
+
observation.images.robot0_agentview_right/episode_xxxxxx.mp4
|
| 216 |
+
observation.images.robot0_agentview_left/episode_xxxxxx.mp4
|
| 217 |
+
observation.images.robot0_eye_in_hand/episode_xxxxxx.mp4
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
The loader requires exactly one video match per episode/camera and fails closed on missing or ambiguous paths.
|
| 221 |
+
|
| 222 |
+
If your WAM uses source RGB as the prediction target:
|
| 223 |
+
|
| 224 |
+
```text
|
| 225 |
+
history RGB + history graph + actions -> predicted future RGB/video
|
| 226 |
+
+ -> predicted future graph (optional auxiliary)
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
Do not feed future RGB, future graph, success, reward, completion, or progress into the condition.
|
| 230 |
+
|
| 231 |
+
## 6. Generate the full graph from the current frame for evaluation
|
| 232 |
+
|
| 233 |
+
The official current-frame API is `extract_final_graph()`. The official current-frame path is the same full Phase-1 + Phase-2 route used by the prior release:
|
| 234 |
+
|
| 235 |
+
```text
|
| 236 |
+
current simulator qpos/qvel/contact
|
| 237 |
+
+ current right/left/wrist RGB
|
| 238 |
+
+ current segmentation and visible masks
|
| 239 |
+
+ Phase-1 physical graph construction
|
| 240 |
+
+ Phase-2 SAM2 masked pooling
|
| 241 |
+
+ CLIP type features
|
| 242 |
+
= current full graph x[N,342] + aligned RGB[3,256,256,3]
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
Install/setup the realtime environment from the downloaded repository:
|
| 246 |
+
|
| 247 |
+
```bash
|
| 248 |
+
bash scripts/setup_realtime_final_graph_env.sh
|
| 249 |
+
```
|
| 250 |
+
|
| 251 |
+
Generate one current-frame physical/visual graph:
|
| 252 |
+
|
| 253 |
+
```bash
|
| 254 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 255 |
+
python examples/realtime_env_graph_eval_loop.py \
|
| 256 |
+
--task OpenDrawer \
|
| 257 |
+
--robots PandaOmron \
|
| 258 |
+
--steps 1 \
|
| 259 |
+
--visual-backend sam2 \
|
| 260 |
+
--device cuda \
|
| 261 |
+
--save-dir ./eval_snapshot \
|
| 262 |
+
--json-output ./eval_snapshot/summary.json
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
Model-facing Python API:
|
| 266 |
+
|
| 267 |
+
```python
|
| 268 |
+
from realtime.gwam_realtime_env_graph import (
|
| 269 |
+
RealtimeGWAMGraphExtractor,
|
| 270 |
+
Sam2ClipRealtimeFeatureBackend,
|
| 271 |
+
)
|
| 272 |
+
|
| 273 |
+
extractor = RealtimeGWAMGraphExtractor(env)
|
| 274 |
+
backend = Sam2ClipRealtimeFeatureBackend(device="cuda")
|
| 275 |
+
|
| 276 |
+
# Call only on the current state that the policy is allowed to observe.
|
| 277 |
+
snapshot = extractor.extract_final_graph(
|
| 278 |
+
visual_backend=backend,
|
| 279 |
+
include_masks=True,
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
graph = snapshot["gnn_graph"]
|
| 283 |
+
print(graph["x"].shape) # [N,342]
|
| 284 |
+
print(graph["edge_index"].shape) # [2,E]
|
| 285 |
+
print(graph["edge_attr"].shape) # [E,8]
|
| 286 |
+
print(snapshot["rgb_frames"][0].shape) # [256,256,3]
|
| 287 |
+
```
|
| 288 |
+
|
| 289 |
+
`extract_current_graph()` is only a 33-D Phase-1 debugging path. Do not use it as the final GWAM evaluation input.
|
| 290 |
+
|
| 291 |
+
### Add current task-target fields
|
| 292 |
+
|
| 293 |
+
The physical/visual extractor cannot safely guess task targets from outcomes. Supply the complete target storage slots from the task/reset specification available before action selection:
|
| 294 |
+
|
| 295 |
+
```python
|
| 296 |
+
from target_aware_gwam_training_dataset import (
|
| 297 |
+
attach_known_task_targets_to_realtime_graph,
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
snapshot = attach_known_task_targets_to_realtime_graph(
|
| 301 |
+
snapshot,
|
| 302 |
+
target_storage_slots=[1],
|
| 303 |
+
provenance="RoboCasa reset task specification",
|
| 304 |
+
)
|
| 305 |
+
|
| 306 |
+
print(snapshot["gnn_graph"]["x_target_aware"].shape)
|
| 307 |
+
# [N,344]
|
| 308 |
+
```
|
| 309 |
+
|
| 310 |
+
Or use the direct runner:
|
| 311 |
+
|
| 312 |
+
```bash
|
| 313 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 314 |
+
python gwam_active13_gwam_training_v1_20260731/examples/current_frame_target_aware_eval.py \
|
| 315 |
+
--task PickPlaceCabinetToCounter \
|
| 316 |
+
--robots PandaOmron \
|
| 317 |
+
--device cuda \
|
| 318 |
+
--target-node-id obj \
|
| 319 |
+
--target-provenance 'RoboCasa reset task specification PickPlaceCabinetToCounter' \
|
| 320 |
+
--save-dir ./current_target_graph
|
| 321 |
+
```
|
| 322 |
+
|
| 323 |
+
For the nine object-manipulation task rules in this release, `obj` is the authored target node ID. OpenDrawer has a reset-selected drawer root plus its operative slide component; obtain that complete pair from the current reset inventory/task specification and pass repeated `--target-node-id` or `--target-slot` arguments. Never hard-code storage slots across resets. The script fails if a supplied node/slot is absent and never infers targets from contact, action, success, reward, or future state. Live target provenance is marked `CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED`; bind it to your evaluation harness's own reset/task receipt. Offline training receipts remain content-addressed.
|
| 324 |
+
|
| 325 |
+
Saved evaluation snapshot:
|
| 326 |
+
|
| 327 |
+
```text
|
| 328 |
+
eval_snapshot/graph/node_state.npz
|
| 329 |
+
eval_snapshot/graph/view_evidence.npz
|
| 330 |
+
eval_snapshot/graph/visible_masks_rle.jsonl.gz
|
| 331 |
+
eval_snapshot/graph/visual_features_sparse.npz
|
| 332 |
+
eval_snapshot/rgb/view_0_robot0_agentview_right.npy
|
| 333 |
+
eval_snapshot/rgb/view_1_robot0_agentview_left.npy
|
| 334 |
+
eval_snapshot/rgb/view_2_robot0_eye_in_hand.npy
|
| 335 |
+
eval_snapshot/rgb_manifest.json
|
| 336 |
+
current_target_graph/target_aware_graph.npz
|
| 337 |
+
current_target_graph/target_aware_summary.json
|
| 338 |
+
```
|
| 339 |
+
|
| 340 |
+
## 7. Realtime verification
|
| 341 |
+
|
| 342 |
+
Graph/RGB alignment with deterministic visual backend:
|
| 343 |
+
|
| 344 |
+
```bash
|
| 345 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 346 |
+
python scripts/verify_rgb_graph_alignment.py
|
| 347 |
+
```
|
| 348 |
+
|
| 349 |
+
Full real SAM2/CLIP graph:
|
| 350 |
+
|
| 351 |
+
```bash
|
| 352 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 353 |
+
python scripts/verify_realtime_final_graph.py \
|
| 354 |
+
--visual-backend sam2 \
|
| 355 |
+
--device cuda
|
| 356 |
+
```
|
| 357 |
+
|
| 358 |
+
Required invariants:
|
| 359 |
+
|
| 360 |
+
```text
|
| 361 |
+
final_graph = true
|
| 362 |
+
D_node = 342 before target fields
|
| 363 |
+
D_node_target_aware = 344 after target fields
|
| 364 |
+
D_edge = 8
|
| 365 |
+
rgb_view_count = 3
|
| 366 |
+
rgb shape per view = [256,256,3]
|
| 367 |
+
current extraction does not advance simulator state
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
## 8. Causal boundary
|
| 371 |
+
|
| 372 |
+
```text
|
| 373 |
+
history: G[s:s+7]
|
| 374 |
+
actions: u[s+7:s+14]
|
| 375 |
+
targets: G[s+8:s+15]
|
| 376 |
+
```
|
| 377 |
+
|
| 378 |
+
- One physical graph per frame.
|
| 379 |
+
- Right/left/wrist are three observations of the same nodes.
|
| 380 |
+
- Actions remain separate from graph fields.
|
| 381 |
+
- Target bits come only from pre-action task/reset information.
|
| 382 |
+
- Future graph and future RGB are supervision only.
|
| 383 |
+
- No success/completion/progress/reward input.
|
| 384 |
+
|
| 385 |
+
See [`RGB_AND_REALTIME.md`](RGB_AND_REALTIME.md) for source-video pairing and evaluation details and [`SCHEMA.md`](SCHEMA.md) for the complete machine-facing contract.
|
gwam_active13_gwam_training_v1_20260731/RGB_AND_REALTIME.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RGB availability and current-frame evaluation graph generation
|
| 2 |
+
|
| 3 |
+
## RGB availability
|
| 4 |
+
|
| 5 |
+
The graph ZIPs do **not** contain original video or RGB images.
|
| 6 |
+
|
| 7 |
+
They contain derived observation evidence:
|
| 8 |
+
|
| 9 |
+
```text
|
| 10 |
+
three-view visibility/centroid/area/bbox
|
| 11 |
+
lossless visible masks as RLE
|
| 12 |
+
three-view sparse SAM2 features
|
| 13 |
+
CLIP type features
|
| 14 |
+
actions and physical graph state
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
Why the distinction matters:
|
| 18 |
+
|
| 19 |
+
```text
|
| 20 |
+
stored SAM2 feature != original RGB frame
|
| 21 |
+
stored RLE mask != original RGB frame
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
Graph-only and graph-feature-conditioned training can use this HF repository directly. Pixel/video prediction requires the separately distributed source RoboCasa/LeRobot videos.
|
| 25 |
+
|
| 26 |
+
## Offline RGB join
|
| 27 |
+
|
| 28 |
+
For each indexed training episode, use:
|
| 29 |
+
|
| 30 |
+
```text
|
| 31 |
+
source_tier
|
| 32 |
+
task
|
| 33 |
+
episode_id
|
| 34 |
+
graph/frames.jsonl::source_frame
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
Canonical camera order:
|
| 38 |
+
|
| 39 |
+
```text
|
| 40 |
+
0 robot0_agentview_right
|
| 41 |
+
1 robot0_agentview_left
|
| 42 |
+
2 robot0_eye_in_hand
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
Typical source layout:
|
| 46 |
+
|
| 47 |
+
```text
|
| 48 |
+
<rgb_root>/<tier>/.../<task>/<collection>/lerobot/videos/chunk-000/
|
| 49 |
+
observation.images.robot0_agentview_right/episode_xxxxxx.mp4
|
| 50 |
+
observation.images.robot0_agentview_left/episode_xxxxxx.mp4
|
| 51 |
+
observation.images.robot0_eye_in_hand/episode_xxxxxx.mp4
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
The public unified loader searches only under the indexed tier/task and requires exactly one matching file per camera. It decodes the exact source-frame indices and returns RGB in right/left/wrist order.
|
| 55 |
+
|
| 56 |
+
## Current-frame graph generation
|
| 57 |
+
|
| 58 |
+
At an allowed current state `t`:
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
simulator current state
|
| 62 |
+
+ current contacts
|
| 63 |
+
+ current three-camera segmentation/masks
|
| 64 |
+
+ current three-camera RGB
|
| 65 |
+
+ current SAM2 masked pooling
|
| 66 |
+
+ current CLIP type features
|
| 67 |
+
-> one current full physical/visual graph
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
There are not three graphs. The three camera panels are observations attached to the same physical node inventory.
|
| 71 |
+
|
| 72 |
+
### Environment setup
|
| 73 |
+
|
| 74 |
+
The HF repository bundles:
|
| 75 |
+
|
| 76 |
+
```text
|
| 77 |
+
models/sam2/checkpoints/sam2.1_hiera_base_plus.pt
|
| 78 |
+
models/clip/ViT-B-32.pt
|
| 79 |
+
models/MODEL_MANIFEST.json
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
It does not redistribute RoboCasa/MuJoCo assets. Install those locally, then run:
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
bash scripts/setup_realtime_final_graph_env.sh
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### Generate and save one current frame
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 92 |
+
python examples/realtime_env_graph_eval_loop.py \
|
| 93 |
+
--task OpenDrawer \
|
| 94 |
+
--robots PandaOmron \
|
| 95 |
+
--steps 1 \
|
| 96 |
+
--visual-backend sam2 \
|
| 97 |
+
--device cuda \
|
| 98 |
+
--save-dir ./eval_snapshot \
|
| 99 |
+
--json-output ./eval_snapshot/summary.json
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
This uses `extract_final_graph()`, not the Phase-1 debug API.
|
| 103 |
+
|
| 104 |
+
### Python API
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
from realtime.gwam_realtime_env_graph import (
|
| 108 |
+
RealtimeGWAMGraphExtractor,
|
| 109 |
+
Sam2ClipRealtimeFeatureBackend,
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
extractor = RealtimeGWAMGraphExtractor(env)
|
| 113 |
+
visual = Sam2ClipRealtimeFeatureBackend(device="cuda")
|
| 114 |
+
|
| 115 |
+
snapshot = extractor.extract_final_graph(
|
| 116 |
+
visual_backend=visual,
|
| 117 |
+
include_masks=True,
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
x = snapshot["gnn_graph"]["x"]
|
| 121 |
+
edge_index = snapshot["gnn_graph"]["edge_index"]
|
| 122 |
+
edge_attr = snapshot["gnn_graph"]["edge_attr"]
|
| 123 |
+
rgb = snapshot["rgb_frames"]
|
| 124 |
+
|
| 125 |
+
assert x.shape[1] == 342
|
| 126 |
+
assert edge_index.shape[0] == 2
|
| 127 |
+
assert edge_attr.shape[1] == 8
|
| 128 |
+
assert len(rgb) == 3
|
| 129 |
+
assert all(frame.shape == (256, 256, 3) for frame in rgb.values())
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
### Inspect storage slots before attaching task targets
|
| 133 |
+
|
| 134 |
+
```python
|
| 135 |
+
for storage_slot, node in enumerate(snapshot["graph_static"]["nodes"]):
|
| 136 |
+
print(storage_slot, node["node_id"], node["family"], node.get("articulated"))
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
Obtain the complete target list from the current task/reset specification. Then append target fields:
|
| 140 |
+
|
| 141 |
+
```python
|
| 142 |
+
from target_aware_gwam_training_dataset import (
|
| 143 |
+
attach_known_task_targets_to_realtime_graph,
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
snapshot = attach_known_task_targets_to_realtime_graph(
|
| 147 |
+
snapshot,
|
| 148 |
+
target_storage_slots=complete_target_slots,
|
| 149 |
+
provenance="RoboCasa reset task specification",
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
assert snapshot["gnn_graph"]["x_target_aware"].shape[1] == 344
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
This live helper is deliberately labeled `CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED`: it validates shape, slot presence, completeness assertions, and obvious forbidden provenance labels, but it cannot cryptographically authenticate an arbitrary live environment's task/reset object. Production evaluation must bind the supplied node IDs/slots to its own reset/task receipt. Offline training receipts remain content-addressed and source-bound.
|
| 156 |
+
|
| 157 |
+
For the nine object manipulation rules in this release, the authored target is the unique reset object named `obj`. For OpenDrawer, the complete authored target consists of the reset-selected drawer fixture root and its operative articulated drawer-slide component. Resolve those from the current reset inventory/task specification; do not hard-code slot numbers across resets.
|
| 158 |
+
|
| 159 |
+
### Save contract
|
| 160 |
+
|
| 161 |
+
`save_realtime_graph_snapshot()` writes:
|
| 162 |
+
|
| 163 |
+
```text
|
| 164 |
+
snapshot/graph/node_state.npz
|
| 165 |
+
snapshot/graph/view_evidence.npz
|
| 166 |
+
snapshot/graph/visible_masks_rle.jsonl.gz
|
| 167 |
+
snapshot/graph/visual_features_sparse.npz
|
| 168 |
+
snapshot/graph/graph_static.json
|
| 169 |
+
snapshot/graph/dynamic_edges.jsonl
|
| 170 |
+
snapshot/rgb/view_0_robot0_agentview_right.npy
|
| 171 |
+
snapshot/rgb/view_1_robot0_agentview_left.npy
|
| 172 |
+
snapshot/rgb/view_2_robot0_eye_in_hand.npy
|
| 173 |
+
snapshot/rgb_manifest.json
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
The target-aware runner additionally writes:
|
| 177 |
+
|
| 178 |
+
```text
|
| 179 |
+
target_aware_graph.npz
|
| 180 |
+
target_aware_summary.json
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
## Evaluation timing rule
|
| 184 |
+
|
| 185 |
+
Allowed:
|
| 186 |
+
|
| 187 |
+
```text
|
| 188 |
+
reset/step reaches state t
|
| 189 |
+
extract current graph G_t and current RGB I_t
|
| 190 |
+
policy/model chooses action a_t
|
| 191 |
+
step environment to t+1
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
Forbidden for default causal evaluation:
|
| 195 |
+
|
| 196 |
+
```text
|
| 197 |
+
look at G_(t+1), I_(t+1), contact_(t+1), success, reward, or completion
|
| 198 |
+
then condition the prediction/action at t
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
Future-state extraction is permitted only in an explicitly labeled oracle/teacher-forced experiment.
|
| 202 |
+
|
| 203 |
+
## Verification
|
| 204 |
+
|
| 205 |
+
```bash
|
| 206 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 207 |
+
python scripts/verify_rgb_graph_alignment.py
|
| 208 |
+
|
| 209 |
+
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
|
| 210 |
+
python scripts/verify_realtime_final_graph.py \
|
| 211 |
+
--visual-backend sam2 \
|
| 212 |
+
--device cuda
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
The first command verifies current-state immutability and exact RGB/mask/feature alignment. The second verifies the real full SAM2/CLIP path and required 342-D/8-D graph dimensions.
|
gwam_active13_gwam_training_v1_20260731/SCHEMA.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Active-13 direct-use target-aware GWAM training schema v1
|
| 2 |
+
|
| 3 |
+
## Release identity
|
| 4 |
+
|
| 5 |
+
```text
|
| 6 |
+
prefix: gwam_active13_gwam_training_v1_20260731/
|
| 7 |
+
schema: gwam.active13.gwam_training_episode.v1
|
| 8 |
+
status: LAZY_DERIVED_VIEW
|
| 9 |
+
canonical episode rows: 2,699
|
| 10 |
+
legal L=8/H=8/stride-1 windows: 702,094
|
| 11 |
+
canonical ZIP bytes referenced: 20,339,307,035
|
| 12 |
+
original RGB stored in graph ZIPs: false
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
This package is a content-addressed join and executable loader. It does not duplicate or mutate canonical episode ZIPs or target receipts.
|
| 16 |
+
|
| 17 |
+
## Training index row
|
| 18 |
+
|
| 19 |
+
Each line in `TRAINING_EPISODES.jsonl` contains:
|
| 20 |
+
|
| 21 |
+
```text
|
| 22 |
+
schema
|
| 23 |
+
universe_index
|
| 24 |
+
episode_key
|
| 25 |
+
source_tier
|
| 26 |
+
task
|
| 27 |
+
episode_id
|
| 28 |
+
source_group_id
|
| 29 |
+
model_split = train
|
| 30 |
+
canonical_zip_path
|
| 31 |
+
canonical_zip_sha256
|
| 32 |
+
canonical_zip_size
|
| 33 |
+
type_clip32_overlay_applied
|
| 34 |
+
frames_processed
|
| 35 |
+
history_length = 8
|
| 36 |
+
horizon = 8
|
| 37 |
+
valid_start_count
|
| 38 |
+
target_receipt_path
|
| 39 |
+
target_receipt_sha256
|
| 40 |
+
target_cardinality
|
| 41 |
+
resolution_status = RESOLVED
|
| 42 |
+
rgb_in_graph_zip = false
|
| 43 |
+
rgb_join_key
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
`valid_start_count = frames_processed - 8 - 8 + 1`. The index does not create windows using future activity or outcomes.
|
| 47 |
+
|
| 48 |
+
## Sample temporal contract
|
| 49 |
+
|
| 50 |
+
For zero-based start `s`:
|
| 51 |
+
|
| 52 |
+
```text
|
| 53 |
+
history graph frames: s ... s+7
|
| 54 |
+
anchor graph frame: s+7
|
| 55 |
+
action frames: s+7 ... s+14
|
| 56 |
+
future target frames: s+8 ... s+15
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
The action at frame `t` is the logged condition for transition `G_t -> G_(t+1)`.
|
| 60 |
+
|
| 61 |
+
## Existing typed fields retained
|
| 62 |
+
|
| 63 |
+
The unified loader delegates source parsing and strict integrity checks to root `loaders/gwam_full_graph_window.py`. It retains:
|
| 64 |
+
|
| 65 |
+
```text
|
| 66 |
+
history.static_flags float32[L,N,2]
|
| 67 |
+
history.kinematic_state float32[L,N,15]
|
| 68 |
+
history.state_visibility float32[L,N,3]
|
| 69 |
+
history.state_plus_visibility float32[L,N,20]
|
| 70 |
+
history.node_valid bool[L,N]
|
| 71 |
+
history.family_id int64[N]
|
| 72 |
+
history.type_clip32 float32[N,32]
|
| 73 |
+
history.type_clip_valid bool[N]
|
| 74 |
+
history.view_evidence float32[L,N,3,8]
|
| 75 |
+
history.sam2_visual float32[L,N,3,256]
|
| 76 |
+
history.sam2_valid bool[L,N,3]
|
| 77 |
+
history.sam2_failed bool[L,N,3]
|
| 78 |
+
history.mask_raster float32[L,N,3,1,16,16]
|
| 79 |
+
history.mask_valid bool[L,N,3]
|
| 80 |
+
history.edge_index list[L] int64[2,E_t]
|
| 81 |
+
history.edge_attr list[L] float32[E_t,8]
|
| 82 |
+
|
| 83 |
+
future_action float32[8,12]
|
| 84 |
+
future_action_valid bool[8]
|
| 85 |
+
|
| 86 |
+
targets.kinematic_state float32[8,N,15]
|
| 87 |
+
targets.view_evidence float32[8,N,3,8]
|
| 88 |
+
targets.contact_pair_index int64[2,Q]
|
| 89 |
+
targets.contact_pair_event int64[8,Q]
|
| 90 |
+
targets.contact_pair_valid bool[8,Q]
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
`N` is the active node count. `Q=N*(N-1)/2` is the full unique unordered pair domain.
|
| 94 |
+
|
| 95 |
+
## Direct rich GWAM convenience tensor
|
| 96 |
+
|
| 97 |
+
```text
|
| 98 |
+
history.gwam_node_features float32[L,N,344]
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
| Columns | Width | Source |
|
| 102 |
+
|---:|---:|---|
|
| 103 |
+
| `0:20` | 20 | `state_plus_visibility` |
|
| 104 |
+
| `20:30` | 10 | one-hot `family_id` |
|
| 105 |
+
| `30:286` | 256 | view-valid mean of `sam2_visual` across the explicit camera axis |
|
| 106 |
+
| `286:318` | 32 | validity-gated `type_clip32` |
|
| 107 |
+
| `318:342` | 24 | flattened right/left/wrist `view_evidence` |
|
| 108 |
+
| `342:343` | 1 | `is_task_target` |
|
| 109 |
+
| `343:344` | 1 | `task_target_valid` |
|
| 110 |
+
|
| 111 |
+
The loader also retains non-averaged `[L,N,3,...]` records. The SAM2 mean exists only for compatibility with the prior 342-D GWAM interface.
|
| 112 |
+
|
| 113 |
+
Target invariants:
|
| 114 |
+
|
| 115 |
+
```text
|
| 116 |
+
is_task_target <= task_target_valid <= anchor node_valid
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
Unknown target is `(0,0)`, confirmed non-target is `(0,1)`, and confirmed target is `(1,1)`.
|
| 120 |
+
|
| 121 |
+
## Batched contract
|
| 122 |
+
|
| 123 |
+
`dataset.collate(samples, as_torch=True)` returns batch-max node padding:
|
| 124 |
+
|
| 125 |
+
```text
|
| 126 |
+
history.gwam_node_features [B,8,N_batch_max,344]
|
| 127 |
+
history.node_valid [B,8,N_batch_max]
|
| 128 |
+
history.is_task_target [B,N_batch_max]
|
| 129 |
+
history.task_target_valid [B,N_batch_max]
|
| 130 |
+
future_action [B,8,12]
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
Ragged edges receive batch offsets and batch/time ids through the inherited canonical collator. Full-pair targets receive explicit padding and validity.
|
| 134 |
+
|
| 135 |
+
## RGB contract
|
| 136 |
+
|
| 137 |
+
Canonical graph ZIPs do not contain RGB/video bytes.
|
| 138 |
+
|
| 139 |
+
When `rgb_mode=history` or `history_future`, a separately supplied `rgb_root` is mandatory. The loader reads exact frame alignment from `graph/frames.jsonl::source_frame`, requires one source video per camera, and returns:
|
| 140 |
+
|
| 141 |
+
```text
|
| 142 |
+
rgb.frames uint8[T_rgb,3,256,256,3]
|
| 143 |
+
rgb.graph_frame_indices int64[T_rgb]
|
| 144 |
+
rgb.source_frame_indices int64[T_rgb]
|
| 145 |
+
rgb.cameras [right,left,wrist]
|
| 146 |
+
rgb.stored_in_graph_zip false
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
`T_rgb=8` for history and `T_rgb=16` for history+future.
|
| 150 |
+
|
| 151 |
+
## Current-frame online evaluation
|
| 152 |
+
|
| 153 |
+
Root `realtime/gwam_realtime_env_graph.py::extract_final_graph()` returns:
|
| 154 |
+
|
| 155 |
+
```text
|
| 156 |
+
gnn_graph.x float32[N,342]
|
| 157 |
+
gnn_graph.edge_index int64[2,E]
|
| 158 |
+
gnn_graph.edge_attr float32[E,8]
|
| 159 |
+
rgb_frames[v] uint8[256,256,3], v=0,1,2
|
| 160 |
+
rgb_frame_cameras ordered camera names
|
| 161 |
+
visual_features_sparse current masked SAM2 rows
|
| 162 |
+
graph_static current persistent inventory/prior edges
|
| 163 |
+
rle_masks current exact visible masks
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
The target helper appends only pre-action task/reset target fields:
|
| 167 |
+
|
| 168 |
+
```text
|
| 169 |
+
gnn_graph.x_target_aware float32[N,344]
|
| 170 |
+
gnn_graph.is_task_target bool[N]
|
| 171 |
+
gnn_graph.task_target_valid bool[N]
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
It requires a complete sorted unique target storage-slot list and nonempty provenance. It fails on absent slots and rejects provenance strings naming future/success/reward/outcome sources.
|
| 175 |
+
|
| 176 |
+
Live target metadata is marked `CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED`; the helper does not claim cryptographic authentication of arbitrary environment reset objects. Evaluation harnesses must bind this assertion to their own task/reset receipt.
|
| 177 |
+
|
| 178 |
+
`extract_current_graph()` is Phase-1/debug only and is not the final GWAM graph.
|
| 179 |
+
|
| 180 |
+
## Causal exclusions
|
| 181 |
+
|
| 182 |
+
Model inputs must exclude:
|
| 183 |
+
|
| 184 |
+
```text
|
| 185 |
+
future graph
|
| 186 |
+
future RGB
|
| 187 |
+
future contacts/geometry
|
| 188 |
+
success/reward/termination
|
| 189 |
+
finished/completed/progress
|
| 190 |
+
correct-next-action labels
|
| 191 |
+
outcome-derived target identity
|
| 192 |
+
```
|
gwam_active13_gwam_training_v1_20260731/TRAINING_EPISODES.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gwam_active13_gwam_training_v1_20260731/download_training_data.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download the complete graph-only target-aware GWAM training view.
|
| 3 |
+
|
| 4 |
+
This intentionally does not claim to download original RGB videos: they are not
|
| 5 |
+
stored in GWAM_Data. The script downloads all 2,699 referenced canonical graph
|
| 6 |
+
ZIPs, the target sidecar, unified loader, root temporal loader, and realtime
|
| 7 |
+
evaluation code/weights.
|
| 8 |
+
"""
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import importlib
|
| 13 |
+
import json
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
REPO = "ChangChrisLiu/GWAM_Data"
|
| 17 |
+
REVISION = "gwam-target-v2.0.1-training-v1"
|
| 18 |
+
PREFIX = "gwam_active13_gwam_training_v1_20260731"
|
| 19 |
+
TARGET_PREFIX = "gwam_active13_target_physical_v2_0_1_20260731"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def main() -> int:
|
| 23 |
+
parser = argparse.ArgumentParser()
|
| 24 |
+
parser.add_argument("--local-dir", type=Path, required=True)
|
| 25 |
+
parser.add_argument("--revision", default=REVISION)
|
| 26 |
+
parser.add_argument(
|
| 27 |
+
"--no-realtime",
|
| 28 |
+
action="store_true",
|
| 29 |
+
help="Skip online current-frame extraction code and bundled feature weights",
|
| 30 |
+
)
|
| 31 |
+
args = parser.parse_args()
|
| 32 |
+
args.local_dir.mkdir(parents=True, exist_ok=True)
|
| 33 |
+
hub = importlib.import_module("huggingface_hub")
|
| 34 |
+
|
| 35 |
+
index_cache = hub.hf_hub_download(
|
| 36 |
+
REPO,
|
| 37 |
+
f"{PREFIX}/TRAINING_EPISODES.jsonl",
|
| 38 |
+
repo_type="dataset",
|
| 39 |
+
revision=args.revision,
|
| 40 |
+
)
|
| 41 |
+
rows = [json.loads(line) for line in Path(index_cache).read_text().splitlines() if line]
|
| 42 |
+
if len(rows) != 2699:
|
| 43 |
+
raise RuntimeError(f"expected 2699 training episodes, got {len(rows)}")
|
| 44 |
+
|
| 45 |
+
patterns = sorted({row["canonical_zip_path"] for row in rows})
|
| 46 |
+
patterns.extend(
|
| 47 |
+
[
|
| 48 |
+
f"{PREFIX}/**",
|
| 49 |
+
f"{TARGET_PREFIX}/**",
|
| 50 |
+
"gwam_v12_sparse_v2_type_clip32_patch_20260725/**",
|
| 51 |
+
"loaders/gwam_full_graph_window.py",
|
| 52 |
+
"README.md",
|
| 53 |
+
"SCHEMA.md",
|
| 54 |
+
]
|
| 55 |
+
)
|
| 56 |
+
if not args.no_realtime:
|
| 57 |
+
patterns.extend(
|
| 58 |
+
[
|
| 59 |
+
"realtime/**",
|
| 60 |
+
"examples/realtime_env_graph_eval_loop.py",
|
| 61 |
+
"docs/REALTIME_ENV_GRAPH_PIPELINE.md",
|
| 62 |
+
"scripts/setup_realtime_final_graph_env.sh",
|
| 63 |
+
"scripts/verify_realtime_final_graph.py",
|
| 64 |
+
"scripts/verify_rgb_graph_alignment.py",
|
| 65 |
+
"models/**",
|
| 66 |
+
]
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
path = hub.snapshot_download(
|
| 70 |
+
REPO,
|
| 71 |
+
repo_type="dataset",
|
| 72 |
+
revision=args.revision,
|
| 73 |
+
allow_patterns=patterns,
|
| 74 |
+
local_dir=args.local_dir,
|
| 75 |
+
)
|
| 76 |
+
print(
|
| 77 |
+
json.dumps(
|
| 78 |
+
{
|
| 79 |
+
"status": "DOWNLOADED",
|
| 80 |
+
"root": str(Path(path).resolve()),
|
| 81 |
+
"revision": args.revision,
|
| 82 |
+
"episodes": len(rows),
|
| 83 |
+
"graph_rgb_included": False,
|
| 84 |
+
"next": (
|
| 85 |
+
f"python {PREFIX}/loader/target_aware_gwam_training_dataset.py "
|
| 86 |
+
f"--root {Path(path).resolve()} --index 0"
|
| 87 |
+
),
|
| 88 |
+
},
|
| 89 |
+
indent=2,
|
| 90 |
+
)
|
| 91 |
+
)
|
| 92 |
+
return 0
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
if __name__ == "__main__":
|
| 96 |
+
raise SystemExit(main())
|
gwam_active13_gwam_training_v1_20260731/examples/VALIDATED_OUTPUT.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifact_type": "GWAMActive13DirectTrainingValidatedExamples",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"offline_graph_only": {
|
| 5 |
+
"episode_key": "pretrain/PickPlaceCabinetToCounter/episode_000000",
|
| 6 |
+
"dataset_window_count": 702094,
|
| 7 |
+
"index": 0,
|
| 8 |
+
"history_gwam_node_features": [8, 79, 344],
|
| 9 |
+
"history_sam2_visual": [8, 79, 3, 256],
|
| 10 |
+
"history_view_evidence": [8, 79, 3, 8],
|
| 11 |
+
"future_action": [8, 12],
|
| 12 |
+
"target_count": 1,
|
| 13 |
+
"rgb_in_graph_zip": false
|
| 14 |
+
},
|
| 15 |
+
"prior_342_byte_equivalence": {
|
| 16 |
+
"episode_key": "pretrain/PickPlaceCabinetToCounter/episode_000000",
|
| 17 |
+
"frame": 0,
|
| 18 |
+
"new_first_342": [79, 342],
|
| 19 |
+
"prior_loader_x": [79, 342],
|
| 20 |
+
"exact_equal": true,
|
| 21 |
+
"max_absolute_difference": 0.0
|
| 22 |
+
},
|
| 23 |
+
"offline_separate_rgb_join": {
|
| 24 |
+
"episode_key": "pretrain/PickPlaceCabinetToCounter/episode_000000",
|
| 25 |
+
"rgb_frames": [16, 3, 256, 256, 3],
|
| 26 |
+
"dtype": "uint8",
|
| 27 |
+
"camera_order": [
|
| 28 |
+
"robot0_agentview_right",
|
| 29 |
+
"robot0_agentview_left",
|
| 30 |
+
"robot0_eye_in_hand"
|
| 31 |
+
],
|
| 32 |
+
"source_frame_indices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
| 33 |
+
"pixel_min": 0,
|
| 34 |
+
"pixel_max": 255,
|
| 35 |
+
"rgb_source": "separate RoboCasa/LeRobot source root"
|
| 36 |
+
},
|
| 37 |
+
"live_full_graph": {
|
| 38 |
+
"task": "OpenDrawer",
|
| 39 |
+
"N_real": 146,
|
| 40 |
+
"x": [146, 342],
|
| 41 |
+
"edge_index": [2, 106],
|
| 42 |
+
"edge_attr": [106, 8],
|
| 43 |
+
"sam2_feature_rows": 52,
|
| 44 |
+
"invalid_visible_pairs": 0,
|
| 45 |
+
"rgb_view_count": 3,
|
| 46 |
+
"rgb_shape_each": [256, 256, 3],
|
| 47 |
+
"rgb_aligned_with_view_ids": true
|
| 48 |
+
},
|
| 49 |
+
"live_target_aware_graph": {
|
| 50 |
+
"task": "PickPlaceCabinetToCounter",
|
| 51 |
+
"N_real": 125,
|
| 52 |
+
"x_target_aware": [125, 344],
|
| 53 |
+
"edge_index": [2, 91],
|
| 54 |
+
"edge_attr": [91, 8],
|
| 55 |
+
"target_node_ids": ["obj"],
|
| 56 |
+
"target_storage_slots": [1],
|
| 57 |
+
"target_provenance_status": "CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED",
|
| 58 |
+
"rgb_view_count": 3
|
| 59 |
+
},
|
| 60 |
+
"verification": {
|
| 61 |
+
"focused_tests": "9 passed",
|
| 62 |
+
"all_target_receipts": "2699 validated",
|
| 63 |
+
"two_worker_batch": {
|
| 64 |
+
"multiprocessing_context": "spawn",
|
| 65 |
+
"gwam_node_features": [2, 8, 79, 344],
|
| 66 |
+
"future_action": [2, 8, 12]
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
gwam_active13_gwam_training_v1_20260731/examples/current_frame_target_aware_eval.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Generate one full target-aware GWAM graph from the current RoboCasa frame.
|
| 3 |
+
|
| 4 |
+
The physical/visual graph is generated automatically from the current simulator
|
| 5 |
+
state and three aligned RGB views. Target slots must be supplied from task/reset
|
| 6 |
+
information known before action selection; this script refuses to infer them
|
| 7 |
+
from actions, contacts, success, rewards, or future states.
|
| 8 |
+
"""
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import json
|
| 13 |
+
import sys
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
|
| 18 |
+
PREFIX_ROOT = Path(__file__).resolve().parents[1]
|
| 19 |
+
REPO_ROOT = PREFIX_ROOT.parents[0]
|
| 20 |
+
for path in (REPO_ROOT, PREFIX_ROOT / "loader"):
|
| 21 |
+
if str(path) not in sys.path:
|
| 22 |
+
sys.path.insert(0, str(path))
|
| 23 |
+
|
| 24 |
+
from realtime.gwam_realtime_env_graph import ( # noqa: E402
|
| 25 |
+
RealtimeGWAMGraphExtractor,
|
| 26 |
+
Sam2ClipRealtimeFeatureBackend,
|
| 27 |
+
save_realtime_graph_snapshot,
|
| 28 |
+
)
|
| 29 |
+
from target_aware_gwam_training_dataset import ( # noqa: E402
|
| 30 |
+
attach_known_task_targets_to_realtime_graph,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def make_env(task: str, robots: str):
|
| 35 |
+
import robocasa # noqa: F401
|
| 36 |
+
import robosuite
|
| 37 |
+
|
| 38 |
+
return robosuite.make(
|
| 39 |
+
task,
|
| 40 |
+
robots=robots,
|
| 41 |
+
has_renderer=False,
|
| 42 |
+
has_offscreen_renderer=True,
|
| 43 |
+
use_object_obs=True,
|
| 44 |
+
use_camera_obs=True,
|
| 45 |
+
camera_names=[
|
| 46 |
+
"robot0_agentview_right",
|
| 47 |
+
"robot0_agentview_left",
|
| 48 |
+
"robot0_eye_in_hand",
|
| 49 |
+
],
|
| 50 |
+
camera_heights=256,
|
| 51 |
+
camera_widths=256,
|
| 52 |
+
camera_depths=False,
|
| 53 |
+
reward_shaping=False,
|
| 54 |
+
ignore_done=True,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def main() -> int:
|
| 59 |
+
parser = argparse.ArgumentParser()
|
| 60 |
+
parser.add_argument("--task", default="OpenDrawer")
|
| 61 |
+
parser.add_argument("--robots", default="PandaOmron")
|
| 62 |
+
parser.add_argument("--device", default="cuda")
|
| 63 |
+
parser.add_argument(
|
| 64 |
+
"--target-slot",
|
| 65 |
+
type=int,
|
| 66 |
+
action="append",
|
| 67 |
+
default=[],
|
| 68 |
+
help="Repeat for every complete task-target storage slot known from reset/task metadata",
|
| 69 |
+
)
|
| 70 |
+
parser.add_argument(
|
| 71 |
+
"--target-node-id",
|
| 72 |
+
action="append",
|
| 73 |
+
default=[],
|
| 74 |
+
help="Repeat for authored target node IDs, e.g. --target-node-id obj",
|
| 75 |
+
)
|
| 76 |
+
parser.add_argument(
|
| 77 |
+
"--target-provenance",
|
| 78 |
+
required=True,
|
| 79 |
+
help="Non-outcome source, e.g. 'RoboCasa reset task specification OpenDrawer'",
|
| 80 |
+
)
|
| 81 |
+
parser.add_argument("--save-dir", type=Path, required=True)
|
| 82 |
+
args = parser.parse_args()
|
| 83 |
+
if not args.target_slot and not args.target_node_id:
|
| 84 |
+
parser.error("provide at least one --target-slot or --target-node-id")
|
| 85 |
+
|
| 86 |
+
env = make_env(args.task, args.robots)
|
| 87 |
+
try:
|
| 88 |
+
env.reset()
|
| 89 |
+
backend = Sam2ClipRealtimeFeatureBackend(device=args.device)
|
| 90 |
+
extractor = RealtimeGWAMGraphExtractor(env)
|
| 91 |
+
snapshot = extractor.extract_final_graph(
|
| 92 |
+
visual_backend=backend,
|
| 93 |
+
include_masks=True,
|
| 94 |
+
)
|
| 95 |
+
nodes = snapshot["graph_static"]["nodes"]
|
| 96 |
+
node_to_slot = {node["node_id"]: slot for slot, node in enumerate(nodes)}
|
| 97 |
+
unknown_ids = sorted(set(args.target_node_id).difference(node_to_slot))
|
| 98 |
+
if unknown_ids:
|
| 99 |
+
raise RuntimeError(f"target node IDs are absent from current inventory: {unknown_ids}")
|
| 100 |
+
target_slots = sorted(
|
| 101 |
+
set(args.target_slot).union(node_to_slot[node_id] for node_id in args.target_node_id)
|
| 102 |
+
)
|
| 103 |
+
snapshot = attach_known_task_targets_to_realtime_graph(
|
| 104 |
+
snapshot,
|
| 105 |
+
target_storage_slots=target_slots,
|
| 106 |
+
provenance=args.target_provenance,
|
| 107 |
+
)
|
| 108 |
+
save_realtime_graph_snapshot(snapshot, args.save_dir)
|
| 109 |
+
graph = snapshot["gnn_graph"]
|
| 110 |
+
np.savez_compressed(
|
| 111 |
+
args.save_dir / "target_aware_graph.npz",
|
| 112 |
+
x_target_aware=graph["x_target_aware"],
|
| 113 |
+
is_task_target=graph["is_task_target"],
|
| 114 |
+
task_target_valid=graph["task_target_valid"],
|
| 115 |
+
slot_ids=graph["slot_ids"],
|
| 116 |
+
edge_index=graph["edge_index"],
|
| 117 |
+
edge_attr=graph["edge_attr"],
|
| 118 |
+
)
|
| 119 |
+
result = {
|
| 120 |
+
"status": "CURRENT_FRAME_TARGET_AWARE_GRAPH_GENERATED",
|
| 121 |
+
"task": args.task,
|
| 122 |
+
"N_real": int(graph["x"].shape[0]),
|
| 123 |
+
"physical_visual_feature_dim": int(graph["x"].shape[1]),
|
| 124 |
+
"target_aware_feature_dim": int(graph["x_target_aware"].shape[1]),
|
| 125 |
+
"edge_count": int(graph["edge_index"].shape[1]),
|
| 126 |
+
"edge_dim": int(graph["edge_attr"].shape[1]),
|
| 127 |
+
"target_storage_slots": target_slots,
|
| 128 |
+
"target_node_ids": args.target_node_id,
|
| 129 |
+
"rgb_view_count": len(snapshot["rgb_frames"]),
|
| 130 |
+
"rgb_cameras": list(snapshot["rgb_frame_cameras"]),
|
| 131 |
+
"saved_to": str(args.save_dir.resolve()),
|
| 132 |
+
"causal_time": "current state after reset and before the next action",
|
| 133 |
+
}
|
| 134 |
+
(args.save_dir / "target_aware_summary.json").write_text(
|
| 135 |
+
json.dumps(result, indent=2) + "\n", encoding="utf-8"
|
| 136 |
+
)
|
| 137 |
+
print(json.dumps(result, indent=2))
|
| 138 |
+
finally:
|
| 139 |
+
try:
|
| 140 |
+
env.close()
|
| 141 |
+
except Exception:
|
| 142 |
+
pass
|
| 143 |
+
return 0
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
if __name__ == "__main__":
|
| 147 |
+
raise SystemExit(main())
|
gwam_active13_gwam_training_v1_20260731/loader/target_aware_gwam_training_dataset.py
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Direct-use target-aware GWAM temporal training dataset.
|
| 3 |
+
|
| 4 |
+
This loader joins three immutable public layers without rewriting them:
|
| 5 |
+
1. canonical GWAM v1.2 sparse-v2 episode ZIPs;
|
| 6 |
+
2. the strict full temporal graph-window loader;
|
| 7 |
+
3. GraphPacket-Slim v2.0.1 target-resolution receipts.
|
| 8 |
+
|
| 9 |
+
It returns the original typed temporal graph plus a convenience 344-D rich GWAM
|
| 10 |
+
node tensor: 342 prior-release dimensions + [is_task_target,
|
| 11 |
+
task_target_valid]. Original RGB videos are not stored in graph ZIPs. When a
|
| 12 |
+
local RoboCasa/LeRobot RGB root is supplied, the loader can decode exact
|
| 13 |
+
history/future frames using graph/frames.jsonl::source_frame.
|
| 14 |
+
"""
|
| 15 |
+
from __future__ import annotations
|
| 16 |
+
|
| 17 |
+
import argparse
|
| 18 |
+
import bisect
|
| 19 |
+
import hashlib
|
| 20 |
+
import importlib.util
|
| 21 |
+
import importlib
|
| 22 |
+
import json
|
| 23 |
+
import sys
|
| 24 |
+
from collections import OrderedDict
|
| 25 |
+
from pathlib import Path
|
| 26 |
+
from types import ModuleType
|
| 27 |
+
from typing import Any, Literal, Sequence
|
| 28 |
+
|
| 29 |
+
import numpy as np
|
| 30 |
+
|
| 31 |
+
PREFIX = "gwam_active13_gwam_training_v1_20260731"
|
| 32 |
+
TARGET_PREFIX = "gwam_active13_target_physical_v2_0_1_20260731"
|
| 33 |
+
CAMERAS = (
|
| 34 |
+
"robot0_agentview_right",
|
| 35 |
+
"robot0_agentview_left",
|
| 36 |
+
"robot0_eye_in_hand",
|
| 37 |
+
)
|
| 38 |
+
FEATURE_SCHEMA = (
|
| 39 |
+
("physical_state", 0, 20),
|
| 40 |
+
("family_onehot", 20, 30),
|
| 41 |
+
("sam2_view_valid_mean", 30, 286),
|
| 42 |
+
("type_clip32", 286, 318),
|
| 43 |
+
("view_evidence_right_left_wrist", 318, 342),
|
| 44 |
+
("is_task_target", 342, 343),
|
| 45 |
+
("task_target_valid", 343, 344),
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class GWAMTrainingViewError(RuntimeError):
|
| 50 |
+
"""Training view is missing, malformed, or provenance-inconsistent."""
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def _load_module(name: str, path: Path) -> ModuleType:
|
| 54 |
+
if not path.is_file():
|
| 55 |
+
raise GWAMTrainingViewError(f"required public loader is missing: {path}")
|
| 56 |
+
spec = importlib.util.spec_from_file_location(name, path)
|
| 57 |
+
if spec is None or spec.loader is None:
|
| 58 |
+
raise GWAMTrainingViewError(f"cannot import public loader: {path}")
|
| 59 |
+
module = importlib.util.module_from_spec(spec)
|
| 60 |
+
sys.modules[name] = module
|
| 61 |
+
spec.loader.exec_module(module)
|
| 62 |
+
return module
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def _decode_256_lsb_first(value: object) -> np.ndarray:
|
| 66 |
+
if not isinstance(value, str) or len(value) != 64:
|
| 67 |
+
raise GWAMTrainingViewError("target receipt bitset is not 256-bit lowercase hex")
|
| 68 |
+
try:
|
| 69 |
+
raw = bytes.fromhex(value)
|
| 70 |
+
except ValueError as error:
|
| 71 |
+
raise GWAMTrainingViewError("target receipt bitset is not hex") from error
|
| 72 |
+
return np.asarray(
|
| 73 |
+
[(raw[n // 8] >> (n % 8)) & 1 for n in range(256)], dtype=np.bool_
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def _sha256(path: Path) -> str:
|
| 78 |
+
digest = hashlib.sha256()
|
| 79 |
+
with path.open("rb") as stream:
|
| 80 |
+
for block in iter(lambda: stream.read(1024 * 1024), b""):
|
| 81 |
+
digest.update(block)
|
| 82 |
+
return digest.hexdigest()
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def _fuse_rich_history(
|
| 86 |
+
sample: dict[str, Any], is_target: np.ndarray, target_valid: np.ndarray
|
| 87 |
+
) -> tuple[np.ndarray, np.ndarray]:
|
| 88 |
+
history = sample["history"]
|
| 89 |
+
state = np.asarray(history["state_plus_visibility"], dtype=np.float32)
|
| 90 |
+
if state.ndim != 3 or state.shape[2] != 20:
|
| 91 |
+
raise GWAMTrainingViewError("state_plus_visibility must be [L,N,20]")
|
| 92 |
+
length, nodes, _ = state.shape
|
| 93 |
+
|
| 94 |
+
family = np.asarray(history["family_id"], dtype=np.int64)
|
| 95 |
+
if family.shape != (nodes,) or np.any((family < 0) | (family > 9)):
|
| 96 |
+
raise GWAMTrainingViewError("family_id must be [N] in 0..9")
|
| 97 |
+
family_onehot = np.eye(10, dtype=np.float32)[family]
|
| 98 |
+
family_onehot = np.broadcast_to(family_onehot[None], (length, nodes, 10))
|
| 99 |
+
|
| 100 |
+
sam2 = np.asarray(history["sam2_visual"], dtype=np.float32)
|
| 101 |
+
sam2_valid = np.asarray(history["sam2_valid"], dtype=np.bool_)
|
| 102 |
+
if sam2.shape != (length, nodes, 3, 256) or sam2_valid.shape != (
|
| 103 |
+
length,
|
| 104 |
+
nodes,
|
| 105 |
+
3,
|
| 106 |
+
):
|
| 107 |
+
raise GWAMTrainingViewError("SAM2 fields must be [L,N,3,256] and [L,N,3]")
|
| 108 |
+
masked = np.where(sam2_valid[..., None], sam2, 0.0)
|
| 109 |
+
counts = sam2_valid.sum(axis=2, dtype=np.int32)
|
| 110 |
+
visual_valid = counts > 0
|
| 111 |
+
visual = masked.sum(axis=2, dtype=np.float32) / np.maximum(counts[..., None], 1)
|
| 112 |
+
visual = np.where(visual_valid[..., None], visual, 0.0).astype(np.float32)
|
| 113 |
+
|
| 114 |
+
type_clip = np.asarray(history["type_clip32"], dtype=np.float32)
|
| 115 |
+
type_valid = np.asarray(history["type_clip_valid"], dtype=np.bool_)
|
| 116 |
+
if type_clip.shape != (nodes, 32) or type_valid.shape != (nodes,):
|
| 117 |
+
raise GWAMTrainingViewError("type_clip32 fields must be [N,32] and [N]")
|
| 118 |
+
type_clip = np.where(type_valid[:, None], type_clip, 0.0)
|
| 119 |
+
type_clip = np.broadcast_to(type_clip[None], (length, nodes, 32))
|
| 120 |
+
|
| 121 |
+
views = np.asarray(history["view_evidence"], dtype=np.float32)
|
| 122 |
+
if views.shape != (length, nodes, 3, 8):
|
| 123 |
+
raise GWAMTrainingViewError("view_evidence must be [L,N,3,8]")
|
| 124 |
+
views = views.reshape(length, nodes, 24)
|
| 125 |
+
|
| 126 |
+
if is_target.shape != (nodes,) or target_valid.shape != (nodes,):
|
| 127 |
+
raise GWAMTrainingViewError("target fields must align to active N")
|
| 128 |
+
target = np.stack((is_target, target_valid), axis=-1).astype(np.float32)
|
| 129 |
+
target = np.broadcast_to(target[None], (length, nodes, 2))
|
| 130 |
+
|
| 131 |
+
fused = np.concatenate(
|
| 132 |
+
(state, family_onehot, visual, type_clip, views, target), axis=-1
|
| 133 |
+
).astype(np.float32)
|
| 134 |
+
if fused.shape != (length, nodes, 344):
|
| 135 |
+
raise GWAMTrainingViewError("fused rich history did not produce [L,N,344]")
|
| 136 |
+
return np.ascontiguousarray(fused), visual_valid
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def attach_known_task_targets_to_realtime_graph(
|
| 140 |
+
snapshot: dict[str, Any],
|
| 141 |
+
*,
|
| 142 |
+
target_storage_slots: Sequence[int],
|
| 143 |
+
provenance: str,
|
| 144 |
+
) -> dict[str, Any]:
|
| 145 |
+
"""Append the two target channels to a full online 342-D current graph.
|
| 146 |
+
|
| 147 |
+
`target_storage_slots` must come from task/reset information available before
|
| 148 |
+
action selection. This helper never guesses targets from contact, actions,
|
| 149 |
+
rewards, success, or a future state. The caller must provide the complete
|
| 150 |
+
target set; all active non-target nodes are then valid closed-world negatives.
|
| 151 |
+
"""
|
| 152 |
+
if not isinstance(provenance, str) or not provenance.strip():
|
| 153 |
+
raise GWAMTrainingViewError("nonempty pre-action target provenance is required")
|
| 154 |
+
if any(token in provenance.lower() for token in ("future", "success", "reward", "outcome")):
|
| 155 |
+
raise GWAMTrainingViewError("target provenance names a forbidden outcome/future source")
|
| 156 |
+
graph = snapshot.get("gnn_graph")
|
| 157 |
+
if not isinstance(graph, dict):
|
| 158 |
+
raise GWAMTrainingViewError("realtime snapshot lacks gnn_graph")
|
| 159 |
+
x = np.asarray(graph.get("x"), dtype=np.float32)
|
| 160 |
+
slots = np.asarray(graph.get("slot_ids"), dtype=np.int64)
|
| 161 |
+
if x.ndim != 2 or x.shape[1] != 342 or slots.shape != (x.shape[0],):
|
| 162 |
+
raise GWAMTrainingViewError("realtime full graph must have x[N,342] and slot_ids[N]")
|
| 163 |
+
requested = list(target_storage_slots)
|
| 164 |
+
if not requested or any(type(slot) is not int or not 0 <= slot < 256 for slot in requested):
|
| 165 |
+
raise GWAMTrainingViewError("target_storage_slots must be a nonempty list of slots 0..255")
|
| 166 |
+
if requested != sorted(set(requested)):
|
| 167 |
+
raise GWAMTrainingViewError("target_storage_slots must be sorted and unique")
|
| 168 |
+
missing = sorted(set(requested).difference(int(slot) for slot in slots))
|
| 169 |
+
if missing:
|
| 170 |
+
raise GWAMTrainingViewError(f"target storage slots are absent from current graph: {missing}")
|
| 171 |
+
is_target = np.isin(slots, np.asarray(requested, dtype=np.int64))
|
| 172 |
+
target_valid = np.ones(slots.shape, dtype=np.bool_)
|
| 173 |
+
target_fields = np.stack((is_target, target_valid), axis=-1).astype(np.float32)
|
| 174 |
+
graph["is_task_target"] = is_target
|
| 175 |
+
graph["task_target_valid"] = target_valid
|
| 176 |
+
graph["x_target_aware"] = np.ascontiguousarray(np.concatenate((x, target_fields), axis=-1))
|
| 177 |
+
metadata = graph.setdefault("metadata", {})
|
| 178 |
+
metadata["target_provenance"] = provenance
|
| 179 |
+
metadata["target_provenance_status"] = "CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED"
|
| 180 |
+
metadata["target_storage_slots"] = requested
|
| 181 |
+
metadata["target_aware_feature_dim"] = 344
|
| 182 |
+
return snapshot
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def _numpy_to_torch(value: Any) -> Any:
|
| 186 |
+
if isinstance(value, np.ndarray):
|
| 187 |
+
if value.dtype.kind in {"U", "S", "O"}:
|
| 188 |
+
return value
|
| 189 |
+
torch = importlib.import_module("torch")
|
| 190 |
+
return torch.from_numpy(value)
|
| 191 |
+
if isinstance(value, dict):
|
| 192 |
+
return {key: _numpy_to_torch(item) for key, item in value.items()}
|
| 193 |
+
if isinstance(value, list):
|
| 194 |
+
return [_numpy_to_torch(item) for item in value]
|
| 195 |
+
if isinstance(value, tuple):
|
| 196 |
+
return tuple(_numpy_to_torch(item) for item in value)
|
| 197 |
+
return value
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
class TargetAwareGWAMTrainingDataset:
|
| 201 |
+
"""Map-style 702,094-window direct training view over immutable HF files."""
|
| 202 |
+
|
| 203 |
+
def __init__(
|
| 204 |
+
self,
|
| 205 |
+
root: str | Path,
|
| 206 |
+
*,
|
| 207 |
+
history_length: int = 8,
|
| 208 |
+
horizon: int = 8,
|
| 209 |
+
stride: int = 1,
|
| 210 |
+
as_torch: bool = False,
|
| 211 |
+
strict: bool = True,
|
| 212 |
+
verify_zip_on_first_open: bool = True,
|
| 213 |
+
validate_all_target_receipts: bool = False,
|
| 214 |
+
max_open_episodes: int = 2,
|
| 215 |
+
rgb_root: str | Path | None = None,
|
| 216 |
+
rgb_mode: Literal["none", "history", "history_future"] = "none",
|
| 217 |
+
) -> None:
|
| 218 |
+
self.root = Path(root).expanduser().resolve()
|
| 219 |
+
self.prefix_root = self.root / PREFIX
|
| 220 |
+
if not self.prefix_root.is_dir():
|
| 221 |
+
raise GWAMTrainingViewError(f"training prefix is missing: {self.prefix_root}")
|
| 222 |
+
if history_length != 8 or horizon != 8:
|
| 223 |
+
raise GWAMTrainingViewError("v1 direct view is frozen to history=8, horizon=8")
|
| 224 |
+
if type(stride) is not int or stride <= 0:
|
| 225 |
+
raise GWAMTrainingViewError("stride must be a positive integer")
|
| 226 |
+
if type(max_open_episodes) is not int or max_open_episodes <= 0:
|
| 227 |
+
raise GWAMTrainingViewError("max_open_episodes must be positive")
|
| 228 |
+
if rgb_mode not in {"none", "history", "history_future"}:
|
| 229 |
+
raise GWAMTrainingViewError("rgb_mode is invalid")
|
| 230 |
+
if rgb_mode != "none" and rgb_root is None:
|
| 231 |
+
raise GWAMTrainingViewError(
|
| 232 |
+
"RGB is not in graph ZIPs; rgb_root is required for rgb_mode != none"
|
| 233 |
+
)
|
| 234 |
+
self.history_length = history_length
|
| 235 |
+
self.horizon = horizon
|
| 236 |
+
self.stride = stride
|
| 237 |
+
self.as_torch = bool(as_torch)
|
| 238 |
+
self.strict = bool(strict)
|
| 239 |
+
self.verify_zip_on_first_open = bool(verify_zip_on_first_open)
|
| 240 |
+
self.max_open_episodes = max_open_episodes
|
| 241 |
+
self.rgb_root = None if rgb_root is None else Path(rgb_root).expanduser().resolve()
|
| 242 |
+
self.rgb_mode = rgb_mode
|
| 243 |
+
|
| 244 |
+
base = _load_module(
|
| 245 |
+
"gwam_training_base_window",
|
| 246 |
+
self.root / "loaders/gwam_full_graph_window.py",
|
| 247 |
+
)
|
| 248 |
+
sidecar_module = _load_module(
|
| 249 |
+
"gwam_training_target_sidecar",
|
| 250 |
+
self.root / TARGET_PREFIX / "loader/graphpacket_slim_v2_sidecar.py",
|
| 251 |
+
)
|
| 252 |
+
self._episode_class = base.GWAMFullGraphEpisode
|
| 253 |
+
self._base_collate = base.collate_full_graph_windows
|
| 254 |
+
self._sidecar = sidecar_module.GraphPacketSlimV2SidecarDataset(
|
| 255 |
+
self.root / TARGET_PREFIX
|
| 256 |
+
)
|
| 257 |
+
if validate_all_target_receipts:
|
| 258 |
+
count = self._sidecar.validate_all()
|
| 259 |
+
if count != 2699:
|
| 260 |
+
raise GWAMTrainingViewError("target receipt census did not validate to 2699")
|
| 261 |
+
|
| 262 |
+
index_path = self.prefix_root / "TRAINING_EPISODES.jsonl"
|
| 263 |
+
index_payload = index_path.read_bytes()
|
| 264 |
+
try:
|
| 265 |
+
summary = json.loads((self.prefix_root / "DATASET_SUMMARY.json").read_text())
|
| 266 |
+
except (OSError, json.JSONDecodeError) as error:
|
| 267 |
+
raise GWAMTrainingViewError("training summary is missing or invalid") from error
|
| 268 |
+
if (
|
| 269 |
+
summary.get("index_sha256") != hashlib.sha256(index_payload).hexdigest()
|
| 270 |
+
or summary.get("episode_count") != 2699
|
| 271 |
+
or summary.get("window_count_L8_H8_stride1") != 702094
|
| 272 |
+
or summary.get("model_split") != "train"
|
| 273 |
+
or summary.get("rgb_in_graph_zip") is not False
|
| 274 |
+
):
|
| 275 |
+
raise GWAMTrainingViewError("training index/summary authority binding differs")
|
| 276 |
+
rows: list[dict[str, Any]] = []
|
| 277 |
+
for line_number, line in enumerate(index_payload.decode("utf-8").splitlines(), 1):
|
| 278 |
+
if not line:
|
| 279 |
+
continue
|
| 280 |
+
try:
|
| 281 |
+
row = json.loads(line)
|
| 282 |
+
except json.JSONDecodeError as error:
|
| 283 |
+
raise GWAMTrainingViewError(
|
| 284 |
+
f"training index line {line_number} is invalid JSON"
|
| 285 |
+
) from error
|
| 286 |
+
if row.get("schema") != "gwam.active13.gwam_training_episode.v1":
|
| 287 |
+
raise GWAMTrainingViewError("training index schema differs")
|
| 288 |
+
if row.get("resolution_status") != "RESOLVED":
|
| 289 |
+
raise GWAMTrainingViewError("training view contains unresolved targets")
|
| 290 |
+
if row.get("model_split") != "train" or row.get("rgb_in_graph_zip") is not False:
|
| 291 |
+
raise GWAMTrainingViewError("training split/RGB status differs")
|
| 292 |
+
if row.get("history_length") != 8 or row.get("horizon") != 8:
|
| 293 |
+
raise GWAMTrainingViewError("training index temporal contract differs")
|
| 294 |
+
episode_key = row.get("episode_key")
|
| 295 |
+
sidecar_row = self._sidecar.index.get(episode_key)
|
| 296 |
+
expected_receipt_path = None
|
| 297 |
+
if sidecar_row is not None:
|
| 298 |
+
expected_receipt_path = f"{TARGET_PREFIX}/{sidecar_row['receipt_relative_path']}"
|
| 299 |
+
if (
|
| 300 |
+
sidecar_row is None
|
| 301 |
+
or sidecar_row.get("task") != row.get("task")
|
| 302 |
+
or sidecar_row.get("source_group_id") != row.get("source_group_id")
|
| 303 |
+
or sidecar_row.get("receipt_sha256") != row.get("target_receipt_sha256")
|
| 304 |
+
or sidecar_row.get("target_cardinality") != row.get("target_cardinality")
|
| 305 |
+
or expected_receipt_path != row.get("target_receipt_path")
|
| 306 |
+
):
|
| 307 |
+
raise GWAMTrainingViewError("training index differs from target sidecar index")
|
| 308 |
+
rows.append(row)
|
| 309 |
+
if len(rows) != 2699 or len({row["episode_key"] for row in rows}) != 2699:
|
| 310 |
+
raise GWAMTrainingViewError("training index must contain 2699 unique episodes")
|
| 311 |
+
if len({row["canonical_zip_path"] for row in rows}) != 2699:
|
| 312 |
+
raise GWAMTrainingViewError("training index canonical ZIP paths are not unique")
|
| 313 |
+
self.rows = rows
|
| 314 |
+
|
| 315 |
+
self._window_counts = [
|
| 316 |
+
(int(row["valid_start_count"]) + stride - 1) // stride for row in rows
|
| 317 |
+
]
|
| 318 |
+
self._cumulative: list[int] = []
|
| 319 |
+
total = 0
|
| 320 |
+
for count in self._window_counts:
|
| 321 |
+
if count <= 0:
|
| 322 |
+
raise GWAMTrainingViewError("training episode has no legal windows")
|
| 323 |
+
total += count
|
| 324 |
+
self._cumulative.append(total)
|
| 325 |
+
self._length = total
|
| 326 |
+
self._handles: OrderedDict[int, Any] = OrderedDict()
|
| 327 |
+
self._verified_zips: set[int] = set()
|
| 328 |
+
self._frame_maps: dict[int, dict[int, int]] = {}
|
| 329 |
+
self._video_paths: dict[tuple[int, str], Path] = {}
|
| 330 |
+
|
| 331 |
+
def __len__(self) -> int:
|
| 332 |
+
return self._length
|
| 333 |
+
|
| 334 |
+
def _locate(self, index: int) -> tuple[int, int]:
|
| 335 |
+
if index < 0:
|
| 336 |
+
index += self._length
|
| 337 |
+
if not 0 <= index < self._length:
|
| 338 |
+
raise IndexError(index)
|
| 339 |
+
episode_index = bisect.bisect_right(self._cumulative, index)
|
| 340 |
+
prior = 0 if episode_index == 0 else self._cumulative[episode_index - 1]
|
| 341 |
+
start_t = (index - prior) * self.stride
|
| 342 |
+
return episode_index, start_t
|
| 343 |
+
|
| 344 |
+
def _open(self, episode_index: int) -> Any:
|
| 345 |
+
if episode_index in self._handles:
|
| 346 |
+
handle = self._handles.pop(episode_index)
|
| 347 |
+
self._handles[episode_index] = handle
|
| 348 |
+
return handle
|
| 349 |
+
row = self.rows[episode_index]
|
| 350 |
+
zip_path = (self.root / row["canonical_zip_path"]).resolve()
|
| 351 |
+
if self.root not in zip_path.parents or zip_path.is_symlink() or not zip_path.is_file():
|
| 352 |
+
raise GWAMTrainingViewError(f"canonical ZIP is missing/unsafe: {zip_path}")
|
| 353 |
+
if self.verify_zip_on_first_open and episode_index not in self._verified_zips:
|
| 354 |
+
if zip_path.stat().st_size != row["canonical_zip_size"]:
|
| 355 |
+
raise GWAMTrainingViewError("canonical ZIP size differs from index")
|
| 356 |
+
if _sha256(zip_path) != row["canonical_zip_sha256"]:
|
| 357 |
+
raise GWAMTrainingViewError("canonical ZIP hash differs from index")
|
| 358 |
+
self._verified_zips.add(episode_index)
|
| 359 |
+
patch_root = self.root / "gwam_v12_sparse_v2_type_clip32_patch_20260725"
|
| 360 |
+
handle = self._episode_class(
|
| 361 |
+
zip_path=zip_path,
|
| 362 |
+
type_clip32_patch_root=patch_root,
|
| 363 |
+
strict=self.strict,
|
| 364 |
+
)
|
| 365 |
+
self._handles[episode_index] = handle
|
| 366 |
+
while len(self._handles) > self.max_open_episodes:
|
| 367 |
+
_, old = self._handles.popitem(last=False)
|
| 368 |
+
old.close()
|
| 369 |
+
return handle
|
| 370 |
+
|
| 371 |
+
def _source_frames(self, episode_index: int, handle: Any) -> dict[int, int]:
|
| 372 |
+
if episode_index in self._frame_maps:
|
| 373 |
+
return self._frame_maps[episode_index]
|
| 374 |
+
path = Path(handle.episode_dir) / "graph/frames.jsonl"
|
| 375 |
+
result: dict[int, int] = {}
|
| 376 |
+
for line in path.read_text(encoding="utf-8").splitlines():
|
| 377 |
+
if not line:
|
| 378 |
+
continue
|
| 379 |
+
row = json.loads(line)
|
| 380 |
+
t, source = row.get("t"), row.get("source_frame")
|
| 381 |
+
if type(t) is not int or type(source) is not int or t in result:
|
| 382 |
+
raise GWAMTrainingViewError("frames.jsonl source-frame mapping is invalid")
|
| 383 |
+
result[t] = source
|
| 384 |
+
self._frame_maps[episode_index] = result
|
| 385 |
+
return result
|
| 386 |
+
|
| 387 |
+
def _resolve_video(self, episode_index: int, camera: str) -> Path:
|
| 388 |
+
key = (episode_index, camera)
|
| 389 |
+
if key in self._video_paths:
|
| 390 |
+
return self._video_paths[key]
|
| 391 |
+
assert self.rgb_root is not None
|
| 392 |
+
row = self.rows[episode_index]
|
| 393 |
+
pattern = (
|
| 394 |
+
f"{row['source_tier']}/**/{row['task']}/**/lerobot/videos/chunk-*/"
|
| 395 |
+
f"observation.images.{camera}/{row['episode_id']}.mp4"
|
| 396 |
+
)
|
| 397 |
+
matches = sorted(self.rgb_root.glob(pattern))
|
| 398 |
+
if len(matches) != 1:
|
| 399 |
+
raise GWAMTrainingViewError(
|
| 400 |
+
f"expected one source RGB video for {row['episode_key']} {camera}, got {len(matches)}"
|
| 401 |
+
)
|
| 402 |
+
path = matches[0].resolve()
|
| 403 |
+
if self.rgb_root not in path.parents or path.is_symlink():
|
| 404 |
+
raise GWAMTrainingViewError("source RGB path is unsafe")
|
| 405 |
+
self._video_paths[key] = path
|
| 406 |
+
return path
|
| 407 |
+
|
| 408 |
+
def _decode_rgb(self, episode_index: int, source_frames: Sequence[int]) -> np.ndarray:
|
| 409 |
+
try:
|
| 410 |
+
cv2 = importlib.import_module("cv2")
|
| 411 |
+
except ImportError as error:
|
| 412 |
+
raise GWAMTrainingViewError("opencv-python is required to decode source RGB") from error
|
| 413 |
+
views: list[np.ndarray] = []
|
| 414 |
+
for camera in CAMERAS:
|
| 415 |
+
path = self._resolve_video(episode_index, camera)
|
| 416 |
+
capture = cv2.VideoCapture(str(path))
|
| 417 |
+
if not capture.isOpened():
|
| 418 |
+
raise GWAMTrainingViewError(f"cannot open source RGB video: {path}")
|
| 419 |
+
frames: list[np.ndarray] = []
|
| 420 |
+
try:
|
| 421 |
+
for frame_index in source_frames:
|
| 422 |
+
capture.set(cv2.CAP_PROP_POS_FRAMES, int(frame_index))
|
| 423 |
+
ok, bgr = capture.read()
|
| 424 |
+
if not ok or bgr is None:
|
| 425 |
+
raise GWAMTrainingViewError(
|
| 426 |
+
f"cannot decode source frame {frame_index} from {path}"
|
| 427 |
+
)
|
| 428 |
+
rgb = np.ascontiguousarray(bgr[..., ::-1])
|
| 429 |
+
if rgb.shape != (256, 256, 3) or rgb.dtype != np.uint8:
|
| 430 |
+
raise GWAMTrainingViewError("source RGB must be uint8[256,256,3]")
|
| 431 |
+
frames.append(rgb)
|
| 432 |
+
finally:
|
| 433 |
+
capture.release()
|
| 434 |
+
views.append(np.stack(frames, axis=0))
|
| 435 |
+
return np.ascontiguousarray(np.stack(views, axis=1)) # [T,3,256,256,3]
|
| 436 |
+
|
| 437 |
+
def __getitem__(self, index: int) -> dict[str, Any]:
|
| 438 |
+
episode_index, start_t = self._locate(index)
|
| 439 |
+
row = self.rows[episode_index]
|
| 440 |
+
handle = self._open(episode_index)
|
| 441 |
+
sample = handle.load_window(
|
| 442 |
+
start_t=start_t,
|
| 443 |
+
history_length=8,
|
| 444 |
+
horizon=8,
|
| 445 |
+
mask_size=16,
|
| 446 |
+
as_torch=False,
|
| 447 |
+
)
|
| 448 |
+
source_metadata = sample["metadata"]
|
| 449 |
+
expected_episode = f"episode_{int(source_metadata.get('episode', -1)):06d}"
|
| 450 |
+
if (
|
| 451 |
+
source_metadata.get("task") != row["task"]
|
| 452 |
+
or source_metadata.get("split") != row["source_tier"]
|
| 453 |
+
or expected_episode != row["episode_id"]
|
| 454 |
+
or int(source_metadata.get("T", -1)) != int(row["frames_processed"])
|
| 455 |
+
):
|
| 456 |
+
raise GWAMTrainingViewError("canonical ZIP internal identity differs from training index")
|
| 457 |
+
receipt = self._sidecar.get_resolution_receipt(row["episode_key"])
|
| 458 |
+
if (
|
| 459 |
+
receipt.get("task") != row["task"]
|
| 460 |
+
or receipt.get("source_group_id") != row["source_group_id"]
|
| 461 |
+
or receipt.get("target_cardinality") != row["target_cardinality"]
|
| 462 |
+
):
|
| 463 |
+
raise GWAMTrainingViewError("target receipt differs from training index")
|
| 464 |
+
slots = np.asarray(sample["metadata"]["slot_ids"], dtype=np.int64)
|
| 465 |
+
anchor_valid = np.asarray(sample["history"]["node_valid"][-1], dtype=np.bool_)
|
| 466 |
+
resolver_valid = _decode_256_lsb_first(receipt["resolver_valid_bitset_hex"])[slots]
|
| 467 |
+
target_bits = _decode_256_lsb_first(receipt["target_bitset_hex"])[slots]
|
| 468 |
+
target_valid = np.logical_and(resolver_valid, anchor_valid)
|
| 469 |
+
is_target = np.logical_and(target_bits, target_valid)
|
| 470 |
+
if np.any(np.logical_and(is_target, np.logical_not(target_valid))):
|
| 471 |
+
raise GWAMTrainingViewError("is_task_target exceeds task_target_valid")
|
| 472 |
+
fused, visual_valid = _fuse_rich_history(sample, is_target, target_valid)
|
| 473 |
+
sample["history"]["gwam_node_features"] = fused
|
| 474 |
+
sample["history"]["gwam_visual_feature_valid"] = visual_valid
|
| 475 |
+
sample["history"]["is_task_target"] = is_target
|
| 476 |
+
sample["history"]["task_target_valid"] = target_valid
|
| 477 |
+
|
| 478 |
+
frame_map = self._source_frames(episode_index, handle)
|
| 479 |
+
history_frames = [int(x) for x in sample["metadata"]["history_frames"]]
|
| 480 |
+
future_frames = [int(x) for x in sample["metadata"]["future_frames"]]
|
| 481 |
+
selected = history_frames if self.rgb_mode == "history" else history_frames + future_frames
|
| 482 |
+
source_selected = [frame_map[t] for t in selected]
|
| 483 |
+
rgb: dict[str, Any] = {
|
| 484 |
+
"included": self.rgb_mode != "none",
|
| 485 |
+
"stored_in_graph_zip": False,
|
| 486 |
+
"cameras": CAMERAS,
|
| 487 |
+
"mode": self.rgb_mode,
|
| 488 |
+
"graph_frame_indices": np.asarray(selected, dtype=np.int64),
|
| 489 |
+
"source_frame_indices": np.asarray(source_selected, dtype=np.int64),
|
| 490 |
+
}
|
| 491 |
+
if self.rgb_mode != "none":
|
| 492 |
+
rgb["frames"] = self._decode_rgb(episode_index, source_selected)
|
| 493 |
+
sample["rgb"] = rgb
|
| 494 |
+
sample["metadata"].update(
|
| 495 |
+
{
|
| 496 |
+
"training_view_schema": "gwam.active13.direct_training_sample.v1",
|
| 497 |
+
"training_index": int(index),
|
| 498 |
+
"training_episode_index": int(episode_index),
|
| 499 |
+
"episode_key": row["episode_key"],
|
| 500 |
+
"task": row["task"],
|
| 501 |
+
"source_tier": row["source_tier"],
|
| 502 |
+
"source_group_id": row["source_group_id"],
|
| 503 |
+
"target_receipt_sha256": row["target_receipt_sha256"],
|
| 504 |
+
"gwam_node_feature_dim": 344,
|
| 505 |
+
"gwam_feature_schema": FEATURE_SCHEMA,
|
| 506 |
+
"rgb_in_graph_zip": False,
|
| 507 |
+
}
|
| 508 |
+
)
|
| 509 |
+
return _numpy_to_torch(sample) if self.as_torch else sample
|
| 510 |
+
|
| 511 |
+
def collate(self, samples: list[dict[str, Any]], *, as_torch: bool | None = None) -> dict[str, Any]:
|
| 512 |
+
if not samples:
|
| 513 |
+
raise GWAMTrainingViewError("cannot collate an empty batch")
|
| 514 |
+
use_torch = self.as_torch if as_torch is None else bool(as_torch)
|
| 515 |
+
numpy_samples = samples
|
| 516 |
+
if any(not isinstance(s["history"]["gwam_node_features"], np.ndarray) for s in samples):
|
| 517 |
+
raise GWAMTrainingViewError("collate expects NumPy samples; construct dataset with as_torch=False")
|
| 518 |
+
batch = self._base_collate(numpy_samples, as_torch=False)
|
| 519 |
+
batch_size = len(samples)
|
| 520 |
+
length = samples[0]["history"]["gwam_node_features"].shape[0]
|
| 521 |
+
max_nodes = max(s["history"]["gwam_node_features"].shape[1] for s in samples)
|
| 522 |
+
fused = np.zeros((batch_size, length, max_nodes, 344), dtype=np.float32)
|
| 523 |
+
visual_valid = np.zeros((batch_size, length, max_nodes), dtype=np.bool_)
|
| 524 |
+
target = np.zeros((batch_size, max_nodes), dtype=np.bool_)
|
| 525 |
+
target_valid = np.zeros((batch_size, max_nodes), dtype=np.bool_)
|
| 526 |
+
for b, sample in enumerate(samples):
|
| 527 |
+
n = sample["history"]["gwam_node_features"].shape[1]
|
| 528 |
+
fused[b, :, :n] = sample["history"]["gwam_node_features"]
|
| 529 |
+
visual_valid[b, :, :n] = sample["history"]["gwam_visual_feature_valid"]
|
| 530 |
+
target[b, :n] = sample["history"]["is_task_target"]
|
| 531 |
+
target_valid[b, :n] = sample["history"]["task_target_valid"]
|
| 532 |
+
batch["history"]["gwam_node_features"] = fused
|
| 533 |
+
batch["history"]["gwam_visual_feature_valid"] = visual_valid
|
| 534 |
+
batch["history"]["is_task_target"] = target
|
| 535 |
+
batch["history"]["task_target_valid"] = target_valid
|
| 536 |
+
if all(bool(s["rgb"]["included"]) for s in samples):
|
| 537 |
+
batch["rgb"] = {
|
| 538 |
+
"included": True,
|
| 539 |
+
"stored_in_graph_zip": False,
|
| 540 |
+
"cameras": CAMERAS,
|
| 541 |
+
"mode": samples[0]["rgb"]["mode"],
|
| 542 |
+
"frames": np.stack([s["rgb"]["frames"] for s in samples], axis=0),
|
| 543 |
+
"graph_frame_indices": np.stack(
|
| 544 |
+
[s["rgb"]["graph_frame_indices"] for s in samples], axis=0
|
| 545 |
+
),
|
| 546 |
+
"source_frame_indices": np.stack(
|
| 547 |
+
[s["rgb"]["source_frame_indices"] for s in samples], axis=0
|
| 548 |
+
),
|
| 549 |
+
}
|
| 550 |
+
else:
|
| 551 |
+
batch["rgb"] = {
|
| 552 |
+
"included": False,
|
| 553 |
+
"stored_in_graph_zip": False,
|
| 554 |
+
"cameras": CAMERAS,
|
| 555 |
+
"mode": "none",
|
| 556 |
+
}
|
| 557 |
+
batch["gwam_feature_schema"] = FEATURE_SCHEMA
|
| 558 |
+
return _numpy_to_torch(batch) if use_torch else batch
|
| 559 |
+
|
| 560 |
+
def collate_torch(self, samples: list[dict[str, Any]]) -> dict[str, Any]:
|
| 561 |
+
"""Picklable DataLoader collator that always returns torch tensors."""
|
| 562 |
+
return self.collate(samples, as_torch=True)
|
| 563 |
+
|
| 564 |
+
def close(self) -> None:
|
| 565 |
+
while self._handles:
|
| 566 |
+
_, handle = self._handles.popitem(last=False)
|
| 567 |
+
handle.close()
|
| 568 |
+
self._frame_maps.clear()
|
| 569 |
+
|
| 570 |
+
def __enter__(self) -> "TargetAwareGWAMTrainingDataset":
|
| 571 |
+
return self
|
| 572 |
+
|
| 573 |
+
def __exit__(self, *_: object) -> None:
|
| 574 |
+
self.close()
|
| 575 |
+
|
| 576 |
+
def __getstate__(self) -> dict[str, Any]:
|
| 577 |
+
state = dict(self.__dict__)
|
| 578 |
+
# Do not close the parent's live handles while preparing worker state.
|
| 579 |
+
# Workers reopen their own bounded cache through __setstate__.
|
| 580 |
+
state["_handles"] = OrderedDict()
|
| 581 |
+
state["_frame_maps"] = {}
|
| 582 |
+
state["_video_paths"] = {}
|
| 583 |
+
state.pop("_episode_class", None)
|
| 584 |
+
state.pop("_base_collate", None)
|
| 585 |
+
state.pop("_sidecar", None)
|
| 586 |
+
return state
|
| 587 |
+
|
| 588 |
+
def __setstate__(self, state: dict[str, Any]) -> None:
|
| 589 |
+
self.__dict__.update(state)
|
| 590 |
+
base = _load_module(
|
| 591 |
+
"gwam_training_base_window",
|
| 592 |
+
self.root / "loaders/gwam_full_graph_window.py",
|
| 593 |
+
)
|
| 594 |
+
sidecar_module = _load_module(
|
| 595 |
+
"gwam_training_target_sidecar",
|
| 596 |
+
self.root / TARGET_PREFIX / "loader/graphpacket_slim_v2_sidecar.py",
|
| 597 |
+
)
|
| 598 |
+
self._episode_class = base.GWAMFullGraphEpisode
|
| 599 |
+
self._base_collate = base.collate_full_graph_windows
|
| 600 |
+
self._sidecar = sidecar_module.GraphPacketSlimV2SidecarDataset(
|
| 601 |
+
self.root / TARGET_PREFIX
|
| 602 |
+
)
|
| 603 |
+
|
| 604 |
+
|
| 605 |
+
def main() -> int:
|
| 606 |
+
parser = argparse.ArgumentParser()
|
| 607 |
+
parser.add_argument("--root", type=Path, required=True, help="Downloaded GWAM_Data root")
|
| 608 |
+
parser.add_argument("--index", type=int, default=0)
|
| 609 |
+
parser.add_argument("--skip-zip-hash", action="store_true")
|
| 610 |
+
args = parser.parse_args()
|
| 611 |
+
with TargetAwareGWAMTrainingDataset(
|
| 612 |
+
args.root,
|
| 613 |
+
verify_zip_on_first_open=not args.skip_zip_hash,
|
| 614 |
+
validate_all_target_receipts=False,
|
| 615 |
+
) as dataset:
|
| 616 |
+
sample = dataset[args.index]
|
| 617 |
+
summary = {
|
| 618 |
+
"dataset_windows": len(dataset),
|
| 619 |
+
"episode_key": sample["metadata"]["episode_key"],
|
| 620 |
+
"history_gwam_node_features": list(
|
| 621 |
+
sample["history"]["gwam_node_features"].shape
|
| 622 |
+
),
|
| 623 |
+
"history_view_evidence": list(sample["history"]["view_evidence"].shape),
|
| 624 |
+
"history_sam2_visual": list(sample["history"]["sam2_visual"].shape),
|
| 625 |
+
"future_action": list(sample["future_action"].shape),
|
| 626 |
+
"target_count": int(sample["history"]["is_task_target"].sum()),
|
| 627 |
+
"rgb_included": bool(sample["rgb"]["included"]),
|
| 628 |
+
"rgb_stored_in_graph_zip": False,
|
| 629 |
+
}
|
| 630 |
+
print(json.dumps(summary, indent=2))
|
| 631 |
+
return 0
|
| 632 |
+
|
| 633 |
+
|
| 634 |
+
if __name__ == "__main__":
|
| 635 |
+
raise SystemExit(main())
|
gwam_active13_gwam_training_v1_20260731/manifests/PUBLICATION_MANIFEST.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifact_type": "GWAMActive13DirectTrainingPublicationManifest",
|
| 3 |
+
"base_revision": "dd57b9c35ca819a17d666ec07099215dd16facf3",
|
| 4 |
+
"file_count": 13,
|
| 5 |
+
"files": [
|
| 6 |
+
{
|
| 7 |
+
"path": "README.md",
|
| 8 |
+
"sha256": "1ae8e2dff547912e5d27e944b5be1047ce2b10dfe5fbb820eeae795721c6a4c8",
|
| 9 |
+
"size": 28332
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"path": "SCHEMA.md",
|
| 13 |
+
"sha256": "06f6dd17112e29db01b44b14f43828465c860340819380330cef91fcd1befec3",
|
| 14 |
+
"size": 19219
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "gwam_active13_gwam_training_v1_20260731/DATASET_SUMMARY.json",
|
| 18 |
+
"sha256": "9e18f43cbd83cf32e7354e3a992d83dd829f2d8cc0bf57a2353ec84e11bc26a4",
|
| 19 |
+
"size": 1584
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"path": "gwam_active13_gwam_training_v1_20260731/README.md",
|
| 23 |
+
"sha256": "1dc8ddca6d6c5af9552e82bc17e014bef3f78cf97b60425f85ab51ecd39a3ba2",
|
| 24 |
+
"size": 11822
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"path": "gwam_active13_gwam_training_v1_20260731/RGB_AND_REALTIME.md",
|
| 28 |
+
"sha256": "8717362efe0979ce4dd44581f96ee0a2c2cfb44e9b025c3201b2507016eb4df7",
|
| 29 |
+
"size": 6132
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"path": "gwam_active13_gwam_training_v1_20260731/SCHEMA.md",
|
| 33 |
+
"sha256": "1d99fad9c4755fc100cf225c9d4ec92338d986f4b59368fa229e0d859e22d4a8",
|
| 34 |
+
"size": 5990
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"path": "gwam_active13_gwam_training_v1_20260731/TRAINING_EPISODES.jsonl",
|
| 38 |
+
"sha256": "757b3320ba991a2ece0c0a2a431cfde84db24e6837871855072b28663d89859e",
|
| 39 |
+
"size": 3168112
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"path": "gwam_active13_gwam_training_v1_20260731/download_training_data.py",
|
| 43 |
+
"sha256": "bfc04a9fc00d4500f662e77b71629ec60b4bcb62456e817f7d554fab18ec8e08",
|
| 44 |
+
"size": 3059
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"path": "gwam_active13_gwam_training_v1_20260731/examples/VALIDATED_OUTPUT.json",
|
| 48 |
+
"sha256": "023da5260b7ed665c00b8075348aa67f3a3e2cfda98b9bf74ec2fc062b6ff4e6",
|
| 49 |
+
"size": 2110
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "gwam_active13_gwam_training_v1_20260731/examples/current_frame_target_aware_eval.py",
|
| 53 |
+
"sha256": "a5d4a758d574694668cf439c204f6421ab6ba361057090672b45c2317fc2c8a2",
|
| 54 |
+
"size": 5236
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"path": "gwam_active13_gwam_training_v1_20260731/loader/target_aware_gwam_training_dataset.py",
|
| 58 |
+
"sha256": "4ec45b4fc38b71a2194289ec4d572e521815b2bc19ffc761574b64b9e076fcda",
|
| 59 |
+
"size": 29665
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"path": "gwam_active13_gwam_training_v1_20260731/tests/test_direct_training_view.py",
|
| 63 |
+
"sha256": "8d6427e4da3f9c21c95643b6aecae2fcd970eddbffb94c9f6b8a154c92f67d16",
|
| 64 |
+
"size": 9071
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"path": "scripts/setup_realtime_final_graph_env.sh",
|
| 68 |
+
"sha256": "cc0043d93bd2500218b2a962865c890468c110bef7f66e763fb8aa475c683509",
|
| 69 |
+
"size": 5171
|
| 70 |
+
}
|
| 71 |
+
]
|
| 72 |
+
}
|
gwam_active13_gwam_training_v1_20260731/receipts/PREPUBLICATION_VALIDATION_RECEIPT.json
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifact_type": "GWAMActive13DirectTrainingPrepublicationReceipt",
|
| 3 |
+
"base_revision": "dd57b9c35ca819a17d666ec07099215dd16facf3",
|
| 4 |
+
"boundaries": [
|
| 5 |
+
"canonical graph ZIPs do not contain original RGB/video bytes",
|
| 6 |
+
"separate source RoboCasa/LeRobot RGB required for pixel/video training",
|
| 7 |
+
"target sidecar is outer-train only",
|
| 8 |
+
"future graph/RGB never used to select input topology or targets",
|
| 9 |
+
"live target fields are caller-asserted and require external reset/task receipt binding"
|
| 10 |
+
],
|
| 11 |
+
"created_at": "2026-07-31T12:13:57-05:00",
|
| 12 |
+
"dataset": {
|
| 13 |
+
"episode_count": 2699,
|
| 14 |
+
"rgb_in_graph_zip": false,
|
| 15 |
+
"window_count": 702094
|
| 16 |
+
},
|
| 17 |
+
"index": {
|
| 18 |
+
"canonical_zip_bytes": 20339307035,
|
| 19 |
+
"episodes": 2699,
|
| 20 |
+
"model_split": "train",
|
| 21 |
+
"sha256": "757b3320ba991a2ece0c0a2a431cfde84db24e6837871855072b28663d89859e",
|
| 22 |
+
"windows_L8_H8_stride1": 702094
|
| 23 |
+
},
|
| 24 |
+
"planned_tag": "gwam-target-v2.0.1-training-v1",
|
| 25 |
+
"publication_manifest_sha256": "9ad4db2dae2ba8a04d01577574a7aacab7d0fa468a92670dcb296111600cf62d",
|
| 26 |
+
"setup_validation": {
|
| 27 |
+
"cuda": "13.0",
|
| 28 |
+
"cuda_smoke": 8.0,
|
| 29 |
+
"fresh_live_asset_boundary": "RoboCasa kitchen assets are separate and not redistributed",
|
| 30 |
+
"robocasa_commit": "b4684e6ee37d377cc392e98302a6b916d588b415",
|
| 31 |
+
"robosuite_commit": "5ce6643f3092639d08f7b0f90ed1c6a84f50552c",
|
| 32 |
+
"sam2_commit": "2b90b9f5ceec907a1c18123530e92e794ad901a4",
|
| 33 |
+
"script_exit_code": 0,
|
| 34 |
+
"torch": "2.13.0+cu130"
|
| 35 |
+
},
|
| 36 |
+
"status": "READY_TO_PUBLISH",
|
| 37 |
+
"training_index_sha256": "757b3320ba991a2ece0c0a2a431cfde84db24e6837871855072b28663d89859e",
|
| 38 |
+
"validated_examples": {
|
| 39 |
+
"live_sam2_full_graph": {
|
| 40 |
+
"edge_index": [
|
| 41 |
+
2,
|
| 42 |
+
106
|
| 43 |
+
],
|
| 44 |
+
"invalid_visible_pairs": 0,
|
| 45 |
+
"sam2_feature_rows": 52,
|
| 46 |
+
"task": "OpenDrawer",
|
| 47 |
+
"x": [
|
| 48 |
+
146,
|
| 49 |
+
342
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
"live_target_aware": {
|
| 53 |
+
"target_node_ids": [
|
| 54 |
+
"obj"
|
| 55 |
+
],
|
| 56 |
+
"target_provenance_status": "CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED",
|
| 57 |
+
"target_storage_slots": [
|
| 58 |
+
1
|
| 59 |
+
],
|
| 60 |
+
"task": "PickPlaceCabinetToCounter",
|
| 61 |
+
"x_target_aware": [
|
| 62 |
+
125,
|
| 63 |
+
344
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
"multiprocessing_spawn_batch": {
|
| 67 |
+
"future_action": [
|
| 68 |
+
2,
|
| 69 |
+
8,
|
| 70 |
+
12
|
| 71 |
+
],
|
| 72 |
+
"gwam_node_features": [
|
| 73 |
+
2,
|
| 74 |
+
8,
|
| 75 |
+
79,
|
| 76 |
+
344
|
| 77 |
+
]
|
| 78 |
+
},
|
| 79 |
+
"offline_graph_only": {
|
| 80 |
+
"episode_key": "pretrain/PickPlaceCabinetToCounter/episode_000000",
|
| 81 |
+
"future_action": [
|
| 82 |
+
8,
|
| 83 |
+
12
|
| 84 |
+
],
|
| 85 |
+
"gwam_node_features": [
|
| 86 |
+
8,
|
| 87 |
+
79,
|
| 88 |
+
344
|
| 89 |
+
],
|
| 90 |
+
"target_count": 1
|
| 91 |
+
},
|
| 92 |
+
"offline_rgb_join": {
|
| 93 |
+
"dtype": "uint8",
|
| 94 |
+
"rgb_frames": [
|
| 95 |
+
16,
|
| 96 |
+
3,
|
| 97 |
+
256,
|
| 98 |
+
256,
|
| 99 |
+
3
|
| 100 |
+
],
|
| 101 |
+
"source_frames": [
|
| 102 |
+
0,
|
| 103 |
+
1,
|
| 104 |
+
2,
|
| 105 |
+
3,
|
| 106 |
+
4,
|
| 107 |
+
5,
|
| 108 |
+
6,
|
| 109 |
+
7,
|
| 110 |
+
8,
|
| 111 |
+
9,
|
| 112 |
+
10,
|
| 113 |
+
11,
|
| 114 |
+
12,
|
| 115 |
+
13,
|
| 116 |
+
14,
|
| 117 |
+
15
|
| 118 |
+
]
|
| 119 |
+
},
|
| 120 |
+
"prior_342_byte_equivalence": {
|
| 121 |
+
"exact_equal": true,
|
| 122 |
+
"max_absolute_difference": 0.0,
|
| 123 |
+
"shape": [
|
| 124 |
+
79,
|
| 125 |
+
342
|
| 126 |
+
]
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
"validation": {
|
| 130 |
+
"canonical_sample_zip_sha256_verified": true,
|
| 131 |
+
"focused_tests": "9 passed",
|
| 132 |
+
"legacy_realtime_and_graph_loader_tests": "16 passed",
|
| 133 |
+
"real_sam2_current_frame": true,
|
| 134 |
+
"real_source_rgb_decode": true,
|
| 135 |
+
"target_receipts_validated": 2699
|
| 136 |
+
}
|
| 137 |
+
}
|
gwam_active13_gwam_training_v1_20260731/tests/test_direct_training_view.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import hashlib
|
| 4 |
+
import importlib.util
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
import pickle
|
| 8 |
+
import sys
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
import numpy as np
|
| 12 |
+
import pytest
|
| 13 |
+
|
| 14 |
+
PREFIX = Path(__file__).resolve().parents[1]
|
| 15 |
+
UPLOAD = PREFIX.parent
|
| 16 |
+
INDEX = PREFIX / "TRAINING_EPISODES.jsonl"
|
| 17 |
+
SUMMARY = PREFIX / "DATASET_SUMMARY.json"
|
| 18 |
+
LOADER = PREFIX / "loader/target_aware_gwam_training_dataset.py"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _module():
|
| 22 |
+
spec = importlib.util.spec_from_file_location("target_aware_training_tested", LOADER)
|
| 23 |
+
assert spec is not None and spec.loader is not None
|
| 24 |
+
module = importlib.util.module_from_spec(spec)
|
| 25 |
+
sys.modules[spec.name] = module
|
| 26 |
+
spec.loader.exec_module(module)
|
| 27 |
+
return module
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_training_index_and_summary_are_exact() -> None:
|
| 31 |
+
payload = INDEX.read_bytes()
|
| 32 |
+
rows = [json.loads(line) for line in payload.decode().splitlines() if line]
|
| 33 |
+
summary = json.loads(SUMMARY.read_text())
|
| 34 |
+
assert len(rows) == 2699
|
| 35 |
+
assert len({row["episode_key"] for row in rows}) == 2699
|
| 36 |
+
assert sum(row["valid_start_count"] for row in rows) == 702094
|
| 37 |
+
assert all(row["resolution_status"] == "RESOLVED" for row in rows)
|
| 38 |
+
assert all(row["model_split"] == "train" for row in rows)
|
| 39 |
+
assert all(row["rgb_in_graph_zip"] is False for row in rows)
|
| 40 |
+
assert all(row["valid_start_count"] == row["frames_processed"] - 15 for row in rows)
|
| 41 |
+
assert summary["episode_count"] == 2699
|
| 42 |
+
assert summary["window_count_L8_H8_stride1"] == 702094
|
| 43 |
+
assert summary["canonical_zip_bytes_referenced"] == 20339307035
|
| 44 |
+
assert summary["index_sha256"] == hashlib.sha256(payload).hexdigest()
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def test_live_target_attachment_produces_344_and_fails_closed() -> None:
|
| 48 |
+
module = _module()
|
| 49 |
+
snapshot = {
|
| 50 |
+
"gnn_graph": {
|
| 51 |
+
"x": np.zeros((3, 342), dtype=np.float32),
|
| 52 |
+
"slot_ids": np.array([0, 2, 7], dtype=np.int64),
|
| 53 |
+
"metadata": {},
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
out = module.attach_known_task_targets_to_realtime_graph(
|
| 57 |
+
snapshot,
|
| 58 |
+
target_storage_slots=[2, 7],
|
| 59 |
+
provenance="RoboCasa reset task specification",
|
| 60 |
+
)
|
| 61 |
+
graph = out["gnn_graph"]
|
| 62 |
+
assert graph["x_target_aware"].shape == (3, 344)
|
| 63 |
+
assert graph["is_task_target"].tolist() == [False, True, True]
|
| 64 |
+
assert graph["task_target_valid"].tolist() == [True, True, True]
|
| 65 |
+
assert np.array_equal(graph["x_target_aware"][:, 342] > 0, graph["is_task_target"])
|
| 66 |
+
assert graph["metadata"]["target_provenance_status"] == "CALLER_ASSERTED_PRE_ACTION_NOT_AUTHENTICATED"
|
| 67 |
+
with pytest.raises(module.GWAMTrainingViewError):
|
| 68 |
+
module.attach_known_task_targets_to_realtime_graph(
|
| 69 |
+
{"gnn_graph": {"x": np.zeros((1, 342)), "slot_ids": np.array([0])}},
|
| 70 |
+
target_storage_slots=[0],
|
| 71 |
+
provenance="future success outcome",
|
| 72 |
+
)
|
| 73 |
+
with pytest.raises(module.GWAMTrainingViewError):
|
| 74 |
+
module.attach_known_task_targets_to_realtime_graph(
|
| 75 |
+
{"gnn_graph": {"x": np.zeros((1, 342)), "slot_ids": np.array([0])}},
|
| 76 |
+
target_storage_slots=[4],
|
| 77 |
+
provenance="reset task specification",
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def test_rgb_requires_separate_source_root() -> None:
|
| 82 |
+
module = _module()
|
| 83 |
+
root = Path(os.environ.get("GWAM_DATA_ROOT", "/nonexistent-gwam-root"))
|
| 84 |
+
if not (root / module.PREFIX).is_dir():
|
| 85 |
+
pytest.skip("full local GWAM root not supplied")
|
| 86 |
+
with pytest.raises(module.GWAMTrainingViewError, match="RGB is not in graph ZIPs"):
|
| 87 |
+
module.TargetAwareGWAMTrainingDataset(root, rgb_mode="history")
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def test_real_training_window_and_torch_collation() -> None:
|
| 91 |
+
module = _module()
|
| 92 |
+
root = Path(os.environ.get("GWAM_DATA_ROOT", "/nonexistent-gwam-root"))
|
| 93 |
+
if not (root / module.PREFIX).is_dir():
|
| 94 |
+
pytest.skip("full local GWAM root not supplied")
|
| 95 |
+
with module.TargetAwareGWAMTrainingDataset(
|
| 96 |
+
root,
|
| 97 |
+
validate_all_target_receipts=True,
|
| 98 |
+
max_open_episodes=1,
|
| 99 |
+
) as dataset:
|
| 100 |
+
assert len(dataset) == 702094
|
| 101 |
+
first = dataset[0]
|
| 102 |
+
second = dataset[1]
|
| 103 |
+
assert first["history"]["gwam_node_features"].shape == (8, 79, 344)
|
| 104 |
+
assert first["history"]["view_evidence"].shape == (8, 79, 3, 8)
|
| 105 |
+
assert first["history"]["sam2_visual"].shape == (8, 79, 3, 256)
|
| 106 |
+
assert first["future_action"].shape == (8, 12)
|
| 107 |
+
assert int(first["history"]["is_task_target"].sum()) == 1
|
| 108 |
+
assert first["rgb"]["included"] is False
|
| 109 |
+
batch = dataset.collate([first, second], as_torch=True)
|
| 110 |
+
assert tuple(batch["history"]["gwam_node_features"].shape) == (2, 8, 79, 344)
|
| 111 |
+
assert tuple(batch["future_action"].shape) == (2, 8, 12)
|
| 112 |
+
assert str(type(batch["history"]["gwam_node_features"])) == "<class 'torch.Tensor'>"
|
| 113 |
+
restored = pickle.loads(pickle.dumps(dataset))
|
| 114 |
+
try:
|
| 115 |
+
assert restored[0]["history"]["gwam_node_features"].shape == (8, 79, 344)
|
| 116 |
+
finally:
|
| 117 |
+
restored.close()
|
| 118 |
+
assert dataset[1]["history"]["gwam_node_features"].shape == (8, 79, 344)
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def test_real_source_rgb_join_when_available() -> None:
|
| 122 |
+
module = _module()
|
| 123 |
+
root = Path(os.environ.get("GWAM_DATA_ROOT", "/nonexistent-gwam-root"))
|
| 124 |
+
rgb_root = Path(os.environ.get("GWAM_RGB_ROOT", "/nonexistent-gwam-rgb-root"))
|
| 125 |
+
if not (root / module.PREFIX).is_dir() or not rgb_root.is_dir():
|
| 126 |
+
pytest.skip("full graph root and source RGB root not supplied")
|
| 127 |
+
with module.TargetAwareGWAMTrainingDataset(
|
| 128 |
+
root,
|
| 129 |
+
rgb_root=rgb_root,
|
| 130 |
+
rgb_mode="history_future",
|
| 131 |
+
max_open_episodes=1,
|
| 132 |
+
) as dataset:
|
| 133 |
+
sample = dataset[0]
|
| 134 |
+
assert sample["rgb"]["frames"].shape == (16, 3, 256, 256, 3)
|
| 135 |
+
assert sample["rgb"]["frames"].dtype == np.uint8
|
| 136 |
+
assert sample["rgb"]["source_frame_indices"].tolist() == list(range(16))
|
| 137 |
+
assert sample["rgb"]["stored_in_graph_zip"] is False
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def test_docs_make_rgb_and_online_boundaries_explicit() -> None:
|
| 141 |
+
readme = (PREFIX / "README.md").read_text()
|
| 142 |
+
schema = (PREFIX / "SCHEMA.md").read_text()
|
| 143 |
+
rgb = (PREFIX / "RGB_AND_REALTIME.md").read_text()
|
| 144 |
+
root_readme = (UPLOAD / "README.md").read_text()
|
| 145 |
+
for phrase in (
|
| 146 |
+
"702,094 legal",
|
| 147 |
+
"do not contain original RGB videos",
|
| 148 |
+
"extract_final_graph()",
|
| 149 |
+
"344 total dimensions",
|
| 150 |
+
"current_frame_target_aware_eval.py",
|
| 151 |
+
):
|
| 152 |
+
assert phrase in readme
|
| 153 |
+
assert "Canonical graph ZIPs do not contain RGB/video bytes" in schema
|
| 154 |
+
assert "extract_current_graph()` is Phase-1/debug only" in schema
|
| 155 |
+
assert "The graph ZIPs do **not** contain original video or RGB images" in rgb
|
| 156 |
+
assert "gwam_active13_gwam_training_v1_20260731" in root_readme
|
| 157 |
+
assert "gwam-target-v2.0.1-training-v1" in root_readme
|
| 158 |
+
validated = json.loads((PREFIX / "examples/VALIDATED_OUTPUT.json").read_text())
|
| 159 |
+
assert validated["offline_graph_only"]["history_gwam_node_features"] == [8, 79, 344]
|
| 160 |
+
assert validated["prior_342_byte_equivalence"]["exact_equal"] is True
|
| 161 |
+
assert validated["prior_342_byte_equivalence"]["max_absolute_difference"] == 0.0
|
| 162 |
+
assert validated["offline_separate_rgb_join"]["rgb_frames"] == [16, 3, 256, 256, 3]
|
| 163 |
+
assert validated["live_target_aware_graph"]["x_target_aware"] == [125, 344]
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def test_python_sources_compile() -> None:
|
| 167 |
+
for path in [
|
| 168 |
+
LOADER,
|
| 169 |
+
PREFIX / "download_training_data.py",
|
| 170 |
+
PREFIX / "examples/current_frame_target_aware_eval.py",
|
| 171 |
+
]:
|
| 172 |
+
compile(path.read_text(encoding="utf-8"), str(path), "exec")
|
| 173 |
+
|
| 174 |
+
def test_realtime_setup_uses_compatible_pinned_sources() -> None:
|
| 175 |
+
setup = (UPLOAD / "scripts/setup_realtime_final_graph_env.sh").read_text()
|
| 176 |
+
assert "python -m pip install numpy opencv-python robosuite==1.5.2" not in setup
|
| 177 |
+
assert "ARISE-Initiative/robosuite.git" in setup
|
| 178 |
+
for digest in (
|
| 179 |
+
"5ce6643f3092639d08f7b0f90ed1c6a84f50552c",
|
| 180 |
+
"b4684e6ee37d377cc392e98302a6b916d588b415",
|
| 181 |
+
"2b90b9f5ceec907a1c18123530e92e794ad901a4",
|
| 182 |
+
"d05afc436d78f1c48dc0dbf8e5980a9d471f35f6",
|
| 183 |
+
):
|
| 184 |
+
assert digest in setup
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def test_publication_manifest_and_receipt_bind_all_nonself_files() -> None:
|
| 188 |
+
manifest_path = PREFIX / "manifests/PUBLICATION_MANIFEST.json"
|
| 189 |
+
receipt_path = PREFIX / "receipts/PREPUBLICATION_VALIDATION_RECEIPT.json"
|
| 190 |
+
manifest = json.loads(manifest_path.read_text())
|
| 191 |
+
receipt = json.loads(receipt_path.read_text())
|
| 192 |
+
assert manifest["base_revision"] == "dd57b9c35ca819a17d666ec07099215dd16facf3"
|
| 193 |
+
assert manifest["file_count"] == len(manifest["files"])
|
| 194 |
+
assert manifest["file_count"] >= 12
|
| 195 |
+
for row in manifest["files"]:
|
| 196 |
+
path = UPLOAD / row["path"]
|
| 197 |
+
payload = path.read_bytes()
|
| 198 |
+
assert len(payload) == row["size"]
|
| 199 |
+
assert hashlib.sha256(payload).hexdigest() == row["sha256"]
|
| 200 |
+
assert receipt["status"] == "READY_TO_PUBLISH"
|
| 201 |
+
assert receipt["publication_manifest_sha256"] == hashlib.sha256(
|
| 202 |
+
manifest_path.read_bytes()
|
| 203 |
+
).hexdigest()
|
| 204 |
+
assert receipt["training_index_sha256"] == hashlib.sha256(INDEX.read_bytes()).hexdigest()
|
| 205 |
+
assert receipt["dataset"]["rgb_in_graph_zip"] is False
|
scripts/setup_realtime_final_graph_env.sh
CHANGED
|
@@ -18,46 +18,73 @@ set -euo pipefail
|
|
| 18 |
ENV_NAME="${1:-robocasa}"
|
| 19 |
WORK_ROOT="${GWAM_SETUP_ROOT:-$HOME/gwam_realtime_deps}"
|
| 20 |
ROBOCASA_ROOT="${ROBOCASA_ROOT:-$WORK_ROOT/robocasa}"
|
|
|
|
| 21 |
SAM2_ROOT="${SAM2_ROOT:-$WORK_ROOT/sam2}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
if
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
else
|
| 28 |
-
echo "conda not found; install Miniconda/Anaconda first" >&2
|
| 29 |
-
exit 2
|
| 30 |
-
fi
|
| 31 |
else
|
| 32 |
-
|
| 33 |
-
|
| 34 |
fi
|
| 35 |
|
| 36 |
-
if !
|
| 37 |
-
|
| 38 |
fi
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
python -m pip install git+https://github.com/openai/CLIP.git
|
| 45 |
|
| 46 |
mkdir -p "$WORK_ROOT"
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
then
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
fi
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
if [[ ! -d "$SAM2_ROOT/.git" ]]; then
|
| 58 |
git clone https://github.com/facebookresearch/sam2.git "$SAM2_ROOT"
|
| 59 |
fi
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
cat <<'EOF'
|
| 63 |
|
|
@@ -66,7 +93,7 @@ RoboCasa kitchen assets according to upstream RoboCasa instructions before runni
|
|
| 66 |
live simulator tasks. This dataset does not redistribute RoboCasa assets.
|
| 67 |
EOF
|
| 68 |
|
| 69 |
-
|
| 70 |
import importlib.util
|
| 71 |
missing=[]
|
| 72 |
for m in ['robocasa','robosuite','torch','clip','sam2','cv2','numpy']:
|
|
@@ -77,3 +104,29 @@ if missing:
|
|
| 77 |
raise SystemExit(f'missing imports: {missing}')
|
| 78 |
print('setup_realtime_final_graph_env_ok')
|
| 79 |
PY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
ENV_NAME="${1:-robocasa}"
|
| 19 |
WORK_ROOT="${GWAM_SETUP_ROOT:-$HOME/gwam_realtime_deps}"
|
| 20 |
ROBOCASA_ROOT="${ROBOCASA_ROOT:-$WORK_ROOT/robocasa}"
|
| 21 |
+
ROBOSUITE_ROOT="${ROBOSUITE_ROOT:-$WORK_ROOT/robosuite}"
|
| 22 |
SAM2_ROOT="${SAM2_ROOT:-$WORK_ROOT/sam2}"
|
| 23 |
+
ROBOSUITE_COMMIT="5ce6643f3092639d08f7b0f90ed1c6a84f50552c"
|
| 24 |
+
ROBOCASA_COMMIT="b4684e6ee37d377cc392e98302a6b916d588b415"
|
| 25 |
+
SAM2_COMMIT="2b90b9f5ceec907a1c18123530e92e794ad901a4"
|
| 26 |
+
CLIP_COMMIT="d05afc436d78f1c48dc0dbf8e5980a9d471f35f6"
|
| 27 |
|
| 28 |
+
if command -v conda >/dev/null 2>&1; then
|
| 29 |
+
CONDA_EXE="$(command -v conda)"
|
| 30 |
+
elif [[ -x /home/chris/anaconda3/bin/conda ]]; then
|
| 31 |
+
CONDA_EXE="/home/chris/anaconda3/bin/conda"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
else
|
| 33 |
+
echo "conda not found; install Miniconda/Anaconda first" >&2
|
| 34 |
+
exit 2
|
| 35 |
fi
|
| 36 |
|
| 37 |
+
if ! "$CONDA_EXE" env list | awk '{print $1}' | grep -qx "$ENV_NAME"; then
|
| 38 |
+
"$CONDA_EXE" create -y -n "$ENV_NAME" python=3.11
|
| 39 |
fi
|
| 40 |
+
CONDA_BASE="$("$CONDA_EXE" info --base)"
|
| 41 |
+
ENV_PREFIX="$("$CONDA_BASE/bin/python" - "$ENV_NAME" <<'PY'
|
| 42 |
+
import json, subprocess, sys
|
| 43 |
+
name = sys.argv[1]
|
| 44 |
+
payload = json.loads(subprocess.check_output([sys.executable.replace('/bin/python', '/bin/conda'), 'env', 'list', '--json'], text=True))
|
| 45 |
+
matches = [path for path in payload['envs'] if path.rsplit('/', 1)[-1] == name]
|
| 46 |
+
if len(matches) != 1:
|
| 47 |
+
raise SystemExit(f'expected one conda environment named {name}, got {matches}')
|
| 48 |
+
print(matches[0])
|
| 49 |
+
PY
|
| 50 |
+
)"
|
| 51 |
+
PYTHON="$ENV_PREFIX/bin/python"
|
| 52 |
|
| 53 |
+
"$PYTHON" -m pip install --upgrade pip
|
| 54 |
+
"$PYTHON" -m pip install numpy opencv-python
|
| 55 |
+
"$PYTHON" -m pip install "git+https://github.com/openai/CLIP.git@${CLIP_COMMIT}"
|
|
|
|
| 56 |
|
| 57 |
mkdir -p "$WORK_ROOT"
|
| 58 |
+
|
| 59 |
+
# RoboCasa main requires robosuite master APIs such as load_model_on_init.
|
| 60 |
+
# The PyPI robosuite==1.5.2 release is not compatible with RoboCasa 1.0.1.
|
| 61 |
+
if [[ ! -d "$ROBOSUITE_ROOT/.git" ]]; then
|
| 62 |
+
git clone https://github.com/ARISE-Initiative/robosuite.git "$ROBOSUITE_ROOT"
|
| 63 |
+
fi
|
| 64 |
+
git -C "$ROBOSUITE_ROOT" fetch origin "$ROBOSUITE_COMMIT"
|
| 65 |
+
git -C "$ROBOSUITE_ROOT" checkout --detach "$ROBOSUITE_COMMIT"
|
| 66 |
+
"$PYTHON" -m pip install -e "$ROBOSUITE_ROOT"
|
| 67 |
+
|
| 68 |
+
if [[ ! -d "$ROBOCASA_ROOT/.git" ]]; then
|
| 69 |
+
git clone https://github.com/robocasa/robocasa.git "$ROBOCASA_ROOT"
|
| 70 |
fi
|
| 71 |
+
git -C "$ROBOCASA_ROOT" fetch origin "$ROBOCASA_COMMIT"
|
| 72 |
+
git -C "$ROBOCASA_ROOT" checkout --detach "$ROBOCASA_COMMIT"
|
| 73 |
+
"$PYTHON" -m pip install -e "$ROBOCASA_ROOT"
|
| 74 |
|
| 75 |
if [[ ! -d "$SAM2_ROOT/.git" ]]; then
|
| 76 |
git clone https://github.com/facebookresearch/sam2.git "$SAM2_ROOT"
|
| 77 |
fi
|
| 78 |
+
git -C "$SAM2_ROOT" fetch origin "$SAM2_COMMIT"
|
| 79 |
+
git -C "$SAM2_ROOT" checkout --detach "$SAM2_COMMIT"
|
| 80 |
+
"$PYTHON" -m pip install -e "$SAM2_ROOT"
|
| 81 |
+
|
| 82 |
+
# RoboCasa/LeRobot dependencies may downgrade torch to a CUDA 12.6 wheel that
|
| 83 |
+
# cannot execute on Blackwell (sm_120). Re-assert the CUDA 13 wheel last.
|
| 84 |
+
"$PYTHON" -m pip install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cu130
|
| 85 |
+
# Reinstall NCCL from PyPI: the dependency copy selected during mixed-index
|
| 86 |
+
# resolution can carry the same version metadata but omit ncclCommResume.
|
| 87 |
+
"$PYTHON" -m pip install --force-reinstall --no-cache-dir nvidia-nccl-cu13==2.29.7
|
| 88 |
|
| 89 |
cat <<'EOF'
|
| 90 |
|
|
|
|
| 93 |
live simulator tasks. This dataset does not redistribute RoboCasa assets.
|
| 94 |
EOF
|
| 95 |
|
| 96 |
+
"$PYTHON" - <<'PY'
|
| 97 |
import importlib.util
|
| 98 |
missing=[]
|
| 99 |
for m in ['robocasa','robosuite','torch','clip','sam2','cv2','numpy']:
|
|
|
|
| 104 |
raise SystemExit(f'missing imports: {missing}')
|
| 105 |
print('setup_realtime_final_graph_env_ok')
|
| 106 |
PY
|
| 107 |
+
|
| 108 |
+
"$PYTHON" - <<'PY'
|
| 109 |
+
import torch
|
| 110 |
+
print("torch", torch.__version__, "cuda", torch.version.cuda, "available", torch.cuda.is_available())
|
| 111 |
+
if torch.cuda.is_available():
|
| 112 |
+
value = float((torch.ones(8, device="cuda") ** 2).sum().item())
|
| 113 |
+
if value != 8.0:
|
| 114 |
+
raise SystemExit(f"CUDA execution smoke differs: {value}")
|
| 115 |
+
print("setup_realtime_final_graph_cuda_smoke_ok", value)
|
| 116 |
+
PY
|
| 117 |
+
|
| 118 |
+
"$PYTHON" - <<PY
|
| 119 |
+
from pathlib import Path
|
| 120 |
+
checks = {
|
| 121 |
+
Path("$ROBOSUITE_ROOT"): "$ROBOSUITE_COMMIT",
|
| 122 |
+
Path("$ROBOCASA_ROOT"): "$ROBOCASA_COMMIT",
|
| 123 |
+
Path("$SAM2_ROOT"): "$SAM2_COMMIT",
|
| 124 |
+
}
|
| 125 |
+
import subprocess
|
| 126 |
+
for root, expected in checks.items():
|
| 127 |
+
got = subprocess.check_output(["git", "-C", str(root), "rev-parse", "HEAD"], text=True).strip()
|
| 128 |
+
print(root.name, got)
|
| 129 |
+
if got != expected:
|
| 130 |
+
raise SystemExit(f"commit mismatch for {root}: {got} != {expected}")
|
| 131 |
+
print("setup_realtime_final_graph_commits_ok")
|
| 132 |
+
PY
|