Sync docker to dataset volume
Browse files
docker/Dockerfile.l4
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1.7
|
| 2 |
+
# ZOMBIE-WEIGHTS L4 image: two isolated uv/Python-3.12 environments sharing one HF cache.
|
| 3 |
+
#
|
| 4 |
+
# /opt/venv_core torch 2.13 (from base), transformers <5.22, trl <1.15,
|
| 5 |
+
# transformer-lens==3.8.0, bnb, CuratorKIT, CircuitKIT,
|
| 6 |
+
# SafeTune, AuditKIT — NO torchao
|
| 7 |
+
# /opt/venv_aligntune aligntune 0.1.35, trl==1.7.1, torchao 0.18, torchvision 0.28
|
| 8 |
+
#
|
| 9 |
+
# Build:
|
| 10 |
+
# docker build -f docker/Dockerfile.l4 -t ghcr.io/divyanshu-kumar14/zombie-weights-l4:latest .
|
| 11 |
+
FROM pytorch/pytorch:2.13.0-cuda12.6-cudnn9-runtime
|
| 12 |
+
|
| 13 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 14 |
+
HF_HOME=/root/.cache/huggingface \
|
| 15 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 \
|
| 16 |
+
PYTHONUNBUFFERED=1 \
|
| 17 |
+
TOKENIZERS_PARALLELISM=false \
|
| 18 |
+
ALIGNTUNE_ENABLE_VLLM=0 \
|
| 19 |
+
UV_LINK_MODE=copy
|
| 20 |
+
|
| 21 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 22 |
+
git curl ca-certificates build-essential \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# uv (pinned standalone binary; avoids PEP 668 system-pip restrictions)
|
| 26 |
+
COPY --from=ghcr.io/astral-sh/uv:0.12.17 /uv /usr/local/bin/uv
|
| 27 |
+
|
| 28 |
+
# ---------------------------------------------------------------------------
|
| 29 |
+
# Core environment (base image Python 3.12.3 + system torch 2.13.0)
|
| 30 |
+
# uv creates the venv; pip resolves against system-site-packages so torch is
|
| 31 |
+
# reused instead of downloading a second CUDA stack.
|
| 32 |
+
# ---------------------------------------------------------------------------
|
| 33 |
+
RUN uv venv --system-site-packages --seed /opt/venv_core
|
| 34 |
+
RUN /opt/venv_core/bin/pip install --no-cache-dir \
|
| 35 |
+
"transformers>=5.15,<5.22" \
|
| 36 |
+
"trl>=0.12,<1.15" \
|
| 37 |
+
"peft>=0.18,<1" \
|
| 38 |
+
"huggingface-hub>=1.5,<2" \
|
| 39 |
+
"transformer-lens==3.8.0" \
|
| 40 |
+
"bitsandbytes>=0.41" \
|
| 41 |
+
"datasets>=3.0" \
|
| 42 |
+
"accelerate>=1.4" \
|
| 43 |
+
"sentencepiece" \
|
| 44 |
+
"protobuf" \
|
| 45 |
+
"scikit-learn" \
|
| 46 |
+
"hf_transfer" \
|
| 47 |
+
"curatorkit[hf,connectors]" \
|
| 48 |
+
"circuitkit==0.2.3" \
|
| 49 |
+
"safetune==0.1.18" \
|
| 50 |
+
"auditkit==1.1.11"
|
| 51 |
+
|
| 52 |
+
# ---------------------------------------------------------------------------
|
| 53 |
+
# AlignTune environment (isolated; torchao only lives here)
|
| 54 |
+
# ---------------------------------------------------------------------------
|
| 55 |
+
RUN uv venv --system-site-packages --seed /opt/venv_aligntune
|
| 56 |
+
RUN /opt/venv_aligntune/bin/pip install --no-cache-dir \
|
| 57 |
+
"torchvision==0.28.0" \
|
| 58 |
+
"transformers>=5.15,<5.22" \
|
| 59 |
+
"peft>=0.18,<1" \
|
| 60 |
+
"datasets>=4.7.0" \
|
| 61 |
+
"accelerate>=1.6" \
|
| 62 |
+
"trl==1.7.1" \
|
| 63 |
+
"torchao==0.18.0" \
|
| 64 |
+
"aligntune==0.1.35"
|
| 65 |
+
|
| 66 |
+
# ---------------------------------------------------------------------------
|
| 67 |
+
# Project code + hard import gates
|
| 68 |
+
# ---------------------------------------------------------------------------
|
| 69 |
+
COPY docker/verify_imports.py /opt/zombie-weights/docker/verify_imports.py
|
| 70 |
+
COPY src/ /opt/zombie-weights/src/
|
| 71 |
+
COPY scripts/ /opt/zombie-weights/scripts/
|
| 72 |
+
|
| 73 |
+
RUN /opt/venv_core/bin/python /opt/zombie-weights/docker/verify_imports.py core \
|
| 74 |
+
&& /opt/venv_aligntune/bin/python /opt/zombie-weights/docker/verify_imports.py aligntune
|
| 75 |
+
|
| 76 |
+
WORKDIR /opt/zombie-weights
|
| 77 |
+
CMD ["bash"]
|
docker/__pycache__/verify_imports.cpython-312.pyc
ADDED
|
Binary file (3.94 kB). View file
|
|
|
docker/verify_imports.py
CHANGED
|
@@ -21,6 +21,7 @@ def _version(mod: str) -> str:
|
|
| 21 |
|
| 22 |
|
| 23 |
def check_core() -> dict:
|
|
|
|
| 24 |
import torch
|
| 25 |
import transformers
|
| 26 |
import trl
|
|
@@ -28,7 +29,6 @@ def check_core() -> dict:
|
|
| 28 |
import huggingface_hub
|
| 29 |
import transformer_lens
|
| 30 |
import curatorkit
|
| 31 |
-
import circuitkit
|
| 32 |
import safetune
|
| 33 |
import auditkit
|
| 34 |
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def check_core() -> dict:
|
| 24 |
+
import circuitkit # must be imported before transformer_lens to install Cohere/Gemma patches
|
| 25 |
import torch
|
| 26 |
import transformers
|
| 27 |
import trl
|
|
|
|
| 29 |
import huggingface_hub
|
| 30 |
import transformer_lens
|
| 31 |
import curatorkit
|
|
|
|
| 32 |
import safetune
|
| 33 |
import auditkit
|
| 34 |
|