we2app commited on
Commit
7b6bc64
·
verified ·
1 Parent(s): 78a7f1e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -48
Dockerfile CHANGED
@@ -4,60 +4,36 @@ WORKDIR /app
4
 
5
  RUN apt update && apt install -y python3 python3-pip python3-venv wget && rm -rf /var/lib/apt/lists/*
6
 
7
- # Create a dedicated directory to organize the models
8
- RUN mkdir -p /models
9
-
10
- # Set up Python virtual environment for huggingface_hub 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
- # --- MODEL 1: Gemma 4 Multimodal + Speculative Setup ---
16
- 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 && \
17
- 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 && \
18
- wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/mmproj-F16.gguf" -O /models/gemma-4-E2B-it-mmproj.gguf
19
-
20
- # --- MODEL 2: Gemma 3 1B Model ---
21
- 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
22
-
23
- # --- MODEL 3: Gemma 4 26B Multimodal (Added via huggingface_hub) ---
24
  ARG HF_TOKEN
 
 
25
  RUN python3 -c 'from huggingface_hub import hf_hub_download; \
26
  import os; \
27
  token = os.getenv("HF_TOKEN") or None; \
28
  repo="unsloth/gemma-4-26B-A4B-it-GGUF"; \
29
- hf_hub_download(repo_id=repo, filename="gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf", local_dir="/models", token=token); \
30
- hf_hub_download(repo_id=repo, filename="mmproj-BF16.gguf", local_dir="/models", token=token)'
31
-
32
- # --- CREATE ROUTER CONFIGURATION ---
33
- RUN echo "[gemma-4-vision]" > /models.ini && \
34
- echo "model = /models/gemma-4-E2B-it-qat-UD-Q4_K_XL.gguf" >> /models.ini && \
35
- echo "spec-draft-model = /models/mtp-gemma-4-E2B-it.gguf" >> /models.ini && \
36
- echo "mmproj = /models/gemma-4-E2B-it-mmproj.gguf" >> /models.ini && \
37
- echo "ctx-size = 4096" >> /models.ini && \
38
- echo "flash-attn = on" >> /models.ini && \
39
- echo "ubatch-size = 128" >> /models.ini && \
40
- echo "batch-size = 512" >> /models.ini && \
41
- echo "spec-type = draft-mtp" >> /models.ini && \
42
- echo "spec-draft-n-max = 3" >> /models.ini && \
43
- echo "" >> /models.ini && \
44
- echo "[gemma-3-1b]" >> /models.ini && \
45
- echo "model = /models/gemma-3-1b-it.Q3_K_M.gguf" >> /models.ini && \
46
- echo "ctx-size = 4096" >> /models.ini && \
47
- echo "flash-attn = on" >> /models.ini && \
48
- echo "" >> /models.ini && \
49
- echo "[gemma-4-26b-vision]" >> /models.ini && \
50
- echo "model = /models/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf" >> /models.ini && \
51
- echo "mmproj = /models/mmproj-BF16.gguf" >> /models.ini && \
52
- echo "cache-type-k = q8_0" >> /models.ini && \
53
- echo "cache-type-v = iq4_nl" >> /models.ini && \
54
- echo "ctx-size = 64000" >> /models.ini
55
-
56
- # --- START SERVER IN ROUTER MODE ---
57
- CMD [ \
58
- "--models-preset", "/models.ini", \
59
- "--port", "7860", \
60
- "--host", "0.0.0.0", \
61
- "-t", "2", \
62
- "-tb", "2" \
63
- ]
 
4
 
5
  RUN apt update && apt install -y python3 python3-pip python3-venv wget && rm -rf /var/lib/apt/lists/*
6
 
 
 
 
 
7
  RUN python3 -m venv /opt/venv
8
  ENV PATH="/opt/venv/bin:$PATH"
9
  RUN pip install -U pip huggingface_hub
10
 
11
+ # Define the build argument for the token
 
 
 
 
 
 
 
 
12
  ARG HF_TOKEN
13
+
14
+ # Download Gemma 4 26B using the token to prevent the warning and rate-limiting
15
  RUN python3 -c 'from huggingface_hub import hf_hub_download; \
16
  import os; \
17
  token = os.getenv("HF_TOKEN") or None; \
18
  repo="unsloth/gemma-4-26B-A4B-it-GGUF"; \
19
+ hf_hub_download(repo_id=repo, filename="gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf", local_dir="/app", token=token); \
20
+ hf_hub_download(repo_id=repo, filename="mmproj-BF16.gguf", local_dir="/app", token=token)'
21
+
22
+ # Download Gemma 4 E2B + Speculative Setup
23
+ 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 /app/gemma-4-E2B-it-qat-UD-Q4_K_XL.gguf && \
24
+ wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/mtp-gemma-4-E2B-it.gguf" -O /app/mtp-gemma-4-E2B-it.gguf && \
25
+ wget "https://huggingface.co/unsloth/gemma-4-E2B-it-qat-GGUF/resolve/main/mmproj-F16.gguf" -O /app/gemma-4-E2B-it-mmproj.gguf
26
+
27
+ # Download Gemma 3 1B Model
28
+ RUN wget "https://huggingface.co/MaziyarPanahi/gemma-3-1b-it-GGUF/resolve/main/gemma-3-1b-it.Q3_K_M.gguf" -O /app/gemma-3-1b-it.Q3_K_M.gguf
29
+
30
+ CMD ["--server", \
31
+ "-m", "/app/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf", \
32
+ "--mmproj", "/app/mmproj-BF16.gguf", \
33
+ "--host", "0.0.0.0", \
34
+ "--port", "7860", \
35
+ "-t", "2", \
36
+ "--cache-type-k", "q8_0", \
37
+ "--cache-type-v", "iq4_nl", \
38
+ "-c", "64000", \
39
+ "-n", "38912"]