VladKha commited on
Commit
bc06e60
·
verified ·
1 Parent(s): 3bb3160

public base image (hf-image-vllm)

Browse files
Files changed (4) hide show
  1. Dockerfile +12 -13
  2. pyproject.toml +2 -2
  3. requirements-extras.txt +2 -0
  4. run-job.sh +12 -9
Dockerfile CHANGED
@@ -1,18 +1,18 @@
1
  # syntax=docker/dockerfile:1.6
2
  # PUBLIC base image for GPU inference jobs (HF Jobs) — vLLM serving variant.
3
  #
4
- # Same contract as demo/image/Dockerfile: ONLY open-source, generic dependencies
5
- # — NO proprietary code, and no names that reveal which models/techniques the
6
- # pipeline uses. The Job's bootstrap (/opt/run-job.sh) pulls the private wheel +
7
- # demo modules + the remaining runtime dependencies at startup and runs run_job.py.
8
  #
9
  # Built FROM vLLM's official OpenAI-server image rather than the llama.cpp
10
  # CUDA-runtime base: vLLM's Triton JIT needs a CUDA build chain + a matched torch
11
  # (gcc/ninja/nvcc are absent from the runtime base). torch therefore comes from the
12
- # base and is omitted from the generated pyproject (JOB_IMAGE_BASE_PROVIDES=torch).
13
  #
14
- # Build: JOB_IMAGE_DIR=image-vllm JOB_IMAGE_BASE_PROVIDES=torch make demo-deploy-job
15
- # (run-job.sh + the dataset_reviewer stub are shared from demo/image/.)
16
 
17
  # Pinned (not :latest) so the serving CLI contract can't shift under a live demo run:
18
  # vLLM 0.12 renamed the structured-outputs backend flag, and this repo's serve argv +
@@ -22,7 +22,7 @@ FROM vllm/vllm-openai:v0.19.1
22
 
23
  # The base image sets ENTRYPOINT to the OpenAI server; reset it so HF Jobs'
24
  # `bash /opt/run-job.sh` (and the idle Space CMD) run as plain commands. The Job
25
- # starts its own server as a co-located subprocess (demo/job/llm_server.py).
26
  ENTRYPOINT []
27
 
28
  ENV DEBIAN_FRONTEND=noninteractive \
@@ -49,11 +49,10 @@ COPY pyproject.toml /app/pyproject.toml
49
  COPY dataset_reviewer /app/dataset_reviewer
50
  RUN --mount=type=cache,target=/root/.cache/pip pip install /app
51
 
52
- # Explicit pins for the bootstrap + demo modules (transitive above, pinned so the
53
- # bootstrap never depends on resolution order). telethon is the Telegram client the
54
- # Job uses to DM a submitter — not a dataset_reviewer dep.
55
- RUN --mount=type=cache,target=/root/.cache/pip \
56
- pip install "huggingface_hub[hf_transfer]" python-dotenv "telethon==1.43.2"
57
 
58
  COPY run-job.sh /opt/run-job.sh
59
  RUN chmod +x /opt/run-job.sh
 
1
  # syntax=docker/dockerfile:1.6
2
  # PUBLIC base image for GPU inference jobs (HF Jobs) — vLLM serving variant.
3
  #
4
+ # Same contract as deploy/hf-image-llama-cpp/Dockerfile: ONLY open-source, generic
5
+ # dependencies — NO proprietary code, and no names that reveal which models/techniques
6
+ # the pipeline uses. The Job's bootstrap (/opt/run-job.sh) pulls the private wheel +
7
+ # job modules + the remaining runtime dependencies at startup and runs run_job.py.
8
  #
9
  # Built FROM vLLM's official OpenAI-server image rather than the llama.cpp
10
  # CUDA-runtime base: vLLM's Triton JIT needs a CUDA build chain + a matched torch
11
  # (gcc/ninja/nvcc are absent from the runtime base). torch therefore comes from the
12
+ # base and is omitted from the generated pyproject (HF_JOB_IMAGE_BASE_PROVIDES=torch).
13
  #
14
+ # Build: HF_JOB_IMAGE_DIR=hf-image-vllm HF_JOB_IMAGE_BASE_PROVIDES=torch make deploy-hf-job
15
+ # (run-job.sh + the dataset_reviewer stub are shared from deploy/hf-image-common/.)
16
 
17
  # Pinned (not :latest) so the serving CLI contract can't shift under a live demo run:
18
  # vLLM 0.12 renamed the structured-outputs backend flag, and this repo's serve argv +
 
22
 
23
  # The base image sets ENTRYPOINT to the OpenAI server; reset it so HF Jobs'
