Michael Rabinovich Cursor commited on
Commit ·
e5ffda5
1
Parent(s): eb7cf51
upload per-fixture iso render for the leaderboard gallery
Browse filesAfter uploading the report bundle, also push renders/<id>/<fixture>.png
(the iso view) per fixture so the gallery has standalone, addressable
thumbnails. Skips fixtures with no iso render (invalid/missing), which
the gallery draws as the dashed cell. The full multi-view renders stay
base64-embedded in reports/<id>.html for the self-contained report.
Co-authored-by: Cursor <cursoragent@cursor.com>
- eval_job.py +60 -0
eval_job.py
CHANGED
|
@@ -54,6 +54,14 @@ EVAL_TIMEOUT_SECONDS = 30 * 60
|
|
| 54 |
REPORT_TIMEOUT_SECONDS = 5 * 60
|
| 55 |
|
| 56 |
REPORTS_DIR_IN_REPO = "reports"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
def main() -> int:
|
|
@@ -94,6 +102,7 @@ def main() -> int:
|
|
| 94 |
_upload_reports(
|
| 95 |
submission_id, html_path, report_json, submissions_repo, token,
|
| 96 |
)
|
|
|
|
| 97 |
print(f"[eval_job] done: {submission_id}", flush=True)
|
| 98 |
return 0
|
| 99 |
|
|
@@ -241,5 +250,56 @@ def _upload_reports(
|
|
| 241 |
)
|
| 242 |
|
| 243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
if __name__ == "__main__":
|
| 245 |
sys.exit(main())
|
|
|
|
| 54 |
REPORT_TIMEOUT_SECONDS = 5 * 60
|
| 55 |
|
| 56 |
REPORTS_DIR_IN_REPO = "reports"
|
| 57 |
+
RENDERS_DIR_IN_REPO = "renders"
|
| 58 |
+
|
| 59 |
+
# Single canonical view uploaded per fixture for the leaderboard
|
| 60 |
+
# gallery thumbnail. "iso" matches the GT render the gallery pairs it
|
| 61 |
+
# with, so the gallery columns stay a comparable matrix at one fixed
|
| 62 |
+
# camera angle. The evaluator writes this at
|
| 63 |
+
# ``<run_dir>/<fixture>/renders/iso.png`` (cadgenbench DEFAULT_VIEWS).
|
| 64 |
+
GALLERY_THUMB_VIEW = "iso"
|
| 65 |
|
| 66 |
|
| 67 |
def main() -> int:
|
|
|
|
| 102 |
_upload_reports(
|
| 103 |
submission_id, html_path, report_json, submissions_repo, token,
|
| 104 |
)
|
| 105 |
+
_upload_gallery_renders(submission_id, RUN_DIR, submissions_repo, token)
|
| 106 |
print(f"[eval_job] done: {submission_id}", flush=True)
|
| 107 |
return 0
|
| 108 |
|
|
|
|
| 250 |
)
|
| 251 |
|
| 252 |
|
| 253 |
+
def _upload_gallery_renders(
|
| 254 |
+
submission_id: str,
|
| 255 |
+
run_dir: Path,
|
| 256 |
+
submissions_repo: str,
|
| 257 |
+
token: str,
|
| 258 |
+
) -> None:
|
| 259 |
+
"""Upload one ``iso`` thumbnail per fixture for the leaderboard gallery.
|
| 260 |
+
|
| 261 |
+
Stages every ``<run_dir>/<fixture>/renders/iso.png`` as
|
| 262 |
+
``renders/<id>/<fixture>.png`` in the submissions dataset (one
|
| 263 |
+
commit). These are the standalone PNGs the gallery's
|
| 264 |
+
``renderFor()`` points at; the full multi-view renders stay
|
| 265 |
+
base64-embedded in ``reports/<id>.html`` for the self-contained
|
| 266 |
+
report. A fixture with no ``iso.png`` (missing output, or a render
|
| 267 |
+
that never ran) is simply skipped, the gallery reads the
|
| 268 |
+
per-fixture status from the row and draws the dashed "invalid
|
| 269 |
+
generation" cell, so a thumbnail's absence is not an error.
|
| 270 |
+
"""
|
| 271 |
+
staged: list[tuple[Path, str]] = []
|
| 272 |
+
for fixture_dir in sorted(d for d in run_dir.iterdir() if d.is_dir()):
|
| 273 |
+
iso_png = fixture_dir / "renders" / f"{GALLERY_THUMB_VIEW}.png"
|
| 274 |
+
if iso_png.is_file():
|
| 275 |
+
staged.append((iso_png, fixture_dir.name))
|
| 276 |
+
|
| 277 |
+
if not staged:
|
| 278 |
+
print(
|
| 279 |
+
f"[eval_job] no gallery renders to upload for {submission_id}",
|
| 280 |
+
flush=True,
|
| 281 |
+
)
|
| 282 |
+
return
|
| 283 |
+
|
| 284 |
+
api = HfApi(token=token)
|
| 285 |
+
for iso_png, fixture_name in staged:
|
| 286 |
+
api.upload_file(
|
| 287 |
+
path_or_fileobj=str(iso_png),
|
| 288 |
+
path_in_repo=(
|
| 289 |
+
f"{RENDERS_DIR_IN_REPO}/{submission_id}/{fixture_name}.png"
|
| 290 |
+
),
|
| 291 |
+
repo_id=submissions_repo,
|
| 292 |
+
repo_type="dataset",
|
| 293 |
+
commit_message=(
|
| 294 |
+
f"add gallery render {fixture_name} for {submission_id}"
|
| 295 |
+
),
|
| 296 |
+
)
|
| 297 |
+
print(
|
| 298 |
+
f"[eval_job] uploaded {len(staged)} gallery render(s) under "
|
| 299 |
+
f"{RENDERS_DIR_IN_REPO}/{submission_id}/",
|
| 300 |
+
flush=True,
|
| 301 |
+
)
|
| 302 |
+
|
| 303 |
+
|
| 304 |
if __name__ == "__main__":
|
| 305 |
sys.exit(main())
|