Datasets:
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
< 1K
Tags:
benchmark
temporal-segmentation
action-segmentation
subtask-annotation
vlm-evaluation
robotics
License:
Embed perception states in existing rows
Browse filesReplaces the separate configuration with a nullable `perception_state` field directly on every existing benchmark row. DROID/Galaxea rows contain synchronized named state channels; HomER rows contain null. Removes the sidecar dataset files.
All 100 original IDs, instructions, segments, metadata values, and embedded video bytes were verified unchanged. Coverage is 75 populated rows, 25 null HomER rows, and 30,494 synchronized frames.
README.md
CHANGED
|
@@ -23,10 +23,6 @@ configs:
|
|
| 23 |
data_files:
|
| 24 |
- split: train
|
| 25 |
path: data/annotations.parquet
|
| 26 |
-
- config_name: robot_states
|
| 27 |
-
data_files:
|
| 28 |
-
- split: train
|
| 29 |
-
path: robot_states/perception_states.parquet
|
| 30 |
---
|
| 31 |
|
| 32 |
# WGO-Bench: What's Going On Benchmark
|
|
@@ -60,8 +56,6 @@ Each row contains one video episode, a high-level task instruction, and gold sub
|
|
| 60 |
|
| 61 |
## Schema
|
| 62 |
|
| 63 |
-
### `default`
|
| 64 |
-
|
| 65 |
| Column | Type | Description |
|
| 66 |
| --- | --- | --- |
|
| 67 |
| `id` | string | Stable episode identifier. |
|
|
@@ -69,30 +63,12 @@ Each row contains one video episode, a high-level task instruction, and gold sub
|
|
| 69 |
| `instruction` | string | High-level task instruction for the episode. |
|
| 70 |
| `segments` | list | Gold `{start_sec, end_sec, subtask}` annotations. |
|
| 71 |
| `metadata` | string | JSON metadata with source-specific fields. |
|
| 72 |
-
|
| 73 |
-
### `robot_states`
|
| 74 |
-
|
| 75 |
-
The optional `robot_states` configuration contains synchronized proprioception
|
| 76 |
-
for the 50 RoboInter/DROID and 25 RoboCOIN/Galaxea episodes. HomER has no robot
|
| 77 |
-
telemetry and is intentionally absent rather than filled with synthetic zeros.
|
| 78 |
-
|
| 79 |
-
| Column | Type | Description |
|
| 80 |
-
| --- | --- | --- |
|
| 81 |
-
| `bench_id` | string | Stable episode identifier matching `id` in `default`. |
|
| 82 |
-
| `robot_family` | string | `droid` or `galaxea`. |
|
| 83 |
-
| `source_dataset` | string | Official upstream dataset repository. |
|
| 84 |
-
| `source_revision` | string | Immutable upstream Git revision. |
|
| 85 |
-
| `source_episode_index` | integer | Episode index in the upstream dataset. |
|
| 86 |
-
| `fps` | float | State sampling rate. |
|
| 87 |
-
| `num_frames` | integer | Number of synchronized state/video frames. |
|
| 88 |
-
| `frame_index` | list | Ordered frame indices. |
|
| 89 |
-
| `timestamp_sec` | list | Ordered timestamps in seconds. |
|
| 90 |
-
| `primary_channel` | string | Main source-native proprioception column. |
|
| 91 |
-
| `channels` | list | Named state channels with semantic value names and per-frame values. |
|
| 92 |
|
| 93 |
DROID retains EEF position, rotation, and gripper state. Galaxea retains
|
| 94 |
bilateral arm joints and grippers plus its available EEF- and gripper-derived
|
| 95 |
-
channels. Actions are not included.
|
|
|
|
| 96 |
|
| 97 |
## Quick Start
|
| 98 |
|
|
@@ -104,22 +80,7 @@ example = dataset[0]
|
|
| 104 |
|
| 105 |
print(example["instruction"])
|
| 106 |
print(example["segments"])
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
Load robot states separately and join them on `id == bench_id`:
|
| 110 |
-
|
| 111 |
-
```python
|
| 112 |
-
from datasets import load_dataset
|
| 113 |
-
|
| 114 |
-
episodes = load_dataset("macrodata/WGO-Bench", "default", split="train")
|
| 115 |
-
robot_states = load_dataset("macrodata/WGO-Bench", "robot_states", split="train")
|
| 116 |
-
|
| 117 |
-
state_by_id = {row["bench_id"]: row for row in robot_states}
|
| 118 |
-
episode = next(row for row in episodes if row["id"] in state_by_id)
|
| 119 |
-
state = state_by_id[episode["id"]]
|
| 120 |
-
|
| 121 |
-
print(state["primary_channel"])
|
| 122 |
-
print(state["channels"][0]["value_names"])
|
| 123 |
```
|
| 124 |
|
| 125 |
To use the parquet directly:
|
|
@@ -133,19 +94,21 @@ df = pd.read_parquet("hf://datasets/macrodata/WGO-Bench/data/annotations.parquet
|
|
| 133 |
## Rebuilding Robot States
|
| 134 |
|
| 135 |
`scripts/perception_sources.lock.json` pins both annotation maps and all 26
|
| 136 |
-
upstream robot-dataset revisions. Rebuild the
|
| 137 |
-
|
| 138 |
|
| 139 |
```bash
|
| 140 |
-
python scripts/
|
|
|
|
|
|
|
| 141 |
```
|
| 142 |
|
| 143 |
Requirements are Python 3.11+, `huggingface_hub`, and `pyarrow`. The exporter
|
| 144 |
validates episode coverage, frame counts, channel widths, and timestamp order,
|
| 145 |
-
then writes a SHA-256 provenance file next to the Parquet. Hugging Face
|
| 146 |
-
all
|
| 147 |
-
comes from one roughly 241 MB upstream tar archive
|
| 148 |
-
|
| 149 |
|
| 150 |
## Annotation Policy
|
| 151 |
|
|
|
|
| 23 |
data_files:
|
| 24 |
- split: train
|
| 25 |
path: data/annotations.parquet
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
---
|
| 27 |
|
| 28 |
# WGO-Bench: What's Going On Benchmark
|
|
|
|
| 56 |
|
| 57 |
## Schema
|
| 58 |
|
|
|
|
|
|
|
| 59 |
| Column | Type | Description |
|
| 60 |
| --- | --- | --- |
|
| 61 |
| `id` | string | Stable episode identifier. |
|
|
|
|
| 63 |
| `instruction` | string | High-level task instruction for the episode. |
|
| 64 |
| `segments` | list | Gold `{start_sec, end_sec, subtask}` annotations. |
|
| 65 |
| `metadata` | string | JSON metadata with source-specific fields. |
|
| 66 |
+
| `perception_state` | struct or null | Synchronized, named robot-state channels for DROID/Galaxea; null for HomER. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
DROID retains EEF position, rotation, and gripper state. Galaxea retains
|
| 69 |
bilateral arm joints and grippers plus its available EEF- and gripper-derived
|
| 70 |
+
channels. Actions are not included. HomER has no robot telemetry, so its rows
|
| 71 |
+
contain `null` rather than synthetic zeros.
|
| 72 |
|
| 73 |
## Quick Start
|
| 74 |
|
|
|
|
| 80 |
|
| 81 |
print(example["instruction"])
|
| 82 |
print(example["segments"])
|
| 83 |
+
print(example["perception_state"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
```
|
| 85 |
|
| 86 |
To use the parquet directly:
|
|
|
|
| 94 |
## Rebuilding Robot States
|
| 95 |
|
| 96 |
`scripts/perception_sources.lock.json` pins both annotation maps and all 26
|
| 97 |
+
upstream robot-dataset revisions. Rebuild the enriched table from the original
|
| 98 |
+
annotations Parquet:
|
| 99 |
|
| 100 |
```bash
|
| 101 |
+
python scripts/embed_perception_states.py \
|
| 102 |
+
data/annotations.original.parquet \
|
| 103 |
+
data/annotations.parquet
|
| 104 |
```
|
| 105 |
|
| 106 |
Requirements are Python 3.11+, `huggingface_hub`, and `pyarrow`. The exporter
|
| 107 |
validates episode coverage, frame counts, channel widths, and timestamp order,
|
| 108 |
+
then writes a SHA-256 provenance file next to the enriched Parquet. Hugging Face
|
| 109 |
+
caches all state sources; pass `--cache-dir` to use a shared cache. The DROID
|
| 110 |
+
state data comes from one roughly 241 MB upstream tar archive. The embedded
|
| 111 |
+
state payload adds roughly 1.5 MB before Parquet-level recompression.
|
| 112 |
|
| 113 |
## Annotation Policy
|
| 114 |
|
data/annotations.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24c6c23447753385b9cea0d17f17d7a8aa74131d800d9bc9ab74d7669d7404ab
|
| 3 |
+
size 1401440590
|
data/annotations.parquet.provenance.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"artifact": "annotations.parquet",
|
| 4 |
+
"input_sha256": "3b4320b76c1b1fb6150bf2d192343dc62eed39db54a89584b7c6f31f511e73d4",
|
| 5 |
+
"output_sha256": "24c6c23447753385b9cea0d17f17d7a8aa74131d800d9bc9ab74d7669d7404ab",
|
| 6 |
+
"source_lock": "perception_sources.lock.json",
|
| 7 |
+
"source_lock_sha256": "0a7da2033dc2007207c9dc77e5e36172ec01fe2ed2a286501b48e169ce6dce8b",
|
| 8 |
+
"rows": 100,
|
| 9 |
+
"robot_state_rows": 75,
|
| 10 |
+
"video_only_rows": 25,
|
| 11 |
+
"video_only_ids": [
|
| 12 |
+
"homer_1",
|
| 13 |
+
"homer_2",
|
| 14 |
+
"homer_3",
|
| 15 |
+
"homer_4",
|
| 16 |
+
"homer_5",
|
| 17 |
+
"homer_7",
|
| 18 |
+
"homer_9",
|
| 19 |
+
"homer_10",
|
| 20 |
+
"homer_11",
|
| 21 |
+
"homer_12",
|
| 22 |
+
"homer_15",
|
| 23 |
+
"homer_29",
|
| 24 |
+
"homer_33",
|
| 25 |
+
"homer_37",
|
| 26 |
+
"homer_38",
|
| 27 |
+
"homer_39",
|
| 28 |
+
"homer_40",
|
| 29 |
+
"homer_41",
|
| 30 |
+
"homer_48",
|
| 31 |
+
"homer_50",
|
| 32 |
+
"homer_52",
|
| 33 |
+
"homer_53",
|
| 34 |
+
"homer_56",
|
| 35 |
+
"homer_59",
|
| 36 |
+
"homer_60"
|
| 37 |
+
]
|
| 38 |
+
}
|
robot_states/perception_states.parquet
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:979135afc50e826fef887e7ed4c30ed15bbc08e6ae17ebbb18fa8b48032d933e
|
| 3 |
-
size 1609505
|
|
|
|
|
|
|
|
|
|
|
|
robot_states/perception_states.parquet.provenance.json
DELETED
|
@@ -1,86 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"schema_version": 1,
|
| 3 |
-
"artifact": "perception_states.parquet",
|
| 4 |
-
"sha256": "979135afc50e826fef887e7ed4c30ed15bbc08e6ae17ebbb18fa8b48032d933e",
|
| 5 |
-
"episodes": 75,
|
| 6 |
-
"bench_ids": [
|
| 7 |
-
"galaxea_002",
|
| 8 |
-
"galaxea_007",
|
| 9 |
-
"galaxea_009",
|
| 10 |
-
"galaxea_011",
|
| 11 |
-
"galaxea_013",
|
| 12 |
-
"galaxea_028",
|
| 13 |
-
"galaxea_033",
|
| 14 |
-
"galaxea_037",
|
| 15 |
-
"galaxea_039",
|
| 16 |
-
"galaxea_041",
|
| 17 |
-
"galaxea_043",
|
| 18 |
-
"galaxea_045",
|
| 19 |
-
"galaxea_047",
|
| 20 |
-
"galaxea_049",
|
| 21 |
-
"galaxea_050",
|
| 22 |
-
"galaxea_052",
|
| 23 |
-
"galaxea_058",
|
| 24 |
-
"galaxea_060",
|
| 25 |
-
"galaxea_062",
|
| 26 |
-
"galaxea_065",
|
| 27 |
-
"galaxea_067",
|
| 28 |
-
"galaxea_069",
|
| 29 |
-
"galaxea_071",
|
| 30 |
-
"galaxea_073",
|
| 31 |
-
"galaxea_075",
|
| 32 |
-
"robointer_droid_000001",
|
| 33 |
-
"robointer_droid_000002",
|
| 34 |
-
"robointer_droid_000003",
|
| 35 |
-
"robointer_droid_000004",
|
| 36 |
-
"robointer_droid_000005",
|
| 37 |
-
"robointer_droid_000006",
|
| 38 |
-
"robointer_droid_000007",
|
| 39 |
-
"robointer_droid_000008",
|
| 40 |
-
"robointer_droid_000009",
|
| 41 |
-
"robointer_droid_000010",
|
| 42 |
-
"robointer_droid_000011",
|
| 43 |
-
"robointer_droid_000012",
|
| 44 |
-
"robointer_droid_000013",
|
| 45 |
-
"robointer_droid_000014",
|
| 46 |
-
"robointer_droid_000015",
|
| 47 |
-
"robointer_droid_000016",
|
| 48 |
-
"robointer_droid_000017",
|
| 49 |
-
"robointer_droid_000019",
|
| 50 |
-
"robointer_droid_000021",
|
| 51 |
-
"robointer_droid_000022",
|
| 52 |
-
"robointer_droid_000023",
|
| 53 |
-
"robointer_droid_000024",
|
| 54 |
-
"robointer_droid_000025",
|
| 55 |
-
"robointer_droid_000027",
|
| 56 |
-
"robointer_droid_000028",
|
| 57 |
-
"robointer_droid_000029",
|
| 58 |
-
"robointer_droid_000030",
|
| 59 |
-
"robointer_droid_000032",
|
| 60 |
-
"robointer_droid_000033",
|
| 61 |
-
"robointer_droid_000034",
|
| 62 |
-
"robointer_droid_000035",
|
| 63 |
-
"robointer_droid_000036",
|
| 64 |
-
"robointer_droid_000037",
|
| 65 |
-
"robointer_droid_000038",
|
| 66 |
-
"robointer_droid_000039",
|
| 67 |
-
"robointer_droid_000042",
|
| 68 |
-
"robointer_droid_000043",
|
| 69 |
-
"robointer_droid_000044",
|
| 70 |
-
"robointer_droid_000045",
|
| 71 |
-
"robointer_droid_000046",
|
| 72 |
-
"robointer_droid_000047",
|
| 73 |
-
"robointer_droid_000050",
|
| 74 |
-
"robointer_droid_000055",
|
| 75 |
-
"robointer_droid_000056",
|
| 76 |
-
"robointer_droid_000057",
|
| 77 |
-
"robointer_droid_000058",
|
| 78 |
-
"robointer_droid_000059",
|
| 79 |
-
"robointer_droid_000060",
|
| 80 |
-
"robointer_droid_000061",
|
| 81 |
-
"robointer_droid_000062"
|
| 82 |
-
],
|
| 83 |
-
"source_lock": "perception_sources.lock.json",
|
| 84 |
-
"source_lock_sha256": "0a7da2033dc2007207c9dc77e5e36172ec01fe2ed2a286501b48e169ce6dce8b",
|
| 85 |
-
"video_only_episodes": 25
|
| 86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/embed_perception_states.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
import pyarrow as pa
|
| 10 |
+
import pyarrow.parquet as pq
|
| 11 |
+
|
| 12 |
+
from perception_states import (
|
| 13 |
+
LOCK_PATH,
|
| 14 |
+
_load_episode,
|
| 15 |
+
discover_robot_episodes,
|
| 16 |
+
load_source_lock,
|
| 17 |
+
normalize_episode,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def state_type() -> pa.DataType:
|
| 22 |
+
return pa.struct(
|
| 23 |
+
[
|
| 24 |
+
("robot_family", pa.string()),
|
| 25 |
+
("source_dataset", pa.string()),
|
| 26 |
+
("source_revision", pa.string()),
|
| 27 |
+
("source_episode_index", pa.int64()),
|
| 28 |
+
("fps", pa.float64()),
|
| 29 |
+
("num_frames", pa.int64()),
|
| 30 |
+
("frame_index", pa.list_(pa.int64())),
|
| 31 |
+
("timestamp_sec", pa.list_(pa.float64())),
|
| 32 |
+
("primary_channel", pa.string()),
|
| 33 |
+
(
|
| 34 |
+
"channels",
|
| 35 |
+
pa.list_(
|
| 36 |
+
pa.struct(
|
| 37 |
+
[
|
| 38 |
+
("name", pa.string()),
|
| 39 |
+
("value_names", pa.list_(pa.string())),
|
| 40 |
+
("values", pa.list_(pa.list_(pa.float64()))),
|
| 41 |
+
]
|
| 42 |
+
)
|
| 43 |
+
),
|
| 44 |
+
),
|
| 45 |
+
]
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def collect_states(lock_path: Path, cache_dir: Path | None) -> dict[str, dict[str, Any]]:
|
| 50 |
+
lock = load_source_lock(lock_path)
|
| 51 |
+
states: dict[str, dict[str, Any]] = {}
|
| 52 |
+
for episode in discover_robot_episodes(lock, cache_dir):
|
| 53 |
+
table, feature_info = _load_episode(episode, cache_dir)
|
| 54 |
+
row = normalize_episode(table, episode, feature_info)
|
| 55 |
+
bench_id = row.pop("bench_id")
|
| 56 |
+
states[bench_id] = row
|
| 57 |
+
return states
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def embed_perception_states(
|
| 61 |
+
input_path: Path,
|
| 62 |
+
output_path: Path,
|
| 63 |
+
*,
|
| 64 |
+
lock_path: Path = LOCK_PATH,
|
| 65 |
+
cache_dir: Path | None = None,
|
| 66 |
+
) -> dict[str, Any]:
|
| 67 |
+
if input_path.resolve() == output_path.resolve():
|
| 68 |
+
raise ValueError("Input and output paths must differ")
|
| 69 |
+
|
| 70 |
+
states = collect_states(lock_path, cache_dir)
|
| 71 |
+
source = pq.ParquetFile(input_path)
|
| 72 |
+
if "perception_state" in source.schema_arrow.names:
|
| 73 |
+
raise ValueError("Input already contains perception_state")
|
| 74 |
+
if source.metadata.num_rows != 100:
|
| 75 |
+
raise ValueError(f"Expected 100 benchmark rows, found {source.metadata.num_rows}")
|
| 76 |
+
|
| 77 |
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
| 78 |
+
output_schema = source.schema_arrow.append(pa.field("perception_state", state_type()))
|
| 79 |
+
matched: set[str] = set()
|
| 80 |
+
video_only: list[str] = []
|
| 81 |
+
with pq.ParquetWriter(output_path, output_schema, compression="zstd") as writer:
|
| 82 |
+
for batch in source.iter_batches(batch_size=1):
|
| 83 |
+
table = pa.Table.from_batches([batch])
|
| 84 |
+
bench_id = str(table["id"][0].as_py())
|
| 85 |
+
state = states.get(bench_id)
|
| 86 |
+
if state is None:
|
| 87 |
+
video_only.append(bench_id)
|
| 88 |
+
else:
|
| 89 |
+
matched.add(bench_id)
|
| 90 |
+
enriched = table.append_column(
|
| 91 |
+
"perception_state", pa.array([state], type=state_type())
|
| 92 |
+
)
|
| 93 |
+
writer.write_table(enriched, row_group_size=1)
|
| 94 |
+
|
| 95 |
+
missing = set(states) - matched
|
| 96 |
+
if missing:
|
| 97 |
+
output_path.unlink(missing_ok=True)
|
| 98 |
+
raise ValueError(f"State IDs absent from benchmark: {sorted(missing)}")
|
| 99 |
+
if len(matched) != 75 or len(video_only) != 25:
|
| 100 |
+
output_path.unlink(missing_ok=True)
|
| 101 |
+
raise ValueError(
|
| 102 |
+
f"Expected 75 state rows and 25 video-only rows, got {len(matched)} and {len(video_only)}"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
provenance = {
|
| 106 |
+
"schema_version": 1,
|
| 107 |
+
"artifact": output_path.name,
|
| 108 |
+
"input_sha256": _sha256(input_path),
|
| 109 |
+
"output_sha256": _sha256(output_path),
|
| 110 |
+
"source_lock": lock_path.name,
|
| 111 |
+
"source_lock_sha256": _sha256(lock_path),
|
| 112 |
+
"rows": source.metadata.num_rows,
|
| 113 |
+
"robot_state_rows": len(matched),
|
| 114 |
+
"video_only_rows": len(video_only),
|
| 115 |
+
"video_only_ids": video_only,
|
| 116 |
+
}
|
| 117 |
+
provenance_path = output_path.with_suffix(output_path.suffix + ".provenance.json")
|
| 118 |
+
provenance_path.write_text(json.dumps(provenance, indent=2) + "\n", encoding="utf-8")
|
| 119 |
+
return provenance
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def _sha256(path: Path) -> str:
|
| 123 |
+
digest = hashlib.sha256()
|
| 124 |
+
with path.open("rb") as handle:
|
| 125 |
+
for chunk in iter(lambda: handle.read(8 * 1024 * 1024), b""):
|
| 126 |
+
digest.update(chunk)
|
| 127 |
+
return digest.hexdigest()
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def main() -> None:
|
| 131 |
+
parser = argparse.ArgumentParser(
|
| 132 |
+
description="Embed pinned robot proprioception into existing WGO-Bench rows."
|
| 133 |
+
)
|
| 134 |
+
parser.add_argument("input", type=Path)
|
| 135 |
+
parser.add_argument("output", type=Path)
|
| 136 |
+
parser.add_argument("--lock", type=Path, default=LOCK_PATH)
|
| 137 |
+
parser.add_argument("--cache-dir", type=Path)
|
| 138 |
+
args = parser.parse_args()
|
| 139 |
+
result = embed_perception_states(
|
| 140 |
+
args.input,
|
| 141 |
+
args.output,
|
| 142 |
+
lock_path=args.lock,
|
| 143 |
+
cache_dir=args.cache_dir,
|
| 144 |
+
)
|
| 145 |
+
print(json.dumps(result, indent=2))
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
if __name__ == "__main__":
|
| 149 |
+
main()
|