Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +14 -17
Dockerfile
CHANGED
@@ -1,36 +1,33 @@
|
|
1 |
-
|
|
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
ENV TRANSFORMERS_CACHE=/app/cache \
|
5 |
-
HF_HOME=/app/cache
|
|
|
6 |
|
7 |
-
#
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
git \
|
10 |
gcc \
|
11 |
g++ \
|
12 |
make \
|
13 |
-
libopenblas-dev \ # Required for scipy
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
-
#
|
17 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
-
|
22 |
-
torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 \
|
23 |
-
transformers==4.34.0 \
|
24 |
-
peft==0.5.0 \
|
25 |
-
datasets==2.14.0 \
|
26 |
-
accelerate==0.24.0 \
|
27 |
-
bitsandbytes==0.41.0 \
|
28 |
-
huggingface-hub==0.16.4
|
29 |
|
30 |
-
#
|
31 |
ARG HF_TOKEN
|
32 |
RUN python -c "from huggingface_hub import HfFolder; HfFolder.save_token('$HF_TOKEN')"
|
33 |
|
34 |
-
|
|
|
35 |
|
|
|
36 |
CMD ["python", "train.py"]
|
|
|
1 |
+
# Use a more specific Python version
|
2 |
+
FROM python:3.9.16-slim
|
3 |
|
4 |
+
# Set working directory and environment variables
|
5 |
WORKDIR /app
|
6 |
ENV TRANSFORMERS_CACHE=/app/cache \
|
7 |
+
HF_HOME=/app/cache \
|
8 |
+
PYTHONUNBUFFERED=1
|
9 |
|
10 |
+
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
12 |
git \
|
13 |
gcc \
|
14 |
g++ \
|
15 |
make \
|
|
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
+
# Create writable cache directory
|
19 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
20 |
|
21 |
+
# Install Python packages using a requirements.txt file
|
22 |
+
COPY requirements.txt.
|
23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# Authenticate with Hugging Face
|
26 |
ARG HF_TOKEN
|
27 |
RUN python -c "from huggingface_hub import HfFolder; HfFolder.save_token('$HF_TOKEN')"
|
28 |
|
29 |
+
# Copy train.py file
|
30 |
+
COPY train.py.
|
31 |
|
32 |
+
# Set command to run train.py
|
33 |
CMD ["python", "train.py"]
|