devarshia5 commited on
Commit
478d756
·
verified ·
1 Parent(s): 83ec29a

Upload 12 files

Browse files
Dockerfile CHANGED
@@ -14,9 +14,10 @@
14
 
15
  FROM python:3.11-slim
16
 
17
- # curl/ca-certs only; the prebuilt wheel means we need NO compiler toolchain.
 
18
  RUN apt-get update && apt-get install -y --no-install-recommends \
19
- curl ca-certificates \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Hugging Face Spaces run the container as a non-root user with UID 1000.
@@ -25,7 +26,9 @@ USER user
25
  ENV HOME=/home/user \
26
  PATH=/home/user/.local/bin:$PATH
27
 
28
- # --- Python deps: prebuilt CPU wheel installs in seconds (no source build) ---
 
 
29
  RUN pip install --no-cache-dir --user "llama-cpp-python[server]" huggingface_hub
30
 
31
  # --- Model: which GGUF to serve ---------------------------------------------
 
14
 
15
  FROM python:3.11-slim
16
 
17
+ # build-essential + cmake so llama-cpp-python compiles from source if no
18
+ # prebuilt wheel matches (python:slim has no compiler -> CMake "gcc not found").
19
  RUN apt-get update && apt-get install -y --no-install-recommends \
20
+ build-essential cmake git curl ca-certificates \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
  # Hugging Face Spaces run the container as a non-root user with UID 1000.
 
26
  ENV HOME=/home/user \
27
  PATH=/home/user/.local/bin:$PATH
28
 
29
+ # --- Python deps. GGML_NATIVE=OFF -> portable CPU binary (no -march=native),
30
+ # so it can't crash with "illegal instruction" if build CPU != runtime CPU. ---
31
+ ENV CMAKE_ARGS="-DGGML_NATIVE=OFF" FORCE_CMAKE=1
32
  RUN pip install --no-cache-dir --user "llama-cpp-python[server]" huggingface_hub
33
 
34
  # --- Model: which GGUF to serve ---------------------------------------------
hf-space-rag/Dockerfile CHANGED
@@ -9,8 +9,10 @@
9
 
10
  FROM python:3.11-slim
11
 
 
 
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
- curl ca-certificates && rm -rf /var/lib/apt/lists/*
14
 
15
  # Hugging Face Spaces run the container as non-root UID 1000.
16
  RUN useradd -m -u 1000 user
@@ -19,8 +21,11 @@ ENV HOME=/home/user \
19
  PATH=/home/user/.local/bin:$PATH
20
  WORKDIR /home/user/app
21
 
22
- # --- Python deps (prebuilt wheels -> fast, no build toolchain) ---
 
 
23
  COPY --chown=user requirements.txt .
 
24
  RUN pip install --no-cache-dir --user -r requirements.txt
25
 
26
  # --- Model config ------------------------------------------------------------
 
9
 
10
  FROM python:3.11-slim
11
 
12
+ # build-essential + cmake so llama-cpp-python can compile if no prebuilt wheel
13
+ # matches (python:slim has no compiler otherwise -> CMake "gcc not found").
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ build-essential cmake git curl ca-certificates && rm -rf /var/lib/apt/lists/*
16
 
17
  # Hugging Face Spaces run the container as non-root UID 1000.
18
  RUN useradd -m -u 1000 user
 
21
  PATH=/home/user/.local/bin:$PATH
22
  WORKDIR /home/user/app
23
 
24
+ # --- Python deps ---
25
+ # GGML_NATIVE=OFF -> portable CPU binary (no -march=native), so it can't crash
26
+ # with "illegal instruction" if the build CPU != the runtime CPU.
27
  COPY --chown=user requirements.txt .
28
+ ENV CMAKE_ARGS="-DGGML_NATIVE=OFF" FORCE_CMAKE=1
29
  RUN pip install --no-cache-dir --user -r requirements.txt
30
 
31
  # --- Model config ------------------------------------------------------------
hf-space-rag/requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
- # Prebuilt CPU wheel for llama.cpp -> fast build, no compiler needed.
 
2
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
3
  llama-cpp-python
4
 
 
1
+ # Try a prebuilt CPU wheel first (fast); if none matches, the Dockerfile's
2
+ # build-essential/cmake lets it compile from source instead of failing.
3
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
4
  llama-cpp-python
5