24
  # `bash /opt/run-job.sh` (and the idle Space CMD) run as plain commands. The Job
25
+ # starts its own server as a co-located subprocess (deploy/job/llm_server.py).
26
  ENTRYPOINT []
27
 
28
  ENV DEBIAN_FRONTEND=noninteractive \
 
49
  COPY dataset_reviewer /app/dataset_reviewer
50
  RUN --mount=type=cache,target=/root/.cache/pip pip install /app
51
 
52
+ # Non-library job deps, single-sourced in job_deps.JOB_EXTRA_DEPS deploy_hf_job.py
53
+ # stages the requirements file into this build context.
54
+ COPY requirements-extras.txt /app/requirements-extras.txt
55
+ RUN --mount=type=cache,target=/root/.cache/pip pip install -r /app/requirements-extras.txt
 
56
 
57
  COPY run-job.sh /opt/run-job.sh
58
  RUN chmod +x /opt/run-job.sh
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ version = "0.1.0"
4
  requires-python = ">=3.12"
5
  dependencies = [
6
  "datasets>=5.0.0",
7
- "datatrove[io]>=0.9.0",
8
  "duckdb>=1.4.4",
9
  "ddgs",
10
  "httpx",
@@ -26,7 +26,7 @@ dependencies = [
26
  "langgraph",
27
  "loguru",
28
  "python-dotenv",
29
- "huggingface-hub",
30
  "pandas",
31
  "pytz",
32
  "requests",
 
4
  requires-python = ">=3.12"
5
  dependencies = [
6
  "datasets>=5.0.0",
7
+ "datatrove[io] @ git+https://github.com/huggingface/datatrove.git@a035d36e8a13d22ce04e84b84f30b4ec45f9c48e",
8
  "duckdb>=1.4.4",
9
  "ddgs",
10
  "httpx",
 
26
  "langgraph",
27
  "loguru",
28
  "python-dotenv",
29
+ "huggingface-hub>=1.13,<1.17",
30
  "pandas",
31
  "pytz",
32
  "requests",
requirements-extras.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ huggingface_hub[hf_transfer]
2
+ telethon==1.43.2
run-job.sh CHANGED
@@ -1,20 +1,23 @@
1
  #!/usr/bin/env bash
2
- # HF Job bootstrap: pull the private dataset_reviewer wheel + demo modules +
3
- # runtime requirements from JOB_CODE_REPO (authenticated by HF_TOKEN), install the
4
- # wheel over the baked stub, install the technique-revealing deps kept out of the
5
- # public image, then run the headless pipeline. Each phase is timed so its cost is
6
- # visible in the Job log. Keeps proprietary code + model/technique names OUT of the
7
- # public base image.
8
  set -euo pipefail
9
 
10
- : "${JOB_CODE_REPO:?JOB_CODE_REPO is required}"
 
 
 
11
 
12
  t=$SECONDS
13
- echo "[bootstrap] downloading job code from ${JOB_CODE_REPO}"
14
  python3 - <<'PY'
15
  import os
16
  from huggingface_hub import snapshot_download
17
- snapshot_download(repo_id=os.environ["JOB_CODE_REPO"], repo_type="model", local_dir="/code")
18
  PY
19
  echo "[bootstrap] job code downloaded in $((SECONDS - t))s"
20
 
 
1
  #!/usr/bin/env bash
2
+ # HF Job bootstrap: pull the private dataset_reviewer wheel + job modules +
3
+ # runtime requirements from HF_JOB_CODE_REPO (authenticated by HF_TOKEN), install
4
+ # the wheel over the baked stub, install the technique-revealing deps kept out of
5
+ # the public image, then run the headless pipeline. Each phase is timed so its cost
6
+ # is visible in the Job log. Keeps proprietary code + model/technique names OUT of
7
+ # the public base image.
8
  set -euo pipefail
9
 
10
+ # JOB_CODE_REPO is the pre-rename env name; launchers older than the rename send only it.
11
+ : "${HF_JOB_CODE_REPO:=${JOB_CODE_REPO:-}}"
12
+ : "${HF_JOB_CODE_REPO:?HF_JOB_CODE_REPO is required}"
13
+ export HF_JOB_CODE_REPO
14
 
15
  t=$SECONDS
16
+ echo "[bootstrap] downloading job code from ${HF_JOB_CODE_REPO}"
17
  python3 - <<'PY'
18
  import os
19
  from huggingface_hub import snapshot_download
20
+ snapshot_download(repo_id=os.environ["HF_JOB_CODE_REPO"], repo_type="model", local_dir="/code")
21
  PY
22
  echo "[bootstrap] job code downloaded in $((SECONDS - t))s"
23