Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- Dockerfile +13 -2
- requirements.txt +0 -1
Dockerfile
CHANGED
|
@@ -8,9 +8,20 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
curl \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# Install Python dependencies
|
| 12 |
COPY requirements.txt .
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Copy application code
|
| 16 |
COPY . .
|
|
|
|
| 8 |
curl \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Install Python dependencies in layers to optimize caching and avoid timeouts
|
| 12 |
COPY requirements.txt .
|
| 13 |
+
|
| 14 |
+
# 1. Install core dependencies
|
| 15 |
+
RUN pip install --no-cache-dir fastapi uvicorn pydantic-settings python-multipart pypdf python-docx
|
| 16 |
+
|
| 17 |
+
# 2. Install ML/RAG dependencies (Large)
|
| 18 |
+
RUN pip install --no-cache-dir langchain langchain-community langchain-huggingface chromadb huggingface-hub
|
| 19 |
+
|
| 20 |
+
# 3. Install Torch and Transformers (Very Large)
|
| 21 |
+
RUN pip install --no-cache-dir torch transformers accelerate bitsandbytes
|
| 22 |
+
|
| 23 |
+
# 4. Install llama-cpp-python using pre-built CPU wheels to avoid compilation timeout
|
| 24 |
+
RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/wheels/cpu
|
| 25 |
|
| 26 |
# Copy application code
|
| 27 |
COPY . .
|
requirements.txt
CHANGED
|
@@ -12,5 +12,4 @@ transformers
|
|
| 12 |
bitsandbytes
|
| 13 |
accelerate
|
| 14 |
torch
|
| 15 |
-
llama-cpp-python
|
| 16 |
huggingface-hub
|
|
|
|
| 12 |
bitsandbytes
|
| 13 |
accelerate
|
| 14 |
torch
|
|
|
|
| 15 |
huggingface-hub
|