kingjones777 commited on
Commit
2bcc05f
Β·
verified Β·
1 Parent(s): e7f5ebb

patches: add llama.cpp architecture patch + build instructions

Browse files
Files changed (1) hide show
  1. patches/README.md +71 -0
patches/README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Architecture patch β€” build a llama.cpp that can load this model
2
+
3
+ This model uses a `Q4_0_ROCMFP4_*` quantization type **and** a model architecture that is not in
4
+ upstream llama.cpp. You need both. The patch in this directory adds the architecture on top of
5
+ [`charlie12345/ROCmFPX`](https://github.com/charlie12345/ROCmFPX), which supplies the ROCmFP4
6
+ quant types.
7
+
8
+ Verified with `git apply --check` against the exact base commit named in the patch filename.
9
+
10
+ ## Build
11
+
12
+ ```bash
13
+ git clone https://github.com/charlie12345/ROCmFPX.git
14
+ cd ROCmFPX
15
+ git checkout <BASE_COMMIT> # the commit in the patch filename
16
+ git apply /path/to/<patch-file>.patch
17
+ cmake -B build -S . -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1151 -DCMAKE_BUILD_TYPE=Release
18
+ cmake --build build -j$(nproc)
19
+ ```
20
+
21
+ `build/bin/llama-server` and `build/bin/llama-quantize` land in `build/bin/`. Set
22
+ `LD_LIBRARY_PATH` to that directory when running them from elsewhere.
23
+
24
+ ⚠️ **If you add new files under `src/models/`, re-run `cmake -B build -S .`** β€” the `models/*.cpp`
25
+ GLOB is evaluated at configure time, so `cmake --build` alone will not link them.
26
+
27
+ ## Which patch
28
+
29
+ | patch | base commit | adds |
30
+ |---|---|---|
31
+ | `rocmfpx-2809dc5-add-bailingmoe3qlora-mellum-zaya.patch` | `2809dc5` | `mellum`, `zaya`, and the **Q-LoRA path** for `bailingmoe3` |
32
+ | `rocmfpx-3edc3d3-add-muse-glimmer.patch` | `3edc3d3` | `muse-glimmer` |
33
+
34
+ The `2809dc5` patch adds three architectures in one diff because they share seam files
35
+ (`llama-arch`, `llama-model`, `llama-graph`, `gguf-py`); splitting them cleanly is error-prone,
36
+ so it is shipped whole. Applying it gives you all three.
37
+
38
+ ## Notes on specific architectures
39
+
40
+ **`bailingmoe3` (Ling-3.0)** β€” upstream ROCmFPX already has a `bailingmoe3.cpp`, but it was
41
+ written for **Ling-3.0-flash**, which has `q_lora_rank: null`. **Ling-3.0-tiny sets
42
+ `q_lora_rank: 256`** and compresses queries via `q_a_proj β†’ q_a_layernorm β†’ q_b_proj`. Without
43
+ this patch, *every* GGUF of tiny fails β€” including BF16 and Q4_K_M β€” usually at
44
+ `missing tensor 'blk.0.ssm_f.weight'`, before the Q-LoRA gap is even reached. The patch adds the
45
+ Q-LoRA branch at both tensor-creation sites and both forward graphs, plus an `ssm_f`β†’`ssm_f_a`
46
+ name fallback. Reference: upstream llama.cpp PR
47
+ [#26608](https://github.com/ggml-org/llama.cpp/pull/26608).
48
+
49
+ **`mellum` (Mellum2-12B-A2.5B)** β€” reference: upstream llama.cpp PR
50
+ [#23966](https://github.com/ggml-org/llama.cpp/pull/23966). `layer_types` alternate
51
+ sliding_attention Γ—3 β†’ full_attention (`n_swa = 1024`); the patch honours that per-layer.
52
+
53
+ **`zaya` (ZAYA1-8B)** β€” reference: upstream llama.cpp draft PR
54
+ [#23112](https://github.com/ggml-org/llama.cpp/pull/23112). Uses Compressed Convolutional
55
+ Attention. The patch **excludes `cca_conv_grp` from quantization** in `llama-quant.cpp` β€” those
56
+ tensors are highly sensitive and must stay high precision. Also adds an `ssm-conv.cu` `case 2`
57
+ kernel (`d_conv = 2`) and BF16-safe `conv_1d`.
58
+
59
+ **`muse-glimmer`** β€” this architecture has no upstream PR we are aware of; the implementation in
60
+ this patch is our own. ⚠️ **`-fa off` is mandatory** β€” flash attention breaks the vision path on
61
+ gfx1151.
62
+
63
+ ## ⚠️ Do not use `strings` to check whether your build supports an architecture
64
+
65
+ We hit this twice. A binary can contain the literal architecture name and still fail with
66
+ `unknown model architecture` β€” the name lives in a tensor-name table while the loader is separate
67
+ code. **Attempt the load.** That is the only reliable check.
68
+
69
+ ## Licence
70
+
71
+ These patches are derivative of llama.cpp / ROCmFPX and carry the upstream **MIT** licence.