auto-sync 2026-07-03T16:58:17Z workspace
Browse files- workspace/cil/chart_features.py +27 -11
- workspace/data/cil_charts_rgb_refs/test/charts_00000.npz +2 -2
- workspace/data/cil_charts_rgb_refs/test/index.json +11 -2
- workspace/data/cil_charts_rgb_refs/train/charts_00000.npz +2 -2
- workspace/data/cil_charts_rgb_refs/train/index.json +11 -2
- workspace/data/cil_charts_rgb_refs/val/charts_00000.npz +2 -2
- workspace/data/cil_charts_rgb_refs/val/index.json +11 -2
workspace/cil/chart_features.py
CHANGED
|
@@ -12,7 +12,14 @@ except ImportError: # pragma: no cover
|
|
| 12 |
|
| 13 |
CONTEXT_HASH_WIDTH = 8
|
| 14 |
OBSERVATION_EMBED_DIM = 32
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
_EMBEDDING_CACHE: dict[str, Any] = {}
|
| 17 |
|
| 18 |
|
|
@@ -27,9 +34,10 @@ def build_chart_feature(
|
|
| 27 |
`base` preserves the original behavior: the chart token is the flattened
|
| 28 |
base action chunk. `base_context` appends stable hashes of task/language
|
| 29 |
metadata that are visible at proposal time. `base_context_obs` additionally
|
| 30 |
-
appends a precomputed observation embedding referenced by metadata.
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
"""
|
| 34 |
|
| 35 |
if np is None: # pragma: no cover
|
|
@@ -49,12 +57,20 @@ def build_chart_feature(
|
|
| 49 |
],
|
| 50 |
dtype=np.float32,
|
| 51 |
)
|
| 52 |
-
if mode
|
| 53 |
-
obs =
|
| 54 |
metadata.get("observation_embedding_path"),
|
|
|
|
| 55 |
chart_root=metadata.get("_chart_root"),
|
| 56 |
)
|
| 57 |
context = np.concatenate([context, obs.astype(np.float32, copy=False)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
return np.concatenate([base, context]).astype(np.float32, copy=False)
|
| 59 |
|
| 60 |
|
|
@@ -67,11 +83,11 @@ def _stable_hash_features(text: str, width: int) -> list[float]:
|
|
| 67 |
return [float(digest[index] / 127.5 - 1.0) for index in range(width)]
|
| 68 |
|
| 69 |
|
| 70 |
-
def
|
| 71 |
if np is None: # pragma: no cover
|
| 72 |
raise ImportError("build_chart_feature requires numpy")
|
| 73 |
if not value:
|
| 74 |
-
return np.zeros(
|
| 75 |
path_text, dataset, row_index = _parse_embedding_ref(str(value))
|
| 76 |
path = Path(path_text)
|
| 77 |
if not path.is_absolute() and chart_root:
|
|
@@ -82,10 +98,10 @@ def _load_observation_embedding(value: Any, *, chart_root: Any = None) -> Any:
|
|
| 82 |
_EMBEDDING_CACHE[cache_key] = np.asarray(data[dataset], dtype=np.float32)
|
| 83 |
matrix = _EMBEDDING_CACHE[cache_key]
|
| 84 |
vector = np.asarray(matrix[int(row_index)], dtype=np.float32).reshape(-1)
|
| 85 |
-
if vector.shape[0] ==
|
| 86 |
return vector
|
| 87 |
-
output = np.zeros(
|
| 88 |
-
width = min(
|
| 89 |
output[:width] = vector[:width]
|
| 90 |
return output
|
| 91 |
|
|
|
|
| 12 |
|
| 13 |
CONTEXT_HASH_WIDTH = 8
|
| 14 |
OBSERVATION_EMBED_DIM = 32
|
| 15 |
+
OBJECT_LAYOUT_EMBED_DIM = 64
|
| 16 |
+
CHART_FEATURE_MODES = (
|
| 17 |
+
"base",
|
| 18 |
+
"base_context",
|
| 19 |
+
"base_context_obs",
|
| 20 |
+
"base_context_obj",
|
| 21 |
+
"base_context_obs_obj",
|
| 22 |
+
)
|
| 23 |
_EMBEDDING_CACHE: dict[str, Any] = {}
|
| 24 |
|
| 25 |
|
|
|
|
| 34 |
`base` preserves the original behavior: the chart token is the flattened
|
| 35 |
base action chunk. `base_context` appends stable hashes of task/language
|
| 36 |
metadata that are visible at proposal time. `base_context_obs` additionally
|
| 37 |
+
appends a precomputed observation embedding referenced by metadata.
|
| 38 |
+
`base_context_obj` appends a precomputed RGB object-layout embedding, and
|
| 39 |
+
`base_context_obs_obj` appends both. These modes intentionally do not read
|
| 40 |
+
outcomes, labels, hidden chart branches, or evaluator-only fields.
|
| 41 |
"""
|
| 42 |
|
| 43 |
if np is None: # pragma: no cover
|
|
|
|
| 57 |
],
|
| 58 |
dtype=np.float32,
|
| 59 |
)
|
| 60 |
+
if mode in {"base_context_obs", "base_context_obs_obj"}:
|
| 61 |
+
obs = _load_embedding(
|
| 62 |
metadata.get("observation_embedding_path"),
|
| 63 |
+
dim=OBSERVATION_EMBED_DIM,
|
| 64 |
chart_root=metadata.get("_chart_root"),
|
| 65 |
)
|
| 66 |
context = np.concatenate([context, obs.astype(np.float32, copy=False)])
|
| 67 |
+
if mode in {"base_context_obj", "base_context_obs_obj"}:
|
| 68 |
+
obj = _load_embedding(
|
| 69 |
+
metadata.get("object_embedding_path"),
|
| 70 |
+
dim=OBJECT_LAYOUT_EMBED_DIM,
|
| 71 |
+
chart_root=metadata.get("_chart_root"),
|
| 72 |
+
)
|
| 73 |
+
context = np.concatenate([context, obj.astype(np.float32, copy=False)])
|
| 74 |
return np.concatenate([base, context]).astype(np.float32, copy=False)
|
| 75 |
|
| 76 |
|
|
|
|
| 83 |
return [float(digest[index] / 127.5 - 1.0) for index in range(width)]
|
| 84 |
|
| 85 |
|
| 86 |
+
def _load_embedding(value: Any, *, dim: int, chart_root: Any = None) -> Any:
|
| 87 |
if np is None: # pragma: no cover
|
| 88 |
raise ImportError("build_chart_feature requires numpy")
|
| 89 |
if not value:
|
| 90 |
+
return np.zeros(dim, dtype=np.float32)
|
| 91 |
path_text, dataset, row_index = _parse_embedding_ref(str(value))
|
| 92 |
path = Path(path_text)
|
| 93 |
if not path.is_absolute() and chart_root:
|
|
|
|
| 98 |
_EMBEDDING_CACHE[cache_key] = np.asarray(data[dataset], dtype=np.float32)
|
| 99 |
matrix = _EMBEDDING_CACHE[cache_key]
|
| 100 |
vector = np.asarray(matrix[int(row_index)], dtype=np.float32).reshape(-1)
|
| 101 |
+
if vector.shape[0] == dim:
|
| 102 |
return vector
|
| 103 |
+
output = np.zeros(dim, dtype=np.float32)
|
| 104 |
+
width = min(dim, vector.shape[0])
|
| 105 |
output[:width] = vector[:width]
|
| 106 |
return output
|
| 107 |
|
workspace/data/cil_charts_rgb_refs/test/charts_00000.npz
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:42b54c3fe5a42b22a225fc233171d098875d16595a7754b59a2c4efeb49f8ca1
|
| 3 |
+
size 6206980
|
workspace/data/cil_charts_rgb_refs/test/index.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"wrong_direction": 410,
|
| 16 |
"wrong_gripper": 410
|
| 17 |
},
|
| 18 |
-
"content_hash": "
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": false,
|
|
@@ -450,6 +450,15 @@
|
|
| 450 |
"num_groups_scanned": 2873,
|
| 451 |
"num_groups_skipped_by_split": 2463,
|
| 452 |
"num_rows": 6560,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
"observation_embedding_manifest": {
|
| 454 |
"dataset": "embeddings",
|
| 455 |
"dim": 32,
|
|
@@ -461,7 +470,7 @@
|
|
| 461 |
"retrieval_index_allowed": false,
|
| 462 |
"schema_version": 1,
|
| 463 |
"shard_content_hashes": {
|
| 464 |
-
"charts_00000.npz": "
|
| 465 |
},
|
| 466 |
"shards": [
|
| 467 |
{
|
|
|
|
| 15 |
"wrong_direction": 410,
|
| 16 |
"wrong_gripper": 410
|
| 17 |
},
|
| 18 |
+
"content_hash": "0c38d73dc9bc4ab756e12006671b5d12f1a23358b281e54b3f6a9ae3cbf6e9af",
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": false,
|
|
|
|
| 450 |
"num_groups_scanned": 2873,
|
| 451 |
"num_groups_skipped_by_split": 2463,
|
| 452 |
"num_rows": 6560,
|
| 453 |
+
"object_embedding_content_hash": "4e8773e46aef035fe87b3a6b631ae0bd9c82ba2c7310c62545a6b8c8a86373d5",
|
| 454 |
+
"object_embedding_manifest": {
|
| 455 |
+
"dataset": "embeddings",
|
| 456 |
+
"dim": 64,
|
| 457 |
+
"extractor": "rgb_object_layout_v1",
|
| 458 |
+
"num_embeddings": 410,
|
| 459 |
+
"path": "object_embeddings_rgb_layout.npz",
|
| 460 |
+
"reads_outcomes": false
|
| 461 |
+
},
|
| 462 |
"observation_embedding_manifest": {
|
| 463 |
"dataset": "embeddings",
|
| 464 |
"dim": 32,
|
|
|
|
| 470 |
"retrieval_index_allowed": false,
|
| 471 |
"schema_version": 1,
|
| 472 |
"shard_content_hashes": {
|
| 473 |
+
"charts_00000.npz": "42b54c3fe5a42b22a225fc233171d098875d16595a7754b59a2c4efeb49f8ca1"
|
| 474 |
},
|
| 475 |
"shards": [
|
| 476 |
{
|
workspace/data/cil_charts_rgb_refs/train/charts_00000.npz
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:43e04927549fe3aadafe63067bb82c16c1167c54d0c8ebd47d4114a814f338f1
|
| 3 |
+
size 30903607
|
workspace/data/cil_charts_rgb_refs/train/index.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"wrong_direction": 2044,
|
| 16 |
"wrong_gripper": 2044
|
| 17 |
},
|
| 18 |
-
"content_hash": "
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": true,
|
|
@@ -2084,6 +2084,15 @@
|
|
| 2084 |
"num_groups_scanned": 2873,
|
| 2085 |
"num_groups_skipped_by_split": 829,
|
| 2086 |
"num_rows": 32704,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2087 |
"observation_embedding_manifest": {
|
| 2088 |
"dataset": "embeddings",
|
| 2089 |
"dim": 32,
|
|
@@ -2095,7 +2104,7 @@
|
|
| 2095 |
"retrieval_index_allowed": true,
|
| 2096 |
"schema_version": 1,
|
| 2097 |
"shard_content_hashes": {
|
| 2098 |
-
"charts_00000.npz": "
|
| 2099 |
},
|
| 2100 |
"shards": [
|
| 2101 |
{
|
|
|
|
| 15 |
"wrong_direction": 2044,
|
| 16 |
"wrong_gripper": 2044
|
| 17 |
},
|
| 18 |
+
"content_hash": "67f7b4a692f7c7e71da24378dc71e3399c5d35afc14c494869eba6087b765c42",
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": true,
|
|
|
|
| 2084 |
"num_groups_scanned": 2873,
|
| 2085 |
"num_groups_skipped_by_split": 829,
|
| 2086 |
"num_rows": 32704,
|
| 2087 |
+
"object_embedding_content_hash": "fe97ac428d6b0ed4da7060eb6f697c1392b4a8a09988a10c0f633b1e457bd568",
|
| 2088 |
+
"object_embedding_manifest": {
|
| 2089 |
+
"dataset": "embeddings",
|
| 2090 |
+
"dim": 64,
|
| 2091 |
+
"extractor": "rgb_object_layout_v1",
|
| 2092 |
+
"num_embeddings": 2044,
|
| 2093 |
+
"path": "object_embeddings_rgb_layout.npz",
|
| 2094 |
+
"reads_outcomes": false
|
| 2095 |
+
},
|
| 2096 |
"observation_embedding_manifest": {
|
| 2097 |
"dataset": "embeddings",
|
| 2098 |
"dim": 32,
|
|
|
|
| 2104 |
"retrieval_index_allowed": true,
|
| 2105 |
"schema_version": 1,
|
| 2106 |
"shard_content_hashes": {
|
| 2107 |
+
"charts_00000.npz": "43e04927549fe3aadafe63067bb82c16c1167c54d0c8ebd47d4114a814f338f1"
|
| 2108 |
},
|
| 2109 |
"shards": [
|
| 2110 |
{
|
workspace/data/cil_charts_rgb_refs/val/charts_00000.npz
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:6f6ea9dd2f6809cbed119598842a1dd6baaf5db099587a2748a00264aafae4e8
|
| 3 |
+
size 6344084
|
workspace/data/cil_charts_rgb_refs/val/index.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"wrong_direction": 419,
|
| 16 |
"wrong_gripper": 419
|
| 17 |
},
|
| 18 |
-
"content_hash": "
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": false,
|
|
@@ -459,6 +459,15 @@
|
|
| 459 |
"num_groups_scanned": 2873,
|
| 460 |
"num_groups_skipped_by_split": 2454,
|
| 461 |
"num_rows": 6704,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
"observation_embedding_manifest": {
|
| 463 |
"dataset": "embeddings",
|
| 464 |
"dim": 32,
|
|
@@ -470,7 +479,7 @@
|
|
| 470 |
"retrieval_index_allowed": false,
|
| 471 |
"schema_version": 1,
|
| 472 |
"shard_content_hashes": {
|
| 473 |
-
"charts_00000.npz": "
|
| 474 |
},
|
| 475 |
"shards": [
|
| 476 |
{
|
|
|
|
| 15 |
"wrong_direction": 419,
|
| 16 |
"wrong_gripper": 419
|
| 17 |
},
|
| 18 |
+
"content_hash": "1aacf9de98648fa36bef14e137eb43c7c6973170804650814dae41d09842c708",
|
| 19 |
"dataset": "/scratch/knguy52/dovla/experiments/six_task_h16_collection",
|
| 20 |
"deployment_candidate_excludes_expert": true,
|
| 21 |
"deployment_clean": false,
|
|
|
|
| 459 |
"num_groups_scanned": 2873,
|
| 460 |
"num_groups_skipped_by_split": 2454,
|
| 461 |
"num_rows": 6704,
|
| 462 |
+
"object_embedding_content_hash": "411ee7d4c96458879f14fc9460c0e10d5309d83aacd5552c6bcbe089e81838bc",
|
| 463 |
+
"object_embedding_manifest": {
|
| 464 |
+
"dataset": "embeddings",
|
| 465 |
+
"dim": 64,
|
| 466 |
+
"extractor": "rgb_object_layout_v1",
|
| 467 |
+
"num_embeddings": 419,
|
| 468 |
+
"path": "object_embeddings_rgb_layout.npz",
|
| 469 |
+
"reads_outcomes": false
|
| 470 |
+
},
|
| 471 |
"observation_embedding_manifest": {
|
| 472 |
"dataset": "embeddings",
|
| 473 |
"dim": 32,
|
|
|
|
| 479 |
"retrieval_index_allowed": false,
|
| 480 |
"schema_version": 1,
|
| 481 |
"shard_content_hashes": {
|
| 482 |
+
"charts_00000.npz": "6f6ea9dd2f6809cbed119598842a1dd6baaf5db099587a2748a00264aafae4e8"
|
| 483 |
},
|
| 484 |
"shards": [
|
| 485 |
{
|