Skip to content

Commit ad70949

Browse files
committed
Add persistent model venv and fix setuptools-scm for tarballs
- Persistent venv at /opt/model-venv with torch + vLLM deps pre-cached (mirrors Modal model_image pattern: install vllm for deps, uninstall) - Set SETUPTOOLS_SCM_PRETEND_VERSION for tarball submissions without .git - Pin Python 3.10 in venv, add sccache for CUDA compilation caching
1 parent 57c3166 commit ad70949

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

.github/workflows/nvidia_model_workflow.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
env:
2121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222
GITHUB_REPOSITORY: ${{ github.repository }}
23+
# Persistent venv with torch + vLLM deps (survives across runs).
24+
# Bootstrap once, then reuse. The user's vLLM fork is installed fresh each run.
25+
MODEL_VENV: /opt/model-venv
2326
steps:
2427
- uses: actions/checkout@v3
2528

@@ -39,17 +42,40 @@ jobs:
3942
- name: Install uv
4043
uses: astral-sh/setup-uv@v4
4144

42-
- name: Setup Virtual Environment and Install Dependencies
45+
- name: Setup persistent model venv
46+
shell: bash
47+
run: |
48+
# Create persistent venv if it doesn't exist, with torch + vLLM deps pre-installed.
49+
# Mirrors the Modal model_image: install vllm to get all deps, then uninstall vllm.
50+
if [ ! -f "$MODEL_VENV/bin/activate" ]; then
51+
echo "Bootstrapping persistent model venv..."
52+
uv venv "$MODEL_VENV" --python 3.10
53+
export VIRTUAL_ENV="$MODEL_VENV"
54+
export PATH="$MODEL_VENV/bin:$PATH"
55+
uv pip install torch==2.9.1 --index-url https://download.pytorch.org/whl/cu130
56+
uv pip install numpy transformers tokenizers huggingface_hub ray \
57+
uvicorn fastapi pydantic aiohttp requests packaging ninja wheel sccache
58+
uv pip install vllm && uv pip uninstall vllm
59+
echo "Persistent model venv bootstrapped."
60+
else
61+
echo "Reusing existing persistent model venv."
62+
fi
63+
64+
# Activate for subsequent steps
65+
echo "VIRTUAL_ENV=$MODEL_VENV" >> $GITHUB_ENV
66+
echo "$MODEL_VENV/bin" >> $GITHUB_PATH
67+
68+
- name: Install kernelbot
4369
shell: bash
4470
run: |
45-
uv venv .venv
46-
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
47-
echo "$PWD/.venv/bin" >> $GITHUB_PATH
4871
uv pip install -r "requirements-dev.txt"
4972
uv pip install -e .
5073
5174
- name: Run model benchmark
5275
shell: bash
76+
env:
77+
SETUPTOOLS_SCM_PRETEND_VERSION: "0.0.1.dev0"
78+
SCCACHE_DIR: /opt/sccache
5379
run: |
5480
python3 src/runners/github-runner.py
5581

src/libkernelbot/run_eval.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,11 +932,15 @@ def _validate_archive_member(name: str, dest_dir: str) -> None:
932932
import shutil
933933

934934
pip_cmd = ["uv", "pip", "install", "-e", pkg_dir] if shutil.which("uv") else ["pip", "install", "-e", pkg_dir]
935+
env = os.environ.copy()
936+
# Allow building from tarballs without .git metadata
937+
env.setdefault("SETUPTOOLS_SCM_PRETEND_VERSION", "0.0.1.dev0")
935938
result = subprocess.run(
936939
pip_cmd,
937940
capture_output=True,
938941
text=True,
939942
timeout=install_timeout,
943+
env=env,
940944
)
941945

942946
return result.returncode == 0, _limit_length(result.stdout), _limit_length(result.stderr)

0 commit comments

Comments
 (0)