pepijn223 HF Staff commited on
Commit
c83d887
·
verified ·
1 Parent(s): ed5344e

Record native hand stage timings and private failure diagnostics

Browse files
Files changed (2) hide show
  1. flora-worker-image.json +2 -2
  2. studio_runtime.py +59 -3
flora-worker-image.json CHANGED
@@ -30,7 +30,7 @@
30
  "flora_acceleration.py": "782a49a896bfe90d5ca4853ee963287dd861a87f09e28bc52efaecca3cdaeaa6",
31
  "flora_batcher.py": "38e03e2032af8d5f3ed34980cc4d89927fe70c9742aa2ce13f4d0ccdd6fba727",
32
  "flora_speed_entry.py": "192b18d75b9d876c2a65d88de340c8cea7c8da90543d0510b5ee6865d123d524",
33
- "studio_runtime.py": "c09750c69802cff6b65f3b2a2a3eaa941dabd7d7d44b35767e2ffef025d6e78d",
34
  "pipeline-version.json": "4a33b8084deff000f31d10ab5a5937153625fd87c3982758c874b6075f64e1f2",
35
  "flora_vision.py": "a5a4231abf7b615164c40986df5f87047f745a23c55d86385d88f2a09e70f1e8"
36
  },
@@ -81,7 +81,7 @@
81
  "studio_runtime.py": {
82
  "non_hand_ast_sha256": "5e54e9154333a1a2949b1bd3fdd2a684633f75ef74878adec55724863eced9a7",
83
  "accepted_source_sha256": "58ea7ba2e09d102b17c4eb8665dab0ea73442c7e1c63b0ecaf005c9a21e619aa",
84
- "integrated_source_sha256": "c09750c69802cff6b65f3b2a2a3eaa941dabd7d7d44b35767e2ffef025d6e78d"
85
  },
86
  "subset.py": {
87
  "non_hand_ast_sha256": "7a8c6a1f424438ccca92aebf708850a2ba83d44296af35fea59f5e9178eef1d5",
 
30
  "flora_acceleration.py": "782a49a896bfe90d5ca4853ee963287dd861a87f09e28bc52efaecca3cdaeaa6",
31
  "flora_batcher.py": "38e03e2032af8d5f3ed34980cc4d89927fe70c9742aa2ce13f4d0ccdd6fba727",
32
  "flora_speed_entry.py": "192b18d75b9d876c2a65d88de340c8cea7c8da90543d0510b5ee6865d123d524",
33
+ "studio_runtime.py": "a0a248d2956379478d94f3f22dcf59379f0811b19ff59c8b8caf79b4f6b949cb",
34
  "pipeline-version.json": "4a33b8084deff000f31d10ab5a5937153625fd87c3982758c874b6075f64e1f2",
35
  "flora_vision.py": "a5a4231abf7b615164c40986df5f87047f745a23c55d86385d88f2a09e70f1e8"
36
  },
 
81
  "studio_runtime.py": {
82
  "non_hand_ast_sha256": "5e54e9154333a1a2949b1bd3fdd2a684633f75ef74878adec55724863eced9a7",
83
  "accepted_source_sha256": "58ea7ba2e09d102b17c4eb8665dab0ea73442c7e1c63b0ecaf005c9a21e619aa",
84
+ "integrated_source_sha256": "a0a248d2956379478d94f3f22dcf59379f0811b19ff59c8b8caf79b4f6b949cb"
85
  },
