Update Dockerfile
Browse files- Dockerfile +53 -15
Dockerfile
CHANGED
|
@@ -1,25 +1,63 @@
|
|
| 1 |
FROM ghcr.io/ggml-org/llama.cpp:full
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN python3 -m venv /opt/venv
|
| 7 |
ENV PATH="/opt/venv/bin:$PATH"
|
| 8 |
-
|
| 9 |
RUN pip install -U pip huggingface_hub
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN python3 -c 'from huggingface_hub import hf_hub_download; \
|
| 12 |
repo="unsloth/gemma-4-26B-A4B-it-GGUF"; \
|
| 13 |
-
hf_hub_download(repo_id=repo, filename="gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf", local_dir="/
|
| 14 |
-
hf_hub_download(repo_id=repo, filename="mmproj-BF16.gguf", local_dir="/
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM ghcr.io/ggml-org/llama.cpp:full
|
| 2 |
|
| 3 |
+
# Set up working directory and system dependencies
|
| 4 |
WORKDIR /app
|
| 5 |
+
RUN apt update && apt install -y wget python3 python3-pip python3-venv && rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
+
# Create a dedicated directory to organize the models
|
| 8 |
+
RUN mkdir -p /models
|
| 9 |
+
|
| 10 |
+
# Create a virtual environment for Python tools
|
| 11 |
RUN python3 -m venv /opt/venv
|
| 12 |
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
| 13 |
RUN pip install -U pip huggingface_hub
|
| 14 |
|
| 15 |
+
# --- DOWNLOAD FROM FIRST DOCKERFILE (Via wget) ---
|
| 16 |
+
# Model 1: Gemma 4 Multimodal + Speculative Setup
|
| 17 |
+
RUN wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/gemma-4-E2B-it-qat-UD-Q4_K_XL.gguf" -O /models/gemma-4-E2B-it-qat-UD-Q4_K_XL.gguf && \
|
| 18 |
+
wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/mtp-gemma-4-E2B-it.gguf" -O /models/mtp-gemma-4-E2B-it.gguf && \
|
| 19 |
+
wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/mmproj-F16.gguf" -O /models/gemma-4-E2B-it-mmproj.gguf
|
| 20 |
+
|
| 21 |
+
# Model 2: Gemma 3 1B Model
|
| 22 |
+
RUN wget "https://huggingface.co/MaziyarPanahi/gemma-3-1b-it-GGUF/resolve/main/gemma-3-1b-it.Q3_K_M.gguf" -O /models/gemma-3-1b-it.Q3_K_M.gguf
|
| 23 |
+
|
| 24 |
+
# --- DOWNLOAD FROM SECOND DOCKERFILE (Via huggingface_hub) ---
|
| 25 |
+
# Model 3: Gemma 4 26B Multimodal
|
| 26 |
RUN python3 -c 'from huggingface_hub import hf_hub_download; \
|
| 27 |
repo="unsloth/gemma-4-26B-A4B-it-GGUF"; \
|
| 28 |
+
hf_hub_download(repo_id=repo, filename="gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf", local_dir="/models"); \
|
| 29 |
+
hf_hub_download(repo_id=repo, filename="mmproj-BF16.gguf", local_dir="/models")'
|
| 30 |
+
|
| 31 |
+
# --- MERGED ROUTER CONFIGURATION ---
|
| 32 |
+
RUN echo "[gemma-4-vision]" > /models.ini && \
|
| 33 |
+
echo "model = /models/gemma-4-E2B-it-qat-UD-Q4_K_XL.gguf" >> /models.ini && \
|
| 34 |
+
echo "spec-draft-model = /models/mtp-gemma-4-E2B-it.gguf" >> /models.ini && \
|
| 35 |
+
echo "mmproj = /models/gemma-4-E2B-it-mmproj.gguf" >> /models.ini && \
|
| 36 |
+
echo "ctx-size = 4096" >> /models.ini && \
|
| 37 |
+
echo "flash-attn = on" >> /models.ini && \
|
| 38 |
+
echo "ubatch-size = 128" >> /models.ini && \
|
| 39 |
+
echo "batch-size = 512" >> /models.ini && \
|
| 40 |
+
echo "spec-type = draft-mtp" >> /models.ini && \
|
| 41 |
+
echo "spec-draft-n-max = 3" >> /models.ini && \
|
| 42 |
+
echo "" >> /models.ini && \
|
| 43 |
+
echo "[gemma-3-1b]" >> /models.ini && \
|
| 44 |
+
echo "model = /models/gemma-3-1b-it.Q3_K_M.gguf" >> /models.ini && \
|
| 45 |
+
echo "ctx-size = 4096" >> /models.ini && \
|
| 46 |
+
echo "flash-attn = on" >> /models.ini && \
|
| 47 |
+
echo "" >> /models.ini && \
|
| 48 |
+
echo "[gemma-4-26b-vision]" >> /models.ini && \
|
| 49 |
+
echo "model = /models/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf" >> /models.ini && \
|
| 50 |
+
echo "mmproj = /models/mmproj-BF16.gguf" >> /models.ini && \
|
| 51 |
+
echo "cache-type-k = q8_0" >> /models.ini && \
|
| 52 |
+
echo "cache-type-v = iq4_nl" >> /models.ini && \
|
| 53 |
+
echo "ctx-size = 64000" >> /models.ini
|
| 54 |
+
|
| 55 |
+
# --- START SERVER IN ROUTER MODE ---
|
| 56 |
+
# Note: "--server" is implicit when executing the entrypoint of the llama.cpp image with routing presets
|
| 57 |
+
CMD [ \
|
| 58 |
+
"--models-preset", "/models.ini", \
|
| 59 |
+
"--port", "7860", \
|
| 60 |
+
"--host", "0.0.0.0", \
|
| 61 |
+
"-t", "2", \
|
| 62 |
+
"-tb", "2" \
|
| 63 |
+
]
|