Michael Rabinovich Cursor commited on
Commit
0626a6b
·
1 Parent(s): c4e21b3

Dockerfile + submit: swap Chromium for VTK; bump eval workers 1 -> 4

Browse files

Pairs with cadgenbench 3fd213d (in-process VTK / PyVista renderer).
Dockerfile drops the playwright install + Chromium browser layer
(~200 MB), drops PLAYWRIGHT_BROWSERS_PATH, and adds the Mesa GL
runtime libs VTK needs for off-screen rendering on the Space's
cpu-upgrade tier (libgl1 was already there; libegl1, libegl-mesa0,
libglx-mesa0 are new). CADGENBENCH_SHA bumps to 3fd213d.

EVAL_WORKER_COUNT goes from "1" back to "4": the VTK renderer is
cheap enough that one ProcessPoolExecutor worker per fixture no
longer oversubscribes the host the way the old Chromium subprocess
did.

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

Files changed (2) hide show
  1. Dockerfile +10 -15
  2. submit.py +6 -8
Dockerfile CHANGED
@@ -14,20 +14,22 @@ FROM python:3.12-slim-bookworm
14
  ENV PYTHONUNBUFFERED=1 \
15
  PYTHONDONTWRITEBYTECODE=1 \
16
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
17
- PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright \
18
  GRADIO_SERVER_NAME=0.0.0.0 \
19
  GRADIO_SERVER_PORT=7860
20
 
21
  # OS deps:
22
  # git, ca-certificates -> pip install from git+https://
23
- # libgl1, libglib2.0-0, libsm6,
24
- # libxext6, libxrender1, -> OCP / build123d / Pillow runtime
25
- # libgomp1, libfontconfig1
26
- # Chromium's own runtime libs are added by `playwright install --with-deps`
27
- # below, so they aren't repeated here.
 
 
28
  RUN apt-get update && apt-get install -y --no-install-recommends \
29
  git ca-certificates \
30
- libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 libfontconfig1 \
 
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
  # Space-side Python deps (gradio, pandas, huggingface_hub, datasets).
@@ -35,16 +37,9 @@ COPY requirements.txt /tmp/requirements.txt
35
  RUN pip install --no-cache-dir -r /tmp/requirements.txt \
36
  && rm /tmp/requirements.txt
37
 
38
- # Playwright + headless Chromium for cadgenbench's STEP -> PNG renderer
39
- # (cadgenbench.common.viewer wraps tcv-screenshots -> playwright). Browsers
40
- # land in /opt/ms-playwright (world-readable) so the non-root runtime user
41
- # below can find them via PLAYWRIGHT_BROWSERS_PATH. ~200 MB layer.
42
- RUN pip install --no-cache-dir playwright \
43
- && playwright install --with-deps chromium
44
-
45
  # cadgenbench from the Public GitHub repo, pinned to a commit. Bumping
46
  # CADGENBENCH_SHA is the one-line path to picking up a new cadgenbench.
47
- ARG CADGENBENCH_SHA=056cfbb
48
  RUN pip install --no-cache-dir \
49
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
50
 
 
14
  ENV PYTHONUNBUFFERED=1 \
15
  PYTHONDONTWRITEBYTECODE=1 \
16
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
 
17
  GRADIO_SERVER_NAME=0.0.0.0 \
18
  GRADIO_SERVER_PORT=7860
19
 
20
  # OS deps:
21
  # git, ca-certificates -> pip install from git+https://
22
+ # libglib2.0-0, libsm6, libxext6,
23
+ # libgomp1, libfontconfig1 -> OCP / build123d / Pillow runtime
24
+ # libgl1, libglx-mesa0, libegl1,
25
+ # libegl-mesa0, libxrender1 -> VTK / PyVista off-screen GL context.
26
+ # The HF Space's cpu-upgrade tier has no GPU; VTK's EGL backend picks up
27
+ # Mesa's software rasteriser (libegl-mesa0) at runtime, no code change.
28
+ # A GPU host gets hardware OpenGL via the same libs.
29
  RUN apt-get update && apt-get install -y --no-install-recommends \
30
  git ca-certificates \
31
+ libglib2.0-0 libsm6 libxext6 libgomp1 libfontconfig1 \
32
+ libgl1 libglx-mesa0 libegl1 libegl-mesa0 libxrender1 \
33
  && rm -rf /var/lib/apt/lists/*
34
 
35
  # Space-side Python deps (gradio, pandas, huggingface_hub, datasets).
 
37
  RUN pip install --no-cache-dir -r /tmp/requirements.txt \
38
  && rm /tmp/requirements.txt
39
 
 
 
 
 
 
 
 
40
  # cadgenbench from the Public GitHub repo, pinned to a commit. Bumping
41
  # CADGENBENCH_SHA is the one-line path to picking up a new cadgenbench.
42
+ ARG CADGENBENCH_SHA=3fd213d
43
  RUN pip install --no-cache-dir \
44
  "cadgenbench @ git+https://github.com/huggingface/cadgenbench.git@${CADGENBENCH_SHA}"
45
 
submit.py CHANGED
@@ -103,14 +103,12 @@ DATA_REV_SHORT_LEN = 12
103
  FAILURE_REASON_MAX_CHARS = 200
104
  EVAL_TIMEOUT_SECONDS = 15 * 60
105
  REPORT_TIMEOUT_SECONDS = 2 * 60
106
- # Per-fixture eval workers. Was "8" (one Python worker per fixture,
107
- # each spawning its own headless-Chromium render subprocess in
108
- # parallel). Concurrent rendering on the Space's cpu-upgrade tier
109
- # oversubscribes the host: 5 simultaneous Chromiums turn 7s renders
110
- # into 120s+ timeouts. Sequential ("1") gives each render the box
111
- # to itself; 5 fixtures finish in ~30-60s wall time. Tracked as a
112
- # follow-up to move off Chromium-based rendering for scale.
113
- EVAL_WORKER_COUNT = "1"
114
  SHA256_BLOCK_SIZE = 64 * 1024
115
  STUCK_PENDING_THRESHOLD_SECONDS = 30 * 60
116
  SUBMITTED_AT_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
 
103
  FAILURE_REASON_MAX_CHARS = 200
104
  EVAL_TIMEOUT_SECONDS = 15 * 60
105
  REPORT_TIMEOUT_SECONDS = 2 * 60
106
+ # Per-fixture eval workers. The in-process VTK renderer (PyVista off-
107
+ # screen via Mesa software EGL on the Space's cpu-upgrade tier) is
108
+ # cheap enough that one ProcessPoolExecutor worker per fixture no
109
+ # longer oversubscribes the host the way the old Chromium subprocess
110
+ # did. "4" matches the cpu-upgrade vCPU count.
111
+ EVAL_WORKER_COUNT = "4"
 
 
112
  SHA256_BLOCK_SIZE = 64 * 1024
113
  STUCK_PENDING_THRESHOLD_SECONDS = 30 * 60
114
  SUBMITTED_AT_FORMAT = "%Y-%m-%dT%H:%M:%SZ"