| 1 | FROM docker.io/nvidia/cuda@sha256:995e80db6d0c3a53d56bd00bba48a0ebd633b67b99a57e16acf9a306e7c744a7 |
| 2 | |
| 3 | ENV DEBIAN_FRONTEND=noninteractive PIP_NO_CACHE_DIR=1 PYTHONUNBUFFERED=1 |
| 4 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 5 | python3.12 python3.12-venv python3.12-dev \ |
| 6 | cuda-nvcc-13-0 cuda-cudart-dev-13-0 libcurand-dev-13-0 \ |
| 7 | build-essential patch curl ca-certificates \ |
| 8 | && rm -rf /var/lib/apt/lists/* |
| 9 | WORKDIR /app |
| 10 | RUN python3.12 -c 'import hashlib,urllib.request; data=urllib.request.urlopen("https://api.github.com/repos/syv-ai/HyperQwen/tarball/253c76aea0a240bf7cb2bd3ed92b672c0f258d0d").read(); assert hashlib.sha256(data).hexdigest()=="29b40ee9c371066e0194d23bcd35b08d4b6ec3efecd5799d02475fbbf6b032e3"; open("source.tar.gz","wb").write(data)' \ |
| 11 | && tar -xzf source.tar.gz --strip-components=1 && rm source.tar.gz |
| 12 | RUN python3.12 -m venv venv && venv/bin/pip install --upgrade pip \ |
| 13 | && venv/bin/pip install -r docker/requirements.txt torch==2.13.0 \ |
| 14 | safetensors==0.8.0 flashinfer-python==0.6.16.post3 flashinfer-cubin==0.6.13 \ |
| 15 | && venv/bin/pip check |
| 16 | COPY download.py models.json /tmp/model-source/ |
| 17 | RUN python3.12 /tmp/model-source/download.py --runtime-only --root /tmp/runtime \ |
| 18 | && MODEL_DIR=$(python3.12 -c 'import json; print(json.load(open("/tmp/model-source/models.json"))["directory"])') \ |
| 19 | && test "$(cat /tmp/runtime/$MODEL_DIR/runtime/BASE_REVISION.txt)" = 253c76aea0a240bf7cb2bd3ed92b672c0f258d0d \ |
| 20 | && rm patches/*.patch \ |
| 21 | && cp /tmp/runtime/$MODEL_DIR/runtime/patches/*.patch patches/ \ |
| 22 | && cp /tmp/runtime/$MODEL_DIR/runtime/single-user/start_qwen.sh single-user/start_qwen.sh \ |
| 23 | && rm -rf /tmp/runtime /tmp/model-source |
| 24 | RUN set -e; SP=$(venv/bin/python -c 'import vllm,os; print(os.path.dirname(vllm.__file__))' | tail -n1); \ |
| 25 | for p in patches/*.patch; do patch --batch -p1 -d "$SP" < "$p"; done; \ |
| 26 | bash verify.sh --install |
| 27 | COPY cache /tmp/studio-ai-cache |
| 28 | RUN venv/bin/pip install /tmp/studio-ai-cache && venv/bin/pip check && rm -rf /tmp/studio-ai-cache |
| 29 | ENV HOME=/cache VLLM_NO_USAGE_STATS=1 DO_NOT_TRACK=1 HF_HUB_OFFLINE=1 |
| 30 | RUN mkdir -p /cache && chmod 1777 /cache |