Dhanrajtz5rt commited on
Commit
09d6d7a
Β·
verified Β·
1 Parent(s): dce4ced

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -54
Dockerfile CHANGED
@@ -1,68 +1,25 @@
1
- # Switch away from ghcr.io/ggml-org/llama.cpp:full β€”
2
- # MTP requires a custom build from the mtp-clean branch.
3
- FROM ubuntu:24.04
4
 
5
  WORKDIR /app
6
 
7
- # ── 1. System deps for building llama.cpp (CPU-only) ──────────────────────────
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- build-essential cmake git curl \
10
- libcurl4-openssl-dev ca-certificates \
11
- python3 python3-pip python3-venv \
12
- && rm -rf /var/lib/apt/lists/*
13
-
14
- # ── 2. Build llama.cpp from the MTP branch (CPU, no CUDA) ─────────────────────
15
- # The standard ghcr.io llama.cpp image does NOT include MTP support.
16
- # mtp-clean is the upstream PR branch that adds --spec-type draft-mtp.
17
- RUN git clone --depth 1 -b mtp-clean \
18
- https://github.com/am17an/llama.cpp.git /opt/llama.cpp && \
19
- cmake /opt/llama.cpp -B /opt/llama.cpp/build \
20
- -DBUILD_SHARED_LIBS=OFF \
21
- -DGGML_CUDA=OFF \
22
- -DLLAMA_CURL=ON && \
23
- cmake --build /opt/llama.cpp/build \
24
- --config Release -j$(nproc) \
25
- --clean-first \
26
- --target llama-server && \
27
- cp /opt/llama.cpp/build/bin/llama-server /usr/local/bin/llama-server && \
28
- rm -rf /opt/llama.cpp # free disk space after build
29
-
30
- # ── 3. Python env + huggingface_hub ───────────────────────────────────────────
31
  RUN python3 -m venv /opt/venv
32
  ENV PATH="/opt/venv/bin:$PATH"
33
- RUN pip install -U pip huggingface_hub hf_transfer
34
 
35
- # ── 4. Download MTP GGUF (4-bit dynamic, ~5.97 GB) ────────────────────────────
36
- # NOTE: --mmproj is NOT supported with MTP β€” do NOT download it.
37
- # The MTP repo embeds the draft model heads inside the single GGUF file.
38
- ENV HF_HUB_ENABLE_HF_TRANSFER=1
39
- RUN python3 -c '\
40
- from huggingface_hub import hf_hub_download; \
41
- hf_hub_download( \
42
- repo_id="unsloth/Qwen3.5-9B-MTP-GGUF", \
43
- filename="Qwen3.5-9B-UD-Q4_K_XL.gguf", \
44
- local_dir="/app" \
45
- )'
46
 
47
- EXPOSE 7860
 
 
 
48
 
49
- # ── 5. Launch server with MTP speculative decoding ────────────────────────────
50
- # Changes vs your original:
51
- # β€’ -m β†’ new MTP GGUF filename
52
- # β€’ removed --mmproj (unsupported with MTP)
53
- # β€’ removed -ngl (CPU has no GPU layers)
54
- # β€’ added --spec-type draft-mtp (MTP speculative decoding, ~1.5-2x faster)
55
- # β€’ added --spec-draft-n-max 2 (draft 2 tokens ahead; raise to 4 for ngram)
56
- # β€’ -c reduced to 16384 (64 k ctx is very RAM-heavy on CPU)
57
- # β€’ -n reduced to 8192 (generation budget; tune as needed)
58
  CMD ["llama-server", \
59
- "-m", "/app/Qwen3.5-9B-UD-Q4_K_XL.gguf", \
60
  "--host", "0.0.0.0", \
61
  "--port", "7860", \
62
  "-t", "2", \
63
  "--cache-type-k", "q8_0", \
64
  "--cache-type-v", "iq4_nl", \
65
- "-c", "64990", \
66
- "-n", "8192", \
67
- "--spec-type", "draft-mtp", \
68
- "--spec-draft-n-max", "2"]
 
1
+ FROM ghcr.io/ggml-org/llama.cpp:full
 
 
2
 
3
  WORKDIR /app
4
 
5
+ RUN apt update && apt install -y python3 python3-pip python3-venv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Download MTP model (verify exact filename in repo if different)
12
+ RUN python3 -c 'from huggingface_hub import hf_hub_download; \
13
+ repo="unsloth/Qwen3.5-9B-MTP-GGUF"; \
14
+ hf_hub_download(repo_id=repo, filename="Qwen3.5-9B-MTP-Q4_K_M.gguf", local_dir="/app")'
15
 
 
 
 
 
 
 
 
 
 
16
  CMD ["llama-server", \
17
+ "--model", "/app/Qwen3.5-9B-MTP-Q4_K_M.gguf", \
18
  "--host", "0.0.0.0", \
19
  "--port", "7860", \
20
  "-t", "2", \
21
  "--cache-type-k", "q8_0", \
22
  "--cache-type-v", "iq4_nl", \
23
+ "-c", "64000", \
24
+ "--n-predict", "38912", \
25
+ "--mtp"]