Spaces:
Running
Running
Jaiwincr7
commited on
Commit
·
43dce44
1
Parent(s):
00f4b6f
FINAL FIX: Updated Dockerfile for explicit PyTorch/Accelerate installation and trimmed requirements.txt
Browse files- Dockerfile +13 -11
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Use a Debian-based Python image. This is
|
| 2 |
FROM python:3.10
|
| 3 |
|
| 4 |
# Set the working directory
|
|
@@ -7,28 +7,30 @@ WORKDIR /app
|
|
| 7 |
# Expose the port Streamlit runs on
|
| 8 |
EXPOSE 8501
|
| 9 |
|
| 10 |
-
# Copy the requirements file and
|
| 11 |
COPY requirements.txt .
|
| 12 |
COPY main.py .
|
| 13 |
COPY merged.py .
|
| 14 |
COPY app.py .
|
| 15 |
|
| 16 |
-
# ---
|
| 17 |
|
| 18 |
# 1. Upgrade pip for stability
|
| 19 |
RUN pip install --upgrade pip
|
| 20 |
|
| 21 |
-
# 2. Install
|
| 22 |
-
# This
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
# 3. Install the
|
| 28 |
-
# The original requirements.txt (excluding torch)
|
| 29 |
RUN pip install -r requirements.txt
|
| 30 |
|
| 31 |
-
# --- END
|
| 32 |
|
| 33 |
# Command to run the Streamlit application
|
| 34 |
CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
|
|
|
|
| 1 |
+
# Use a Debian-based Python image. This is robust for complex scientific libraries.
|
| 2 |
FROM python:3.10
|
| 3 |
|
| 4 |
# Set the working directory
|
|
|
|
| 7 |
# Expose the port Streamlit runs on
|
| 8 |
EXPOSE 8501
|
| 9 |
|
| 10 |
+
# Copy the requirements file and application code
|
| 11 |
COPY requirements.txt .
|
| 12 |
COPY main.py .
|
| 13 |
COPY merged.py .
|
| 14 |
COPY app.py .
|
| 15 |
|
| 16 |
+
# --- ROBUST DEPENDENCY INSTALLATION ---
|
| 17 |
|
| 18 |
# 1. Upgrade pip for stability
|
| 19 |
RUN pip install --upgrade pip
|
| 20 |
|
| 21 |
+
# 2. Install complex, device-dependent packages explicitly for CPU.
|
| 22 |
+
# This ensures that PyTorch, Accelerate, and core Hugging Face libraries
|
| 23 |
+
# are correctly linked and installed before other dependencies.
|
| 24 |
+
RUN pip install \
|
| 25 |
+
torch --index-url https://download.pytorch.org/whl/cpu \
|
| 26 |
+
accelerate \
|
| 27 |
+
transformers \
|
| 28 |
+
huggingface-hub
|
| 29 |
|
| 30 |
+
# 3. Install the remaining dependencies from the trimmed requirements.txt
|
|
|
|
| 31 |
RUN pip install -r requirements.txt
|
| 32 |
|
| 33 |
+
# --- END INSTALLATION ---
|
| 34 |
|
| 35 |
# Command to run the Streamlit application
|
| 36 |
CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
|