Michael Rabinovich Cursor commited on
Commit
3cf13d3
·
1 Parent(s): ce583a4

eval_job: upload interface overlay + link GT/input in hosted report

Browse files

Upload each fixture's interface_overlay.png to the public render bucket
alongside the turntables so every report artifact lands together, and pass
--gt-base-url/--input-base-url to `report single` so the hosted report links
GT/input/overlay (lazy) instead of base64-inlining them. Bump CADGENBENCH_SHA
to 25943a0 (the report generator that understands the new flags).

Co-authored-by: Cursor <cursoragent@cursor.com>

Files changed (2) hide show
  1. Dockerfile +1 -1
  2. eval_job.py +32 -11
Dockerfile CHANGED
@@ -51,7 +51,7 @@ RUN python -m venv "$VIRTUAL_ENV" \
51
  # rebuild picks up the latest evaluator dependencies (including Open3D for
52
  # alignment). Lock to a commit SHA at the v1 release for reproducible scores
53
  # (see space-setup/post-gt-swap.md Stage F).
54
- ARG CADGENBENCH_SHA=3d49822
55
  RUN python -m pip install --no-cache-dir \
56
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
57
 
 
51
  # rebuild picks up the latest evaluator dependencies (including Open3D for
52
  # alignment). Lock to a commit SHA at the v1 release for reproducible scores
53
  # (see space-setup/post-gt-swap.md Stage F).
54
+ ARG CADGENBENCH_SHA=25943a0
55
  RUN python -m pip install --no-cache-dir \
56
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
57
 
eval_job.py CHANGED
@@ -86,6 +86,14 @@ RENDER_BUCKET = os.environ.get(
86
  ).strip()
87
  HF_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co").rstrip("/")
88
 
 
 
 
 
 
 
 
 
89
 
90
  def _render_base_url(submission_id: str) -> str:
91
  """Public ``.../resolve/renders/<id>`` base; report appends ``/<fixture>/<file>``."""
@@ -103,17 +111,23 @@ def _upload_renders_to_bucket(
103
  """
104
  add: list[tuple[str, str]] = []
105
  for fixture_dir in sorted(d for d in run_dir.iterdir() if d.is_dir()):
 
 
 
106
  renders_dir = fixture_dir / "renders"
107
- if not renders_dir.is_dir():
108
- continue
109
- for render_path in sorted(renders_dir.iterdir()):
110
- if render_path.suffix.lower() not in {".png", ".webp"}:
111
- continue
112
- add.append((
113
- str(render_path),
114
- f"{RENDERS_DIR_IN_REPO}/{submission_id}/"
115
- f"{fixture_dir.name}/{render_path.name}",
116
- ))
 
 
 
117
  if not add:
118
  return []
119
  HfApi(token=token).batch_bucket_files(RENDER_BUCKET, add=add, token=token)
@@ -435,7 +449,14 @@ def _run_report(
435
  str(run_dir), "-o", str(html_out),
436
  ]
437
  if render_base_url:
438
- cmd += ["--render-base-url", render_base_url]
 
 
 
 
 
 
 
439
  print(f"[eval_job] {' '.join(cmd)}", flush=True)
440
  proc = subprocess.run(
441
  cmd,
 
86
  ).strip()
87
  HF_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co").rstrip("/")
88
 
89
+ # Space-relative proxy roots the hosted report references for the *private*
90
+ # assets it can't link from the public bucket. The report is served by the
91
+ # Space at ``/reports/<id>.html``, so these absolute-path URLs resolve against
92
+ # the Space origin and the token-holding proxy streams the bytes. Kept in sync
93
+ # with the routes registered in the leaderboard Space's ``app.py``.
94
+ GT_PROXY_BASE_URL = "/gt"
95
+ INPUT_PROXY_BASE_URL = "/task-input"
96
+
97
 
98
  def _render_base_url(submission_id: str) -> str:
99
  """Public ``.../resolve/renders/<id>`` base; report appends ``/<fixture>/<file>``."""
 
111
  """
112
  add: list[tuple[str, str]] = []
113
  for fixture_dir in sorted(d for d in run_dir.iterdir() if d.is_dir()):
114
+ dest_prefix = (
115
+ f"{RENDERS_DIR_IN_REPO}/{submission_id}/{fixture_dir.name}"
116
+ )
117
  renders_dir = fixture_dir / "renders"
118
+ if renders_dir.is_dir():
119
+ for render_path in sorted(renders_dir.iterdir()):
120
+ if render_path.suffix.lower() not in {".png", ".webp"}:
121
+ continue
122
+ add.append((str(render_path), f"{dest_prefix}/{render_path.name}"))
123
+ # The interface overlay is a per-fixture report artifact that lives at
124
+ # the fixture-dir root (not under renders/). It must ride to the bucket
125
+ # alongside the turntables so the hosted report can reference it by URL
126
+ # instead of base64-inlining it; without this the report would have a
127
+ # broken overlay link. Uploaded under the same per-fixture prefix.
128
+ overlay = fixture_dir / "interface_overlay.png"
129
+ if overlay.is_file():
130
+ add.append((str(overlay), f"{dest_prefix}/{overlay.name}"))
131
  if not add:
132
  return []
133
  HfApi(token=token).batch_bucket_files(RENDER_BUCKET, add=add, token=token)
 
449
  str(run_dir), "-o", str(html_out),
450
  ]
451
  if render_base_url:
452
+ cmd += [
453
+ "--render-base-url", render_base_url,
454
+ # GT + inputs are private, so they link through the Space proxy
455
+ # rather than the public bucket. Passed alongside the render base
456
+ # so the whole hosted report is lazy-loaded links, not base64.
457
+ "--gt-base-url", GT_PROXY_BASE_URL,
458
+ "--input-base-url", INPUT_PROXY_BASE_URL,
459
+ ]
460
  print(f"[eval_job] {' '.join(cmd)}", flush=True)
461
  proc = subprocess.run(
462
  cmd,