Views
No views yet
ik_llama.cpp imatrix Quantizations of inclusionAI/Ling-1Tik_llama.cpp can also run your existing GGUFs from bartowski, unsloth, mradermacher, etc if you want to try it out before downloading my quants.
Q8_0 989.678 GiB (8.504 BPW)
1#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\..*\.attn_qkv.*=q8_0
8blk\..*\.attn_output.*=q8_0
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=q8_0
12blk\..*\.ffn_(gate|up)\.weight=q8_0
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=q8_0
16blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq6_k
20blk\..*\.ffn_(gate|up)_exps\.weight=iq5_k
21
22# Non-Repeating Layers
23token_embd\.weight=iq6_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-IQ5_K.gguf \
38 IQ5_K \
39 1921#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\..*\.attn_qkv.*=iq6_k
8blk\..*\.attn_output.*=iq6_k
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=iq5_ks
12blk\..*\.ffn_(gate|up)\.weight=iq5_ks
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=iq5_ks
16blk\..*\.ffn_(gate|up)_shexp\.weight=iq5_ks
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq4_kss
20blk\..*\.ffn_(gate|up)_exps\.weight=iq4_kss
21
22# Non-Repeating Layers
23token_embd\.weight=iq4_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-smol-IQ4_KSS.gguf \
38 IQ4_KSS \
39 1921#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\..*\.attn_qkv.*=iq6_k
8blk\..*\.attn_output.*=iq6_k
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=iq5_ks
12blk\..*\.ffn_(gate|up)\.weight=iq5_ks
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=iq5_ks
16blk\..*\.ffn_(gate|up)_shexp\.weight=iq5_ks
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq3_ks
20blk\..*\.ffn_(gate|up)_exps\.weight=iq3_ks
21
22# Non-Repeating Layers
23token_embd\.weight=iq4_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-smol-IQ3_KS.gguf \
38 IQ3_KS \
39 1921#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\..*\.attn_qkv.*=q8_0
8blk\..*\.attn_output.*=q8_0
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=q8_0
12blk\..*\.ffn_(gate|up)\.weight=q8_0
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=q8_0
16blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq3_k
20blk\..*\.ffn_(gate|up)_exps\.weight=iq2_k
21
22# Non-Repeating Layers
23token_embd\.weight=iq4_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-IQ2_K.gguf \
38 IQ2_K \
39 192attn.*/first 4 dense layers/shexp at full q8_0 would take about 20.1 GiB VRAM which is how the iqN_k quants are done.1custom="
2# 80 Repeating Layers [0-79]
3
4# Attention
5blk\.(0|1|2|3)\.attn_qkv.*=q8_0
6blk\.(0|1|2|3)\.attn_output.*=q8_0
7blk\..*\.attn_qkv.*=iq6_k
8blk\..*\.attn_output.*=iq6_k
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=iq5_ks
12blk\..*\.ffn_(gate|up)\.weight=iq5_ks
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=iq5_ks
16blk\..*\.ffn_(gate|up)_shexp\.weight=iq5_ks
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq2_ks
20blk\..*\.ffn_(gate|up)_exps\.weight=iq2_ks
21
22# Non-Repeating Layers
23token_embd\.weight=iq4_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-smol-IQ2_KS.gguf \
38 IQ2_KS \
39 1921#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\.(0|1|2|3)\.attn_qkv.*=q8_0
8blk\.(0|1|2|3)\.attn_output.*=q8_0
9blk\..*\.attn_qkv.*=q6_K
10blk\..*\.attn_output.*=q6_K
11
12# First 4 Dense Layers [0-3]
13blk\..*\.ffn_down\.weight=q5_K
14blk\..*\.ffn_(gate|up)\.weight=q4_K
15
16# Shared Expert Layers [3-79]
17blk\..*\.ffn_down_shexp\.weight=q5_K
18blk\..*\.ffn_(gate|up)_shexp\.weight=q4_K
19
20# Routed Experts Layers [3-79]
21blk\..*\.ffn_down_exps\.weight=iq2_xxs
22blk\..*\.ffn_(gate|up)_exps\.weight=iq2_xxs
23
24# Non-Repeating Layers
25token_embd\.weight=q4_K
26output\.weight=q6_K
27"
28
29custom=$(
30 echo "$custom" | grep -v '^#' | \
31 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
32)
33
34numactl -N ${SOCKET} -m ${SOCKET} \
35./build/bin/llama-quantize \
36 --custom-q "$custom" \
37 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
38 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
39 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-smol-IQ2_XXS.gguf \
40 IQ2_XXS \
41 1921#!/usr/bin/env bash
2
3custom="
4# 80 Repeating Layers [0-79]
5
6# Attention
7blk\..*\.attn_qkv.*=iq6_k
8blk\..*\.attn_output.*=iq6_k
9
10# First 4 Dense Layers [0-3]
11blk\..*\.ffn_down\.weight=iq5_ks
12blk\..*\.ffn_(gate|up)\.weight=iq5_ks
13
14# Shared Expert Layers [3-79]
15blk\..*\.ffn_down_shexp\.weight=iq5_ks
16blk\..*\.ffn_(gate|up)_shexp\.weight=iq5_ks
17
18# Routed Experts Layers [3-79]
19blk\..*\.ffn_down_exps\.weight=iq1_kt
20blk\..*\.ffn_(gate|up)_exps\.weight=iq1_kt
21
22# Non-Repeating Layers
23token_embd\.weight=iq4_k
24output\.weight=iq6_k
25"
26
27custom=$(
28 echo "$custom" | grep -v '^#' | \
29 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
30)
31
32numactl -N ${SOCKET} -m ${SOCKET} \
33./build/bin/llama-quantize \
34 --custom-q "$custom" \
35 --imatrix /mnt/data/models/ubergarm/Ling-1T-GGUF/imatrix-Ling-1T-Q8_0.dat \
36 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-BF16-00001-of-00046.gguf \
37 /mnt/data/models/ubergarm/Ling-1T-GGUF/Ling-1T-smol-IQ1_KT.gguf \
38 IQ1_KT \
39 1921# Clone and checkout
2$ git clone https://github.com/ikawrakow/ik_llama.cpp
3$ cd ik_llama.cpp
4
5# Build for hybrid CPU+CUDA
6$ cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON
7$ cmake --build build --config Release -j $(nproc)
8
9# CPU-Only Inference
10# `-ger` is still fresh:
11# https://github.com/ikawrakow/ik_llama.cpp/pull/836
12# Omit numactl and `--numa ...` if you have only a single NUMA node
13# set batches/threads/kv cache as desired
14# NOTE: multiple slots e.g. `--parallel 2` may case error after canceling generation then starting a new one at the moment
15SOCKET=0
16numactl -N "$SOCKET" -m "$SOCKET" \
17./build/bin/llama-server \
18 --model "$model"\
19 --alias ubergarm/Ling-1T-GGUF \
20 --ctx-size 32768 \
21 -fa -fmoe -ger \
22 -ctk q8_0 -ctv q8_0 \
23 -ub 4096 -b 4096 \
24 --parallel 1 \
25 --threads 128 \
26 --threads-batch 192 \
27 --numa numactl \
28 --host 127.0.0.1 \
29 --port 8080 \
30 --no-mmap \
31 --no-display-prompt
32
33# Hybrid GPU+CPU Inference
34# WARNING: Haven't tested this personally yet...
35# `-ger` on CUDA may not be merged yet:
36# https://github.com/ikawrakow/ik_llama.cpp/pull/838
37# Omit numactl and `--numa ...` if you have only a single NUMA node
38# set batches/threads/kv cache as desired
39# NOTE: multiple slots e.g. `--parallel 2` may case error after canceling generation then starting a new one at the moment
40SOCKET=0
41numactl -N "$SOCKET" -m "$SOCKET" \
42./build/bin/llama-server \
43 --model "$model"\
44 --alias ubergarm/Ling-1T-GGUF \
45 --ctx-size 32768 \
46 -fa -fmoe -ger \
47 -ctk q8_0 -ctv q8_0 \
48 -ub 4096 -b 4096 \
49 -ngl 99 \
50 -ot "blk\.(4|5|6)\.ffn_.*=CUDA0" \
51 -ot "blk\.(7|8|9)\.ffn_.*=CUDA1" \
52 -ot exps=CPU \
53 --parallel 1 \
54 --threads 128 \
55 --threads-batch 192 \
56 --numa numactl \
57 --host 127.0.0.1 \
58 --port 8080 \
59 --no-mmap \
60 --no-display-prompt
61
62# optional use this once after downloading to confirm good files
63 --validate-quants
64
65# NOTE: if you *really* want over the official 32k supported context consider these options:
66# 64k
67--ctx-size 65536 --rope-scaling yarn --rope-scale 2 --yarn-orig-ctx 32768 --override-kv bailingmoe2.context_length=int:65536
68# 128k (longer extension likely reduces quality of output, always use minimum context required)
69--ctx-size 131072 --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768 --override-kv bailingmoe2.context_length=int:131072
70# Details:
71# * https://github.com/ikawrakow/ik_llama.cpp/discussions/839#discussioncomment-14745117
72# * https://github.com/ikawrakow/ik_llama.cpp/issues/873