Fola-AI commited on
Commit ·
d9a0eb4
1
Parent(s): c499cb5
Use PyTorch base image - faster build
Browse files- Dockerfile +11 -23
- requirements.txt +8 -7
Dockerfile
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
# =============================================================================
|
| 2 |
-
# FarmEyes - HuggingFace Spaces Dockerfile (GPU -
|
| 3 |
# =============================================================================
|
| 4 |
-
# Uses
|
|
|
|
| 5 |
# =============================================================================
|
| 6 |
|
| 7 |
-
FROM
|
| 8 |
|
| 9 |
# Set environment variables
|
| 10 |
ENV PYTHONUNBUFFERED=1
|
|
@@ -14,36 +15,23 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
# Install
|
| 18 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 19 |
-
python3.10 \
|
| 20 |
-
python3-pip \
|
| 21 |
-
python3.10-dev \
|
| 22 |
ffmpeg \
|
| 23 |
libsm6 \
|
| 24 |
libxext6 \
|
| 25 |
libgl1 \
|
| 26 |
-
curl \
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \
|
| 31 |
-
ln -sf /usr/bin/pip3 /usr/bin/pip
|
| 32 |
-
|
| 33 |
-
# Upgrade pip
|
| 34 |
-
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 35 |
-
|
| 36 |
-
# Install PyTorch with CUDA 11.8
|
| 37 |
-
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cu118
|
| 38 |
-
|
| 39 |
-
# Install llama-cpp-python PRE-BUILT wheel (no compilation!)
|
| 40 |
-
RUN pip install --no-cache-dir llama-cpp-python \
|
| 41 |
-
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu118
|
| 42 |
-
|
| 43 |
-
# Copy and install remaining requirements
|
| 44 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 45 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
# Copy application code
|
| 48 |
COPY . .
|
| 49 |
|
|
|
|
| 1 |
# =============================================================================
|
| 2 |
+
# FarmEyes - HuggingFace Spaces Dockerfile (GPU - Simplified)
|
| 3 |
# =============================================================================
|
| 4 |
+
# Uses PyTorch base image with CUDA pre-installed
|
| 5 |
+
# llama-cpp-python CPU version works fine - still faster than free tier
|
| 6 |
# =============================================================================
|
| 7 |
|
| 8 |
+
FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
|
| 9 |
|
| 10 |
# Set environment variables
|
| 11 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
| 15 |
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
+
# Install system dependencies only
|
| 19 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
| 20 |
ffmpeg \
|
| 21 |
libsm6 \
|
| 22 |
libxext6 \
|
| 23 |
libgl1 \
|
|
|
|
| 24 |
&& rm -rf /var/lib/apt/lists/*
|
| 25 |
|
| 26 |
+
# Copy requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
COPY requirements.txt .
|
| 28 |
+
|
| 29 |
+
# Install Python dependencies (torch already in base image)
|
| 30 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
|
| 32 |
+
# Install llama-cpp-python (CPU version - avoids long compile)
|
| 33 |
+
RUN pip install --no-cache-dir llama-cpp-python
|
| 34 |
+
|
| 35 |
# Copy application code
|
| 36 |
COPY . .
|
| 37 |
|
requirements.txt
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Web Framework
|
| 2 |
fastapi>=0.104.0
|
| 3 |
uvicorn[standard]>=0.24.0
|
| 4 |
python-multipart>=0.0.6
|
| 5 |
|
| 6 |
-
# AI/ML
|
| 7 |
-
torch>=2.0.0
|
| 8 |
-
torchvision>=0.15.0
|
| 9 |
ultralytics>=8.0.0
|
| 10 |
transformers>=4.35.0
|
| 11 |
huggingface-hub>=0.19.0
|
| 12 |
|
| 13 |
-
# GGUF Model Support (for N-ATLaS)
|
| 14 |
-
llama-cpp-python>=0.2.0
|
| 15 |
-
|
| 16 |
# Audio
|
| 17 |
openai-whisper>=20231117
|
| 18 |
soundfile>=0.12.0
|
|
@@ -28,4 +29,4 @@ requests>=2.31.0
|
|
| 28 |
numpy>=1.24.0
|
| 29 |
scipy>=1.11.0
|
| 30 |
pydantic>=2.0.0
|
| 31 |
-
python-dotenv>=1.0.0
|
|
|
|
| 1 |
+
# =============================================================================
|
| 2 |
+
# FarmEyes - Requirements (GPU Version)
|
| 3 |
+
# =============================================================================
|
| 4 |
+
# Note: torch/torchvision already in base Docker image
|
| 5 |
+
# =============================================================================
|
| 6 |
+
|
| 7 |
# Web Framework
|
| 8 |
fastapi>=0.104.0
|
| 9 |
uvicorn[standard]>=0.24.0
|
| 10 |
python-multipart>=0.0.6
|
| 11 |
|
| 12 |
+
# AI/ML (torch already in base image)
|
|
|
|
|
|
|
| 13 |
ultralytics>=8.0.0
|
| 14 |
transformers>=4.35.0
|
| 15 |
huggingface-hub>=0.19.0
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# Audio
|
| 18 |
openai-whisper>=20231117
|
| 19 |
soundfile>=0.12.0
|
|
|
|
| 29 |
numpy>=1.24.0
|
| 30 |
scipy>=1.11.0
|
| 31 |
pydantic>=2.0.0
|
| 32 |
+
python-dotenv>=1.0.0
|