Juna190825 commited on
Commit
bba5e4f
·
verified ·
1 Parent(s): 6edd395

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -17
Dockerfile CHANGED
@@ -1,20 +1,24 @@
1
 
2
- FROM huggingface/transformers-pytorch-gpu:latest
3
 
4
- # Install with backoff-retry for robustness
5
- RUN pip install --no-cache-dir \
6
- gradio \
7
- torch \
8
- transformers \
9
- sentencepiece \
10
- accelerate \
11
- huggingface-hub \
12
- datasets \
13
- tenacity \
14
- safetensors
15
 
16
- # Avoids installing GPU-specific builds that won’t work in CPU-only environments.
17
- RUN pip install --no-cache-dir torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
 
 
 
 
 
 
 
 
 
18
 
19
  # Configure cache
20
  ENV TRANSFORMERS_CACHE="/cache/models"
@@ -24,7 +28,4 @@ RUN mkdir -p /cache/models /cache/datasets
24
  WORKDIR /app
25
  COPY . /app
26
 
27
- # Pre-cache during build (optional)
28
- # RUN python cache_to_repo.py
29
-
30
  CMD ["python", "app.py"]
 
1
 
2
+ FROM python:3.9-slim # Lightweight CPU-only base
3
 
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ git \
7
+ gcc \
8
+ g++ \
9
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
10
 
11
+ # Install Python packages (CPU-only versions)
12
+ RUN pip install --no-cache-dir \
13
+ torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html \
14
+ transformers==4.36.0 \
15
+ sentencepiece==0.2.0 \
16
+ accelerate==0.25.0 \
17
+ huggingface-hub==0.19.4 \
18
+ gradio==3.50.2 \
19
+ datasets==2.15.0 \
20
+ safetensors==0.4.1 \
21
+ tenacity==8.2.3 # Explicitly added with version
22
 
23
  # Configure cache
24
  ENV TRANSFORMERS_CACHE="/cache/models"
 
28
  WORKDIR /app
29
  COPY . /app
30
 
 
 
 
31
  CMD ["python", "app.py"]