Lord-H4D3ZS commited on
Commit
aa1d0a5
·
verified ·
1 Parent(s): d8633a9

Upload BUILD.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. BUILD.md +73 -0
BUILD.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Building the runtime (ROCmFPX / llama.cpp) yourself
2
+
3
+ This GGUF uses the **ROCmFPX** quant family (`Q2_0_ROCMFPX`), which needs a matching
4
+ `llama-server` / `llama-quantize`. Build it from the pinned source so your binary understands
5
+ the 2-bit ROCmFP codebook and the `nextn` (MTP) tensors.
6
+
7
+ ## Pinned source
8
+
9
+ - Repo: https://github.com/charlie12345/ROCmFPX.git
10
+ - Commit: `b2f5829db8beefc22b49481247d180a48b06793a` (b2f5829)
11
+
12
+ Building any other commit is not guaranteed to read `Q2_0_ROCMFPX`.
13
+
14
+ ## Quick build (AMD, HIP — MI300X / gfx942, adapt `AMDGPU_TARGETS` for your card)
15
+
16
+ ```bash
17
+ git clone https://github.com/charlie12345/ROCmFPX.git
18
+ cd ROCmFPX && git checkout b2f5829
19
+
20
+ export ROCM_PATH=/opt/rocm # e.g. /opt/rocm-7.2.4 on some installs
21
+ cmake -S . -B build \
22
+ -DGGML_HIP=ON \
23
+ -DAMDGPU_TARGETS=gfx942 \ # RX 9060 XT = gfx1200 (RDNA4); MI300X = gfx942
24
+ -DCMAKE_BUILD_TYPE=Release \
25
+ -DCMAKE_PREFIX_PATH="$ROCM_PATH"
26
+ cmake --build build -j --target llama-server llama-quantize llama-cli
27
+ # -> build/bin/llama-server, build/bin/llama-quantize
28
+ ```
29
+
30
+ For a consumer RDNA4 card (RX 9060 XT) you can also build the **Vulkan** backend
31
+ (`-DGGML_VULKAN=ON` instead of `-DGGML_HIP=ON`) if you prefer it over ROCm/HIP.
32
+
33
+ The `build_rocmfpx.sh` in this repo is the exact script used to build the binaries that
34
+ produced this GGUF (HIP, gfx942). Edit `AMDGPU_TARGETS` for your GPU.
35
+
36
+ ## The quant recipe (how this 12GB build was made)
37
+
38
+ Pure 2-bit-everywhere collapses this model; pure 3.5-bit is coherent but 19GB (won't fit 16GB).
39
+ The fix is **role-aware**: 2-bit experts (the bulk) + Q6 attention/embeddings/shared-experts.
40
+ Reproduce from an f16 GGUF (`convert_hf_to_gguf.py ... --outtype f16`) with:
41
+
42
+ ```bash
43
+ ./build/bin/llama-quantize \
44
+ --token-embedding-type Q6_0_ROCMFPX \
45
+ --output-tensor-type Q6_0_ROCMFPX \
46
+ --tensor-type attn_q=Q6_0_ROCMFPX --tensor-type attn_k=Q6_0_ROCMFPX \
47
+ --tensor-type attn_v=Q6_0_ROCMFPX --tensor-type attn_qkv=Q6_0_ROCMFPX \
48
+ --tensor-type attn_output=Q6_0_ROCMFPX --tensor-type attn_gate=Q6_0_ROCMFPX \
49
+ --tensor-type ffn_gate_shexp=Q6_0_ROCMFPX --tensor-type ffn_up_shexp=Q6_0_ROCMFPX \
50
+ --tensor-type ffn_down_shexp=Q6_0_ROCMFPX \
51
+ model-f16.gguf model-Q2KXL_ROCMFPX.gguf Q2_0_ROCMFPX
52
+ # base Q2_0_ROCMFPX -> the ffn_*_exps (256-expert) tensors go 2-bit; overrides keep the rest at Q6.
53
+ ```
54
+
55
+ ## Serve it (OpenAI-compatible API on :8080)
56
+
57
+ ```bash
58
+ ./build/bin/llama-server \
59
+ -m Qwen3.8-Distill-35B-A3B-Coder-Abliterated-Q2_ROCMFPX.gguf \
60
+ --host 127.0.0.1 --port 8080 \
61
+ -ngl 99 -c 16384 -fa on --jinja \
62
+ --alias qwen38-distill-a3b
63
+ ```
64
+
65
+ On a 16GB card, context and concurrency share one KV pool — pick one:
66
+ single-stream long context (`-c 32768 -np 1`) **or** many short sessions (`-c 8192 -np 8`).
67
+
68
+ ## Note on MTP
69
+
70
+ The `nextn` (MTP) tensors are present in this GGUF (block 40). Whether they are used for
71
+ speculative decoding depends on your `llama-server` build's runtime support — check its startup
72
+ log for a draft/nextn line. If not auto-used, the model still runs correctly as a standard
73
+ single-token decoder.