mekosotto commited on
Commit
04a1131
·
1 Parent(s): c00e850

fix(docker): install CPU-only torch to avoid 2GB NVIDIA CUDA wheels in HF Space build

Browse files
Files changed (2) hide show
  1. Dockerfile +7 -1
  2. Dockerfile.hf +7 -1
Dockerfile CHANGED
@@ -23,8 +23,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
23
  WORKDIR /app
24
 
25
  # --- Python deps ---
 
 
 
 
26
  COPY requirements.txt ./
27
- RUN pip install -r requirements.txt
 
 
28
 
29
  # --- project source ---
30
  COPY src/ ./src/
 
23
  WORKDIR /app
24
 
25
  # --- Python deps ---
26
+ # Install CPU-only torch first to avoid pulling ~2GB of NVIDIA CUDA wheels
27
+ # (cublas/cudnn/nccl/...) that we never use on a CPU-only HF Space and which
28
+ # blow past the build-time disk budget. Subsequent pip install -r sees torch
29
+ # already at the pinned version and skips it.
30
  COPY requirements.txt ./
31
+ RUN pip install --index-url https://download.pytorch.org/whl/cpu \
32
+ torch==2.4.1 torchvision==0.19.1 \
33
+ && pip install -r requirements.txt
34
 
35
  # --- project source ---
36
  COPY src/ ./src/
Dockerfile.hf CHANGED
@@ -23,8 +23,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
23
  WORKDIR /app
24
 
25
  # --- Python deps ---
 
 
 
 
26
  COPY requirements.txt ./
27
- RUN pip install -r requirements.txt
 
 
28
 
29
  # --- project source ---
30
  COPY src/ ./src/
 
23
  WORKDIR /app
24
 
25
  # --- Python deps ---
26
+ # Install CPU-only torch first to avoid pulling ~2GB of NVIDIA CUDA wheels
27
+ # (cublas/cudnn/nccl/...) that we never use on a CPU-only HF Space and which
28
+ # blow past the build-time disk budget. Subsequent pip install -r sees torch
29
+ # already at the pinned version and skips it.
30
  COPY requirements.txt ./
31
+ RUN pip install --index-url https://download.pytorch.org/whl/cpu \
32
+ torch==2.4.1 torchvision==0.19.1 \
33
+ && pip install -r requirements.txt
34
 
35
  # --- project source ---
36
  COPY src/ ./src/