Andrew McCracken
commited on
Commit
·
a922ca8
1
Parent(s):
3fad655
Fix: Force use of pre-built llama-cpp-python wheels
Browse files- Dockerfile +11 -1
- main.py +0 -7
Dockerfile
CHANGED
|
@@ -9,8 +9,18 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
make \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
# Copy requirements and install
|
| 13 |
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
# Copy application code
|
|
|
|
| 9 |
make \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Copy requirements and install
|
| 13 |
COPY requirements.txt .
|
| 14 |
+
|
| 15 |
+
# Set environment variables to use pre-built wheels for llama-cpp-python
|
| 16 |
+
ENV CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_BLAS_VENDOR=OFF -DLLAMA_CUBLAS=OFF"
|
| 17 |
+
ENV FORCE_CMAKE=0
|
| 18 |
+
|
| 19 |
+
# Install llama-cpp-python from PyPI (not building from source)
|
| 20 |
+
RUN pip install --no-cache-dir --only-binary=:all: llama-cpp-python==0.3.14 || \
|
| 21 |
+
pip install --no-cache-dir llama-cpp-python==0.3.14
|
| 22 |
+
|
| 23 |
+
# Install remaining requirements
|
| 24 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
# Copy application code
|
main.py
CHANGED
|
@@ -1,10 +1,3 @@
|
|
| 1 |
-
# Install llama-cpp-python at runtime (HF Spaces workaround)
|
| 2 |
-
import subprocess
|
| 3 |
-
import sys
|
| 4 |
-
print("🔧 Installing llama-cpp-python at runtime...")
|
| 5 |
-
subprocess.run([sys.executable, "-m", "pip", "install", "-v", "llama-cpp-python==0.3.14"], check=True)
|
| 6 |
-
print("✅ llama-cpp-python installed successfully")
|
| 7 |
-
|
| 8 |
from fastapi import FastAPI, HTTPException, WebSocket, WebSocketDisconnect, BackgroundTasks
|
| 9 |
from fastapi.responses import StreamingResponse, JSONResponse, FileResponse
|
| 10 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException, WebSocket, WebSocketDisconnect, BackgroundTasks
|
| 2 |
from fastapi.responses import StreamingResponse, JSONResponse, FileResponse
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|