86
  "subset.py": {
87
  "non_hand_ast_sha256": "7a8c6a1f424438ccca92aebf708850a2ba83d44296af35fea59f5e9178eef1d5",
studio_runtime.py CHANGED
@@ -78,6 +78,8 @@ class StudioStage:
78
  bundle.unlink()
79
  result = json.loads((directory / "result.json").read_text())
80
  if self.phase == "hands":
 
 
81
  import pyarrow.parquet as pq
82
  from subset import trim_video
83
 
@@ -88,6 +90,14 @@ class StudioStage:
88
  native = directory / "hand-native"
89
  native.mkdir(parents=True, exist_ok=True)
90
  video = native / "episode.mp4"
 
 
 
 
 
 
 
 
91
  trim_video(
92
  root / worker.video_path(row, info, manifest["camera"]),
93
  video,
@@ -96,14 +106,60 @@ class StudioStage:
96
  float(info["fps"]),
97
  lossless=True,
98
  )
99
- native_report = worker.HAND_ANNOTATOR.annotate(
100
- video, manifest["hand_actions"]["calibration"], native / "work",
101
- orientation=manifest["hand_actions"].get("orientation", "sensor")
 
 
 
 
 
 
 
 
102
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  table = pq.read_table(
104
  record.data_path, filters=[("episode_index", "=", record.episode_index)]
105
  )
106
  table, summary = attach_actions(table, native_report, directory=native, fps=info["fps"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  pq.write_table(table, directory / "hand_actions.parquet")
108
  result["hand_actions"] = summary
109
  # Model assets and RGB/prediction caches never enter dataset uploads or checkpoints.
 
78
  bundle.unlink()
79
  result = json.loads((directory / "result.json").read_text())
80
  if self.phase == "hands":
81
+ import time
82
+
83
  import pyarrow.parquet as pq
84
  from subset import trim_video
85
 
 
90
  native = directory / "hand-native"
91
  native.mkdir(parents=True, exist_ok=True)
92
  video = native / "episode.mp4"
93
+ started = time.perf_counter()
94
+ print(
95
+ "HAND_RUNTIME "
96
+ + json.dumps(
97
+ {"event": "episode_video_prepare_start", "source_episode": record.episode_index}
98
+ ),
99
+ flush=True,
100
+ )
101
  trim_video(
102
  root / worker.video_path(row, info, manifest["camera"]),
103
  video,
 
106
  float(info["fps"]),
107
  lossless=True,
108
  )
109
+ prepared = time.perf_counter()
110
+ print(
111
+ "HAND_RUNTIME "
112
+ + json.dumps(
113
+ {
114
+ "event": "native_annotation_start",
115
+ "source_episode": record.episode_index,
116
+ "video_prepare_seconds": prepared - started,
117
+ }
118
+ ),
119
+ flush=True,
120
  )
121
+ try:
122
+ native_report = worker.HAND_ANNOTATOR.annotate(
123
+ video,
124
+ manifest["hand_actions"]["calibration"],
125
+ native / "work",
126
+ orientation=manifest["hand_actions"].get("orientation", "sensor"),
127
+ )
128
+ except Exception:
129
+ # Native inference is offline and has no Hub credentials.
130
+ import logging
131
+
132
+ logging.exception(
133
+ "Native hand annotation failed for source episode %s", record.episode_index
134
+ )
135
+ raise
136
+ inferred = time.perf_counter()
137
  table = pq.read_table(
138
  record.data_path, filters=[("episode_index", "=", record.episode_index)]
139
  )
140
  table, summary = attach_actions(table, native_report, directory=native, fps=info["fps"])
141
+ summary["timing_seconds"] = {
142
+ "source_video_prepare": prepared - started,
143
+ "native_annotation": inferred - prepared,
144
+ "native_scope": "intrinsics, rectification, camera, hands and native export; includes coordinator wait and first-use model initialization; excludes source preparation and final dataset video copying",
145
+ }
146
+ summary["native_components"] = {
147
+ key: native_report[key]
148
+ for key in ("camera_statistics", "hand_components")
149
+ if key in native_report
150
+ }
151
+ print(
152
+ "HAND_RUNTIME "
153
+ + json.dumps(
154
+ {
155
+ "event": "native_annotation_finished",
156
+ "source_episode": record.episode_index,
157
+ "native_seconds": inferred - prepared,
158
+ "valid_frames": summary["valid_frames"],
159
+ }
160
+ ),
161
+ flush=True,
162
+ )
163
  pq.write_table(table, directory / "hand_actions.parquet")
164
  result["hand_actions"] = summary
165
  # Model assets and RGB/prediction caches never enter dataset uploads or checkpoints.