-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
19 lines (15 loc) · 1.16 KB
/
Copy pathDockerfile
File metadata and controls
19 lines (15 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Compass serving image. Weights are downloaded at build time so the container needs no network and no credentials at run time.
FROM pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime
ENV HF_HOME=/opt/hf HF_HUB_OFFLINE=0 PYTHONUNBUFFERED=1
WORKDIR /app
COPY pyproject.toml README.md ./
COPY compass ./compass
COPY release ./release
RUN pip install --no-cache-dir . huggingface_hub \
&& (pip install --no-cache-dir flash-linear-attention || echo "flash-linear-attention unavailable; the reference PyTorch path is used") \
&& (pip install --no-cache-dir causal-conv1d || true)
# Pin the backbone at the recorded revision and bake it into the image.
RUN --mount=type=secret,id=hf_token,required=false sh -c '[ -f /run/secrets/hf_token ] && export HF_TOKEN=$(cat /run/secrets/hf_token); python -c "import compass.release as r; from huggingface_hub import snapshot_download; snapshot_download(r.BACKBONE, revision=r.BACKBONE_REVISION, ignore_patterns=[\"*.png\"]); snapshot_download(r.ADAPTER, revision=r.ADAPTER_REVISION)"'
ENV HF_HUB_OFFLINE=1
EXPOSE 8000
CMD ["python", "-m", "compass.server", "--host", "0.0.0.0", "--port", "8000", "--calibration", "release/calibration.json"]