CrazyMonkey0 commited on
Commit
ad5570a
·
1 Parent(s): f7ec4f4

fix(lama.cpp): Add prebuilt lamma.cpp to docker

Browse files
Files changed (2) hide show
  1. Dockerfile +14 -10
  2. requirements.txt +0 -1
Dockerfile CHANGED
@@ -1,34 +1,38 @@
1
- # Use full Python image for compatibility with prebuilt wheels
2
  FROM python:3.12
3
 
4
- # Set workdir
5
  WORKDIR /app
6
 
7
- # Install basic system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  wget \
10
  curl \
11
  git \
 
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  # Upgrade pip
15
  RUN pip install --upgrade pip
16
 
17
- # # Install llama-cpp-python prebuilt wheel (CPU)
18
- # RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
 
 
19
 
20
- # Copy project requirements and install
21
  COPY ./requirements.txt /app/requirements.txt
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # Copy application code
25
  COPY . /app
26
 
27
- # Ensure models folder exists (optional)
28
  RUN mkdir -p /app/models
29
 
30
- # Expose port (change if needed)
31
  EXPOSE 7860
32
 
33
- # Start FastAPI app with Uvicorn workers
34
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
 
1
+ # Use full Python 3.12 image for maximum compatibility
2
  FROM python:3.12
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies needed for llama-cpp-python and general Python packages
8
  RUN apt-get update && apt-get install -y \
9
  wget \
10
  curl \
11
  git \
12
+ build-essential \
13
+ cmake \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
  # Upgrade pip
17
  RUN pip install --upgrade pip
18
 
19
+ # Install prebuilt llama-cpp-python (CPU) and Hugging Face hub for from_pretrained()
20
+ RUN pip install --no-cache-dir \
21
+ llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
22
+ huggingface-hub
23
 
24
+ # Copy requirements and install other dependencies
25
  COPY ./requirements.txt /app/requirements.txt
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Copy the application code
29
  COPY . /app
30
 
31
+ # Ensure models folder exists (optional, can store HF cache here)
32
  RUN mkdir -p /app/models
33
 
34
+ # Expose FastAPI port
35
  EXPOSE 7860
36
 
37
+ # Use Gunicorn with Uvicorn workers for production
38
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "2"]
requirements.txt CHANGED
@@ -72,7 +72,6 @@ language_data==1.3.0
72
  lazy_loader==0.4
73
  libclang==18.1.1
74
  librosa==0.11.0
75
- llama_cpp_python==0.3.16
76
  llvmlite==0.44.0
77
  loguru==0.7.3
78
  marisa-trie==1.2.1
 
72
  lazy_loader==0.4
73
  libclang==18.1.1
74
  librosa==0.11.0
 
75
  llvmlite==0.44.0
76
  loguru==0.7.3
77
  marisa-trie==1.2.1