pabbelt commited on
Commit
094f1c9
·
verified ·
1 Parent(s): e7dd07c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -7
Dockerfile CHANGED
@@ -6,7 +6,16 @@ ENV DEBIAN_FRONTEND=noninteractive \
6
  CUDA_HOME=/usr/local/cuda \
7
  FORCE_CUDA=1 \
8
  TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;8.9" \
9
- CMAKE_BUILD_PARALLEL_LEVEL=8
 
 
 
 
 
 
 
 
 
10
 
11
  # Python 3.11 + headers + toolchain + Cairo dev
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -16,8 +25,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
16
  libcairo2-dev libpango1.0-dev libffi-dev \
17
  && rm -rf /var/lib/apt/lists/* && git lfs install \
18
  && ln -sf /usr/bin/python3.11 /usr/bin/python \
19
- && python -m pip install -U pip wheel setuptools packaging pybind11 \
20
- && python -m pip install -U psutil
 
21
 
22
  WORKDIR /app
23
  COPY requirements.txt /app/requirements.txt
@@ -26,16 +36,16 @@ COPY requirements.txt /app/requirements.txt
26
  RUN pip install --index-url https://download.pytorch.org/whl/cu121 \
27
  torch==2.5.1 torchvision==0.20.1
28
 
29
- # 2) flash-attn against existing Torch/CUDA (needs psutil present)
30
  RUN pip install --no-build-isolation --no-cache-dir flash-attn==2.7.3
31
 
32
- # 3) Pre-install Cairo Python wheels (avoid building pycairo)
33
  RUN pip install --no-cache-dir pycairo==1.26.0 rlpycairo==0.4.0 svglib==1.6.0
34
 
35
- # 4) Rest of deps (no torch here)
36
  RUN pip install --no-cache-dir -r requirements.txt
37
 
38
- # 5) StarVector package last
39
  RUN pip install --no-cache-dir git+https://github.com/joanrod/star-vector.git@main
40
 
41
  # 6) App code
 
6
  CUDA_HOME=/usr/local/cuda \
7
  FORCE_CUDA=1 \
8
  TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;8.9" \
9
+ CMAKE_BUILD_PARALLEL_LEVEL=8 \
10
+ # ✅ make all caches writable (fixes PermissionError: '/.cache')
11
+ HF_HOME=/tmp/hf \
12
+ HUGGINGFACE_HUB_CACHE=/tmp/hf/hub \
13
+ TRANSFORMERS_CACHE=/tmp/hf/transformers \
14
+ XDG_CACHE_HOME=/tmp/.cache \
15
+ MPLCONFIGDIR=/tmp/mpl \
16
+ # ✅ silence tokenizer/OMP warnings
17
+ TOKENIZERS_PARALLELISM=false \
18
+ OMP_NUM_THREADS=1
19
 
20
  # Python 3.11 + headers + toolchain + Cairo dev
21
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
25
  libcairo2-dev libpango1.0-dev libffi-dev \
26
  && rm -rf /var/lib/apt/lists/* && git lfs install \
27
  && ln -sf /usr/bin/python3.11 /usr/bin/python \
28
+ && python -m pip install -U pip wheel setuptools packaging pybind11 psutil \
29
+ && mkdir -p /tmp/hf/hub /tmp/hf/transformers /tmp/.cache /tmp/mpl \
30
+ && chmod -R 777 /tmp
31
 
32
  WORKDIR /app
33
  COPY requirements.txt /app/requirements.txt
 
36
  RUN pip install --index-url https://download.pytorch.org/whl/cu121 \
37
  torch==2.5.1 torchvision==0.20.1
38
 
39
+ # 2) flash-attn (needs Torch, CUDA toolchain, psutil)
40
  RUN pip install --no-build-isolation --no-cache-dir flash-attn==2.7.3
41
 
42
+ # 3) Cairo wheels to avoid pycairo source builds
43
  RUN pip install --no-cache-dir pycairo==1.26.0 rlpycairo==0.4.0 svglib==1.6.0
44
 
45
+ # 4) Remaining deps (no torch here)
46
  RUN pip install --no-cache-dir -r requirements.txt
47
 
48
+ # 5) StarVector package
49
  RUN pip install --no-cache-dir git+https://github.com/joanrod/star-vector.git@main
50
 
51
  # 6) App code