8tasks_rollouts / pooled /README.md
olingoudey's picture podolinsky's picture
Add pooled features and targets (pooled/) (#3)
273b14c
|
Raw History Blame Contribute Delete
2.98 kB

Pooled features and targets

Two files derived from the rollout.npz files and the labels of this dataset, for training probes on the policy's token embeddings without loading the 114 MB rollouts. Both are keyed by the dir column of manifest.csv (for example basket/ep000), and step t of an episode's targets lines up with row t of its features and with policy step t of rollout.npz.

features.npz

One float32 array of shape (policy steps, 6144) per episode: 399 arrays, one row per policy step (n_policy in manifest.csv).

columns content
0-2047 mean over the 88 base-image tokens (base_image in rollout.npz)
2048-4095 mean over the 88 wrist-image tokens (wrist_image)
4096-6143 mean over the non-padded language tokens (language, the tokens where language_mask is true; 4 of 200 per step here)

The tokens are stored as float16 in rollout.npz and averaged in float32. pool_features.py is the code that produced the file; run on basket/ep000 it reproduces the stored array exactly.

targets.npz

Targets for the auxiliary heads of failure probes, built from the labels of this dataset (labels.json).

key shape, type content
phrases (896,) str sorted unique phrases of the semantic timelines (semantic_timeline in labels.json) of all 399 episodes
phrase_embeddings (896, 512) float32 L2-normalised CLIP ViT-B/32 (openai/clip-vit-base-patch32) text features of the phrases
mode_names (10,) str the failure-mode classes: wrong_object, stuck_or_no_progress, wrong_target, object_displacement, placement_or_insertion_failure, grasp_failure, open_close_failure, press_failure, other, timeout_or_insufficient_progress
phrase_ids/<dir> (policy steps,) int32 for each policy step, the index into phrases of the timeline segment that covers it; -1 where there is none
mode/<dir> scalar int8 index into mode_names (fail_mode of labels.npz); present for the 254 failed episodes only

How the phrase of a step is chosen: it is the phrase of the timeline segment whose policy-step range covers the step (a later segment overwrites a step shared with the previous one); steps after a segment that no segment covers repeat the previous step's phrase; steps before the first segment are -1. The failure modes are the labeller's output (see LABELS.md: Gemini, not individually verified), and only seven of the ten classes occur.

import numpy as np
f, z = np.load("features.npz"), np.load("targets.npz")
x = f[dir]                                  # (steps, 6144), dir such as "basket/ep000"
ids = z["phrase_ids/" + dir]                # (steps,)
clip_target = z["phrase_embeddings"][ids]   # (steps, 512); rows where ids < 0 have no target
mode = z["mode_names"][z["mode/" + dir]] if "mode/" + dir in z.files else None   # failed episodes only

License: the same as the rest of this dataset.