doth4580 commited on
Commit
8bcd838
·
verified ·
1 Parent(s): 430b98b

EXL3 4 bpw (experts 4 / attention 6) from bf16, code calibration

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/ai-rd-benchmarks.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/coding-benchmarks.png filter=lfs diff=lfs merge=lfs -text
38
+ model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
39
+ quantization_config.json filter=lfs diff=lfs merge=lfs -text
CONVERT.log ADDED
The diff for this file is too large to render. See raw diff
 
GATE_exllamav3.json ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pack": "/mnt/models/Naive-N0.5-Flash-exl3-exp4-dense6",
3
+ "nll": {
4
+ "file": "/mnt/models/work/tests/fixtures/naive/bench_ref_text.txt",
5
+ "tokens": 977,
6
+ "mean_nll": 1.6335245370864868,
7
+ "seconds": 61.96650791168213
8
+ },
9
+ "prefixes": [
10
+ {
11
+ "file": "/mnt/models/work/tests/fixtures/naive/prompt_fib.txt",
12
+ "tokens": 77,
13
+ "top": [
14
+ {
15
+ "token": " ",
16
+ "p": 0.9999997615814209
17
+ },
18
+ {
19
+ "token": " raise",
20
+ "p": 9.931192579415438e-08
21
+ },
22
+ {
23
+ "token": " ",
24
+ "p": 7.380235444998107e-08
25
+ },
26
+ {
27
+ "token": " ",
28
+ "p": 4.012564147615194e-08
29
+ },
30
+ {
31
+ "token": "raise",
32
+ "p": 1.92524929332194e-08
33
+ },
34
+ {
35
+ "token": " ",
36
+ "p": 1.6467531338548724e-08
37
+ },
38
+ {
39
+ "token": " ",
40
+ "p": 1.499385682279808e-08
41
+ },
42
+ {
43
+ "token": "\traise",
44
+ "p": 1.4761399214080484e-08
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "file": "/mnt/models/work/tests/fixtures/naive/prompt_json.txt",
50
+ "tokens": 168,
51
+ "top": [
52
+ {
53
+ "token": "age",
54
+ "p": 0.9999957084655762
55
+ },
56
+ {
57
+ "token": " age",
58
+ "p": 1.7061788639693987e-06
59
+ },
60
+ {
61
+ "token": "Age",
62
+ "p": 6.681492550342227e-07
63
+ },
64
+ {
65
+ "token": "name",
66
+ "p": 3.205815346518648e-07
67
+ },
68
+ {
69
+ "token": "ages",
70
+ "p": 2.1024249008405604e-07
71
+ },
72
+ {
73
+ "token": "old",
74
+ "p": 1.0246399995139654e-07
75
+ },
76
+ {
77
+ "token": "size",
78
+ "p": 7.614477937067932e-08
79
+ },
80
+ {
81
+ "token": "area",
82
+ "p": 7.265785484378284e-08
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Naive AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ license_link: https://huggingface.co/NaiveAI/Naive-N0.5-Flash/blob/main/LICENSE
4
+ base_model: NaiveAI/Naive-N0.5-Flash
5
+ tags:
6
+ - exl3
7
+ - exllamav3
8
+ - trellis
9
+ - 4bpw
10
+ - mixed-bitrate
11
+ - moe
12
+ - long-context
13
+ - dgx-spark
14
+ - naive-n0.5-flash
15
+ ---
16
+
17
+ # Naive-N0.5-Flash — EXL3 4 bpw (experts 4 / attention 6)
18
+
19
+ > **Original model:** [NaiveAI/Naive-N0.5-Flash](https://huggingface.co/NaiveAI/Naive-N0.5-Flash) by the
20
+ > NaiveAI Team, [MIT License](https://huggingface.co/NaiveAI/Naive-N0.5-Flash/blob/main/LICENSE).
21
+ > This artifact is quantized from the **bf16 master** release (not the FP8 one).
22
+ > It contains **modified weights** (EXL3 trellis quantization); the original model is © its authors.
23
+ > Tokenizer and chat template are unchanged from the original.
24
+
25
+ A sibling of [doth4580/Naive-N0.5-Flash-EXL3-3.5bpw](https://huggingface.co/doth4580/Naive-N0.5-Flash-EXL3-3.5bpw):
26
+ an **EXL3 (ExLlamaV3 trellis) mixed-bitrate** quantization of **Naive-N0.5-Flash** — 309B parameters,
27
+ 15.5B active, native 1M-token context — with the **routed experts at 4 bpw** and **attention, the DSA
28
+ indexer, the dense layer-0 MLP and `lm_head` at 6 bpw** (4.03 bpw overall). The pack is **~157 GB
29
+ (~147 GiB) against ~315 GB for the FP8 release and ~618 GB for bf16**; it fits across **two NVIDIA DGX
30
+ Spark (GB10)** machines with less headroom than the 3.5 bpw sibling, or across four comfortably.
31
+
32
+ Quantized with stock [exllamav3](https://github.com/turboderp-org/exllamav3) **1.5.3** plus the
33
+ architecture definition from
34
+ [sf-stav/Naive-N0.5-Flash-EXL3-2x-DGX-Spark](https://github.com/sf-stav/Naive-N0.5-Flash-EXL3-2x-DGX-Spark),
35
+ run on **8× RTX PRO 6000 (Blackwell)** in about 1.5 hours, with a **498-row × 2,048-token calibration set
36
+ built from code repositories, agent-style tool-calling conversations rendered through the model's own
37
+ chat template, and general text** (instead of the converter's default 250-row general set).
38
+
39
+ ## How it compares
40
+
41
+ Forward-only gate in exllamav3 (teacher-forced NLL on a 977-token technical text; next-token
42
+ probability after two code/JSON prefixes), same prompts for every row:
43
+
44
+ | model | source | NLL (nats/token) | p(8-space indent after `if n < 0:`) | p(`age`) on a JSON key |
45
+ |---|---|---|---|---|
46
+ | Naive-N0.5-Flash bf16, `transformers` | bf16 | 1.627 | 1.000 | 1.000 |
47
+ | **this pack** (4.03 bpw) | bf16 | **1.634** | 1.000 | 1.000 |
48
+ | sibling 3.5 bpw pack | FP8 | 1.619 | 1.000 | 1.000 |
49
+
50
+ So this pack is within 0.007 nats of its own unquantized source. It is **not** better than the 3.5 bpw
51
+ sibling on that text: the FP8 release and the bf16 master are different checkpoints (their embedding
52
+ tables differ by ~14 % relative), and on this particular text the FP8-derived pack scores marginally lower.
53
+ Where this pack may pay is code and tool-call output, which its calibration set targets, and in the
54
+ headroom that 4-bit experts leave against outliers; measure on your own workload. Note that a pack built
55
+ by **mixing** the two sources (attention from bf16, experts copied from the FP8-derived pack) scored 2.48
56
+ nats — the two releases do not mix.
57
+
58
+ ## Serving
59
+
60
+ - **ExLlamaV3 directly:** upstream exllamav3 ≥ 1.5.3 with the architecture definition from the
61
+ [recipe repository](https://github.com/sf-stav/Naive-N0.5-Flash-EXL3-2x-DGX-Spark) applied. The
62
+ pack carries the native exllamav3 metadata (`config.json` with its `quantization_config`,
63
+ `quantization_config.json`, `model.safetensors.index.json`).
64
+ - **veloGB10** ([sf-stav/veloGB10](https://github.com/sf-stav/veloGB10)), the from-scratch GB10 engine
65
+ this pack was made for: it loads per-tensor bit rates (3 / 3.5 / 4 / 5 / 6 bpw) from the first release
66
+ that includes the Naive-N0.5 mixed-rate loader.
67
+ - **The vLLM + vllm-exl3 recipe used by the 3.5 bpw sibling has not been tested with this pack.** That
68
+ stack was validated for a *uniform* 3.5 bpw pack; a mixed-rate pack may need plugin changes. The
69
+ vLLM-rewritten `config.json` / `.native` pair of the sibling is therefore not shipped here.
70
+
71
+ Important for any runtime: layer 47's routed `up_proj` is stored **divided by 128** (exllamav3's
72
+ `interm_div` for this architecture — that layer's expert activations overflow f16) and the forward must
73
+ scale that layer's routing weights by 128, as exllamav3 does. A runtime that applies the pack as stored
74
+ silently produces a last-layer MoE 128× too small (the symptom is loops and wrong token choices, not a crash).
75
+
76
+ ## Specifications
77
+
78
+ | | |
79
+ |---|---|
80
+ | Base model | [NaiveAI/Naive-N0.5-Flash](https://huggingface.co/NaiveAI/Naive-N0.5-Flash) (bf16 master as the direct source) |
81
+ | Architecture | MoE, 309B total / 15.5B active, 48 layers, hidden 4096, 64 heads / 4 KV heads, head_dim 192 |
82
+ | Attention | hybrid 39 SWA layers (window 128) + 9 DSA layers (top-2048 selection), GQA4, no full attention |
83
+ | MoE | 256 routed experts, 8 per token, expert intermediate 2048 |
84
+ | Context / vocab | 1,048,576 tokens / 152,576 |
85
+ | Quantization | EXL3 trellis, `mul1` codebook — routed experts 4 bpw; attention, DSA indexer, dense MLP and `lm_head` 6 bpw (4.03 bpw overall); embeddings unquantized; calibration 498×2048 (code / agent / general) |
86
+ | Format / size | native `exl3` — ~157 GB (~147 GiB), 24 shards |
87
+ | License | MIT (inherited from the original model) |
88
+
89
+ ## Files
90
+
91
+ | File | Notes |
92
+ |---|---|
93
+ | `model-00001..00024-of-00024.safetensors` | the quantized weights |
94
+ | `model.safetensors.index.json`, `quantization_config.json` | tensor index and the full EXL3 metadata |
95
+ | `config.json` | the native ExLlamaV3 pack config (carries `quantization_config`) |
96
+ | `RECIPE.yaml` | the per-tensor bit-rate recipe the converter was run with |
97
+ | `GATE_exllamav3.json`, `CONVERT.log` | the gate numbers above and the converter's full log |
98
+ | `SHA256SUMS` | checksums of every file in the pack |
99
+ | `modeling_naive_n05_flash.py`, `configuration_naive_n05_flash.py` | model code, loaded via `trust_remote_code` |
100
+ | tokenizer + `chat_template.jinja`, `generation_config.json` | unchanged from the original |
101
+
102
+ ## Notes
103
+
104
+ - **Beyond 2,048 tokens the DSA layers are approximate** in runtimes that run them as dense attention
105
+ (exact up to 2,048 tokens); the 1M native context needs a sparse attention backend.
106
+ - **Larger than the sibling:** ~14 % more bytes than the 3.5 bpw pack, so expect proportionally lower
107
+ decode speed on bandwidth-bound hardware such as the DGX Spark.
108
+ - Sampling defaults from the original `generation_config.json`: temperature 1.0, top_p 0.95.
109
+
110
+ ## License and credits
111
+
112
+ - **Original model:** [NaiveAI/Naive-N0.5-Flash](https://huggingface.co/NaiveAI/Naive-N0.5-Flash) —
113
+ © the NaiveAI Team, [MIT](https://huggingface.co/NaiveAI/Naive-N0.5-Flash/blob/main/LICENSE); a copy
114
+ ships here as `LICENSE`. Built on Xiaomi's
115
+ [MiMo-V2.5](https://huggingface.co/XiaomiMiMo/MiMo-V2.5-Base) and DeepSeek Sparse Attention.
116
+ - **This artifact:** EXL3 mixed-bitrate quantization produced with
117
+ [exllamav3](https://github.com/turboderp-org/exllamav3) 1.5.3 and the architecture definition from
118
+ the [recipe repository](https://github.com/sf-stav/Naive-N0.5-Flash-EXL3-2x-DGX-Spark). Weights are
119
+ modified; tokenizer and chat template are not.
120
+ - **Sibling:** [doth4580/Naive-N0.5-Flash-EXL3-3.5bpw](https://huggingface.co/doth4580/Naive-N0.5-Flash-EXL3-3.5bpw)
121
+ (uniform 3.5 bpw from the FP8 release, with the vLLM recipe).
RECIPE.yaml ADDED
The diff for this file is too large to render. See raw diff
 
SHA256SUMS ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 42e3af1e796d1684d557a4ea5c86a16a44ac2a0f22d8e4c6f037a1cb619666d4 model-00001-of-00024.safetensors
2
+ b3456afef81b352652047f566537776b6148eafd08427767e0038964b354ce39 model-00002-of-00024.safetensors
3
+ 2561992afcaed488332eddf0517cfadb3041535d2fde74a07f99c52877d65719 model-00003-of-00024.safetensors
4
+ 070ec1b74e56de7a2c25b993a68f5b47dc3541dc999a68dd603357d1d3323b98 model-00004-of-00024.safetensors
5
+ 53d1da81fc0add15870d77c6820b0db36b4ea0c25e30f3ee21901d32f639dd37 model-00005-of-00024.safetensors
6
+ 74941483a1a84fcab3ec46b6142354238ad91bf0c09700782f758fb64e5e811b model-00006-of-00024.safetensors
7
+ 10237cb3d2f6a9b6bc4feddb10d181c837f7274eda45ab48a4b19fb8e636991e model-00007-of-00024.safetensors
8
+ 42b3ffe3e7fbec40e8bf892b0a5ba8b1a10b28e4abf4773788b48c4e085510c5 model-00008-of-00024.safetensors
9
+ 2c24818edeb51f28057abcb232ab6fad44933e94115edfb503bedd37fb508881 model-00009-of-00024.safetensors
10
+ 504a0693ce37f002c20e9f0ecbf81a12d443547950b6d4c0799d80a39b0ef997 model-00010-of-00024.safetensors
11
+ fb6b4b7b549592f937286a985814a0305bd3ab20fe70878b896a3b8723965403 model-00011-of-00024.safetensors
12
+ 654176edda31382f12001024555023264ff157a998aea7c7dc050ef560e3b04f model-00012-of-00024.safetensors
13
+ 3b07fde58523badd56f1fb2ea71c8d93dbae0567b9cf96771f800e4fce1e8ce7 model-00013-of-00024.safetensors
14
+ 7d3d5ebae01af1c480cbc21b4e54230a06a53521ec481b8a31ad3dede773eda6 model-00014-of-00024.safetensors
15
+ 2c815df50218f15e97371ad7965563af8378f9ecfbf45d284b8f25536eed2a5e model-00015-of-00024.safetensors
16
+ 826ece4eeb60c44b88812998d307a7e40fcf4a0437f2babb53201cdb054df9b0 model-00016-of-00024.safetensors
17
+ 956d917971973e211f3128368eaa42c178ee3824fbfc3a5d29caaece0164616c model-00017-of-00024.safetensors
18
+ 700a7579879ca33bba532162ce999fd0ee8649a5db65208726506e768e7af832 model-00018-of-00024.safetensors
19
+ c91381268219ec82c8771c1644411e64f18a3bdc7b82fb199e2ccfc626023141 model-00019-of-00024.safetensors
20
+ 121d86aaa9b0547cd68e6fc7e89c1041f5ebde48b752e90af7b29e70e5879cf5 model-00020-of-00024.safetensors
21
+ 499e3e378115912207a89cc2f07ee7bbd952a14f4e7ea13483e7a404192cb85a model-00021-of-00024.safetensors
22
+ 816e1a8c012fe45c1365374b04ce8704d28f9e3eb7c2c82d718abe36235add83 model-00022-of-00024.safetensors
23
+ 4c9b0bb5671a96c959ae40321c50660778ebaabe17d816b3aa99358dd1fc8e79 model-00023-of-00024.safetensors
24
+ a6368e5481852c67d9495de04fdfc8514a971ffacc345e0b1247576aa312bb5e model-00024-of-00024.safetensors
25
+ 2833a8b6950d0054daf7290696503833fb3f25bf409cdc742aad9b3fd1ca59b9 config.json
26
+ 32fe0aac6da16419c6cfa28688978ad5ce54b7fd576ddd406ab7df60587a08cd generation_config.json
27
+ 1fb058ed285464a798f34a53445d24b2b488d3c768574e322c717205607c3021 model.safetensors.index.json
28
+ 7c7110f110f3a2df203835d6c95f4d4cd145bf6536bfe3b527d91e60f89b8d1a quantization_config.json
29
+ bd994a943a5a44bb8c70c4f27d412a83eba9308c5e8689412219da448a2bd2ed special_tokens_map.json
30
+ 2efef62c60dedec64b55ab8b6e6838ca5cee391c00c62f2c554ba5de3d33e030 tokenizer.json
31
+ a6970b2958597d6463ea3c6737b77797de1261e43dadddb5a6b737c377bec8dd tokenizer_config.json
32
+ ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 vocab.json
33
+ e7ecc00653da360dd32df60e7f278f0e7533b3d7d8e70bdb8a877c9a1660770e chat_template.jinja
34
+ 8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5 merges.txt
35
+ 510adea6465e3fa40925c04769abac67a05cef4540d8451c4e7f892c213d0e8e configuration_naive_n05_flash.py
36
+ e192cea4fa3d01f494d91e6c97ace2c25b907d92e942484e025d86ae2df806c7 modeling_naive_n05_flash.py
37
+ a8d3b45fb752ec36b122e4de6b61c96eecc0fc9657b881b1a60def1424afed26 README.md
chat_template.jinja ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if not add_generation_prompt is defined -%}
2
+ {%- set add_generation_prompt = false -%}
3
+ {%- endif -%}
4
+ {%- if not enable_thinking is defined -%}
5
+ {%- set enable_thinking = true -%}
6
+ {%- endif -%}
7
+ {%- if not keep_all_reasoning is defined -%}
8
+ {%- set keep_all_reasoning = true -%}
9
+ {%- endif -%}
10
+ {%- macro render_extra_keys(json_dict, handled_keys) -%}
11
+ {%- if json_dict is mapping %}
12
+ {%- for json_key in json_dict if json_key not in handled_keys %}
13
+ {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
14
+ {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
15
+ {%- else %}
16
+ {{-'\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
17
+ {%- endif %}
18
+ {%- endfor %}
19
+ {%- endif %}
20
+ {%- endmacro -%}
21
+ {%- macro render_content(message_content) -%}
22
+ {%- if message_content is string -%}
23
+ {{- message_content -}}
24
+ {%- else -%}
25
+ {%- for content in message_content -%}
26
+ {%- if 'text' in content -%}
27
+ {{- content['text'] -}}
28
+ {%- endif -%}
29
+ {%- endfor -%}
30
+ {%- endif -%}
31
+ {%- endmacro -%}
32
+ {%- if messages[0]["role"] == "system" %}
33
+ {%- set system_message = messages[0]["content"] %}
34
+ {%- set loop_messages = messages[1:] %}
35
+ {%- else %}
36
+ {%- set loop_messages = messages %}
37
+ {%- endif %}
38
+ {%- set ns = namespace(last_user_index=-1) %}
39
+ {%- for m in loop_messages %}
40
+ {%- if m.role == 'user' %}
41
+ {%- set ns.last_user_index = loop.index0 -%}
42
+ {%- endif %}
43
+ {%- endfor %}
44
+ {%- if not tools is defined %}
45
+ {%- set tools = [] %}
46
+ {%- endif %}
47
+ {%- if system_message is defined %}
48
+ {{- "<|im_start|>system\n" + render_content(system_message) }}
49
+ {%- else %}
50
+ {{- "<|im_start|>system\nYou are Naive-N0.5-Flash, a helpful AI assistant engineered by Naive AI." }}
51
+ {%- endif %}
52
+ {%- if tools is iterable and tools | length > 0 %}
53
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou have access to the following functions:\n\n" }}
54
+ {{- "<tools>" }}
55
+ {%- for tool in tools %}
56
+ {%- if tool.function is defined %}
57
+ {%- set tool = tool.function %}
58
+ {%- endif %}
59
+ {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }}
60
+ {%- if tool.description is defined %}
61
+ {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }}
62
+ {%- endif %}
63
+ {{- '\n<parameters>' }}
64
+ {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
65
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
66
+ {{- '\n<parameter>' }}
67
+ {{- '\n<name>' ~ param_name ~ '</name>' }}
68
+ {%- if param_fields.type is defined %}
69
+ {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }}
70
+ {%- endif %}
71
+ {%- if param_fields.description is defined %}
72
+ {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
73
+ {%- endif %}
74
+ {%- set handled_keys = ['name', 'type', 'description'] %}
75
+ {{- render_extra_keys(param_fields, handled_keys) }}
76
+ {{- '\n</parameter>' }}
77
+ {%- endfor %}
78
+ {%- endif %}
79
+ {%- set handled_keys = ['type', 'properties'] %}
80
+ {{- render_extra_keys(tool.parameters, handled_keys) }}
81
+ {{- '\n</parameters>' }}
82
+ {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
83
+ {{- render_extra_keys(tool, handled_keys) }}
84
+ {{- '\n</function>' }}
85
+ {%- endfor %}
86
+ {{- "\n</tools>" }}
87
+ {{- '\n\nFor each function call, output the function name and arguments in the following format:\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>value_1</parameter>\n<parameter=example_parameter_2>This is the value for the second parameter\nthat can span\nmultiple lines</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- DO NOT use function calls inside <think></think> tags.\n- The value enclosed between parameter tags is preserved exactly as-is, including newlines and spaces.\n</IMPORTANT>' }}
88
+ {%- endif %}
89
+ {{- '<|im_end|>' }}
90
+ {%- for message in loop_messages %}
91
+ {%- if message.content is string %}
92
+ {%- set content = message.content %}
93
+ {%- else %}
94
+ {%- set content = render_content(message.content) %}
95
+ {%- endif %}
96
+ {%- if message.role == "assistant" %}
97
+ {%- if message.reasoning_content is string %}
98
+ {%- set reasoning_content = message.reasoning_content %}
99
+ {%- else %}
100
+ {%- set reasoning_content = '' %}
101
+ {%- if '</think>' in content %}
102
+ {%- set reasoning_content = content.split('</think>')[0].split('<think>')[-1] %}
103
+ {%- set content = content.split('</think>')[-1] %}
104
+ {%- endif %}
105
+ {%- endif %}
106
+ {%- if (keep_all_reasoning or loop.index0 > ns.last_user_index) and reasoning_content -%}
107
+ {{- '<|im_start|>' + message.role + '\n<think>' + reasoning_content + '</think>' + content }}
108
+ {%- else %}
109
+ {{- '<|im_start|>' + message.role + '\n<think></think>' + content }}
110
+ {%- endif %}
111
+ {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
112
+ {%- for tool_call in message.tool_calls %}
113
+ {%- if tool_call.function is defined %}
114
+ {%- set tool_call = tool_call.function %}
115
+ {%- endif %}
116
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
117
+ {%- if tool_call.arguments is defined %}
118
+ {%- for args_name, args_value in tool_call.arguments|items %}
119
+ {{- '<parameter=' + args_name + '>' }}
120
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
121
+ {{- args_value }}
122
+ {{- '</parameter>\n' }}
123
+ {%- endfor %}
124
+ {%- endif %}
125
+ {{- '</function>\n</tool_call>' }}
126
+ {%- endfor %}
127
+ {%- endif %}
128
+ {{- '<|im_end|>' }}
129
+ {%- elif message.role == "user" %}
130
+ {{- '<|im_start|>' + message.role + '\n' + render_content(message.content) + '<|im_end|>' }}
131
+ {%- elif message.role == "system" %}
132
+ {{- '<|im_start|>' + message.role + '\n' + render_content(message.content) + '<|im_end|>' }}
133
+ {%- elif message.role == "tool" %}
134
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
135
+ {{- '<|im_start|>tool\n' }}
136
+ {%- endif %}
137
+ {{- '<tool_response>\n' }}
138
+ {{- render_content(message.content) }}
139
+ {{- '\n</tool_response>\n' }}
140
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
141
+ {{- '<|im_end|>' }}
142
+ {%- elif loop.last %}
143
+ {{- '<|im_end|>' }}
144
+ {%- endif %}
145
+ {%- else %}
146
+ {{- '<|im_start|>' + message.role + '\n' + render_content(message.content) + '<|im_end|>' }}
147
+ {%- endif %}
148
+ {%- endfor %}
149
+ {%- if add_generation_prompt %}
150
+ {{- '<|im_start|>assistant\n' }}
151
+ {%- if not enable_thinking -%}
152
+ {{- '<think></think>' -}}
153
+ {%- else -%}
154
+ {{- '' -}}
155
+ {%- endif -%}
156
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_full_attention_sink_bias": false,
3
+ "add_swa_attention_sink_bias": true,
4
+ "architectures": [
5
+ "NaiveN05FlashForCausalLM"
6
+ ],
7
+ "attention_bias": false,
8
+ "attention_chunk_size": 128,
9
+ "attention_dropout": 0.0,
10
+ "attention_projection_layout": "split",
11
+ "attention_value_scale": 0.707,
12
+ "auto_map": {
13
+ "AutoConfig": "configuration_naive_n05_flash.NaiveN05FlashConfig",
14
+ "AutoModel": "modeling_naive_n05_flash.NaiveN05FlashModel",
15
+ "AutoModelForCausalLM": "modeling_naive_n05_flash.NaiveN05FlashForCausalLM"
16
+ },
17
+ "dtype": "bfloat16",
18
+ "eos_token_id": 151645,
19
+ "head_dim": 192,
20
+ "hidden_act": "silu",
21
+ "hidden_size": 4096,
22
+ "hybrid_block_size": null,
23
+ "hybrid_layer_pattern": [
24
+ 0,
25
+ 1,
26
+ 1,
27
+ 1,
28
+ 1,
29
+ 0,
30
+ 1,
31
+ 1,
32
+ 1,
33
+ 1,
34
+ 1,
35
+ 0,
36
+ 1,
37
+ 1,
38
+ 1,
39
+ 1,
40
+ 1,
41
+ 0,
42
+ 1,
43
+ 1,
44
+ 1,
45
+ 1,
46
+ 1,
47
+ 0,
48
+ 1,
49
+ 1,
50
+ 1,
51
+ 1,
52
+ 1,
53
+ 0,
54
+ 1,
55
+ 1,
56
+ 1,
57
+ 1,
58
+ 1,
59
+ 0,
60
+ 1,
61
+ 1,
62
+ 1,
63
+ 1,
64
+ 1,
65
+ 0,
66
+ 1,
67
+ 1,
68
+ 1,
69
+ 1,
70
+ 1,
71
+ 0
72
+ ],
73
+ "initializer_range": 0.02,
74
+ "intermediate_size": 16384,
75
+ "layernorm_epsilon": 1e-05,
76
+ "max_position_embeddings": 1048576,
77
+ "model_type": "naive_n05_flash",
78
+ "moe_intermediate_size": 2048,
79
+ "moe_layer_freq": [
80
+ 0,
81
+ 1,
82
+ 1,
83
+ 1,
84
+ 1,
85
+ 1,
86
+ 1,
87
+ 1,
88
+ 1,
89
+ 1,
90
+ 1,
91
+ 1,
92
+ 1,
93
+ 1,
94
+ 1,
95
+ 1,
96
+ 1,
97
+ 1,
98
+ 1,
99
+ 1,
100
+ 1,
101
+ 1,
102
+ 1,
103
+ 1,
104
+ 1,
105
+ 1,
106
+ 1,
107
+ 1,
108
+ 1,
109
+ 1,
110
+ 1,
111
+ 1,
112
+ 1,
113
+ 1,
114
+ 1,
115
+ 1,
116
+ 1,
117
+ 1,
118
+ 1,
119
+ 1,
120
+ 1,
121
+ 1,
122
+ 1,
123
+ 1,
124
+ 1,
125
+ 1,
126
+ 1,
127
+ 1
128
+ ],
129
+ "n_group": 1,
130
+ "n_routed_experts": 256,
131
+ "n_shared_experts": null,
132
+ "norm_topk_prob": true,
133
+ "num_attention_heads": 64,
134
+ "num_experts_per_tok": 8,
135
+ "num_hidden_layers": 48,
136
+ "num_key_value_heads": 4,
137
+ "pad_token_id": 151643,
138
+ "partial_rotary_factor": 0.334,
139
+ "rope_scaling": {
140
+ "rope_type": "default",
141
+ "type": "default"
142
+ },
143
+ "rope_theta": 10000000,
144
+ "routed_scaling_factor": null,
145
+ "scoring_func": "sigmoid",
146
+ "sliding_window": 128,
147
+ "sliding_window_size": 128,
148
+ "swa_head_dim": 192,
149
+ "swa_num_attention_heads": 64,
150
+ "swa_num_key_value_heads": 8,
151
+ "swa_rope_theta": 10000,
152
+ "swa_v_head_dim": 128,
153
+ "tie_word_embeddings": false,
154
+ "topk_group": 1,
155
+ "topk_method": "noaux_tc",
156
+ "torch_dtype": "bfloat16",
157
+ "transformers_version": "4.57.1",
158
+ "use_cache": true,
159
+ "v_head_dim": 128,
160
+ "vocab_size": 152576,
161
+ "enable_dsa": true,
162
+ "index_top_k": 2048,
163
+ "index_head_dim": 128,
164
+ "index_n_heads": 16,
165
+ "index_n_kv_heads": 1,
166
+ "indexer_activation_dtype": "fp8_e4m3",
167
+ "quantization_config": {
168
+ "quant_method": "exl3",
169
+ "version": "1.5.3",
170
+ "bits": 4.03,
171
+ "head_bits": 6,
172
+ "calibration": {
173
+ "rows": 498,
174
+ "cols": 2048
175
+ },
176
+ "out_scales": "always",
177
+ "codebook": "mul1"
178
+ }
179
+ }
configuration_naive_n05_flash.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Naive AI.
2
+ # Copyright 2026 The HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from transformers.configuration_utils import PretrainedConfig
17
+
18
+
19
+ class NaiveN05FlashConfig(PretrainedConfig):
20
+ model_type = "naive_n05_flash"
21
+ keys_to_ignore_at_inference = ["past_key_values"]
22
+ attribute_map = {"num_local_experts": "n_routed_experts"}
23
+
24
+ def __init__(
25
+ self,
26
+ vocab_size: int = 152576,
27
+ hidden_size: int = 4096,
28
+ intermediate_size: int = 16384,
29
+ num_hidden_layers: int = 48,
30
+ num_attention_heads: int = 64,
31
+ num_key_value_heads: int = 4,
32
+ head_dim: int = 192,
33
+ v_head_dim: int = 128,
34
+ swa_num_attention_heads: int = 64,
35
+ swa_num_key_value_heads: int = 8,
36
+ swa_head_dim: int = 192,
37
+ swa_v_head_dim: int = 128,
38
+ hidden_act: str = "silu",
39
+ max_position_embeddings: int = 1048576,
40
+ initializer_range: float = 0.02,
41
+ layernorm_epsilon: float = 1e-5,
42
+ rope_theta: float = 10000000.0,
43
+ swa_rope_theta: float = 10000.0,
44
+ partial_rotary_factor: float = 0.334,
45
+ sliding_window: int = 128,
46
+ hybrid_layer_pattern: list[int] | None = None,
47
+ attention_bias: bool = False,
48
+ attention_projection_layout: str = "split",
49
+ attention_value_scale: float | None = 0.707,
50
+ add_full_attention_sink_bias: bool = False,
51
+ add_swa_attention_sink_bias: bool = True,
52
+ n_routed_experts: int = 256,
53
+ moe_intermediate_size: int = 2048,
54
+ num_experts_per_tok: int = 8,
55
+ routed_scaling_factor: float | None = 1.0,
56
+ scoring_func: str = "sigmoid",
57
+ topk_method: str = "noaux_tc",
58
+ n_group: int = 1,
59
+ topk_group: int = 1,
60
+ norm_topk_prob: bool = True,
61
+ moe_layer_freq: list[int] | None = None,
62
+ enable_dsa: bool = True,
63
+ index_top_k: int = 2048,
64
+ index_head_dim: int = 128,
65
+ index_n_heads: int = 16,
66
+ index_n_kv_heads: int = 1,
67
+ indexer_activation_dtype: str = "fp8_e4m3",
68
+ use_cache: bool = True,
69
+ tie_word_embeddings: bool = False,
70
+ pad_token_id: int | None = 151643,
71
+ eos_token_id: int | list[int] | None = 151645,
72
+ **kwargs,
73
+ ) -> None:
74
+ self.vocab_size = vocab_size
75
+ self.hidden_size = hidden_size
76
+ self.intermediate_size = intermediate_size
77
+ self.num_hidden_layers = num_hidden_layers
78
+ self.num_attention_heads = num_attention_heads
79
+ self.num_key_value_heads = num_key_value_heads
80
+ self.head_dim = head_dim
81
+ self.v_head_dim = v_head_dim
82
+ self.swa_num_attention_heads = swa_num_attention_heads
83
+ self.swa_num_key_value_heads = swa_num_key_value_heads
84
+ self.swa_head_dim = swa_head_dim
85
+ self.swa_v_head_dim = swa_v_head_dim
86
+ self.hidden_act = hidden_act
87
+ self.max_position_embeddings = max_position_embeddings
88
+ self.initializer_range = initializer_range
89
+ self.layernorm_epsilon = layernorm_epsilon
90
+ self.rope_theta = rope_theta
91
+ self.swa_rope_theta = swa_rope_theta
92
+ self.partial_rotary_factor = partial_rotary_factor
93
+ self.sliding_window = sliding_window
94
+ self.hybrid_layer_pattern = hybrid_layer_pattern or [
95
+ int(i != 0 and i % 6 != 5) for i in range(num_hidden_layers)
96
+ ]
97
+ self.attention_bias = attention_bias
98
+ self.attention_projection_layout = attention_projection_layout
99
+ self.attention_value_scale = attention_value_scale
100
+ self.add_full_attention_sink_bias = add_full_attention_sink_bias
101
+ self.add_swa_attention_sink_bias = add_swa_attention_sink_bias
102
+ self.n_routed_experts = n_routed_experts
103
+ self.moe_intermediate_size = moe_intermediate_size
104
+ self.num_experts_per_tok = num_experts_per_tok
105
+ self.routed_scaling_factor = routed_scaling_factor or 1.0
106
+ self.scoring_func = scoring_func
107
+ self.topk_method = topk_method
108
+ self.n_group = n_group
109
+ self.topk_group = topk_group
110
+ self.norm_topk_prob = norm_topk_prob
111
+ self.moe_layer_freq = moe_layer_freq or ([0] + [1] * (num_hidden_layers - 1))
112
+ self.enable_dsa = enable_dsa
113
+ self.index_top_k = index_top_k
114
+ self.index_head_dim = index_head_dim
115
+ self.index_n_heads = index_n_heads
116
+ self.index_n_kv_heads = index_n_kv_heads
117
+ self.indexer_activation_dtype = indexer_activation_dtype
118
+ self.use_cache = use_cache
119
+ super().__init__(
120
+ tie_word_embeddings=tie_word_embeddings, pad_token_id=pad_token_id, eos_token_id=eos_token_id, **kwargs
121
+ )
122
+ self.validate()
123
+
124
+ def validate(self):
125
+ if self.attention_projection_layout != "split" or self.index_n_kv_heads != 1:
126
+ raise ValueError("NaiveN05Flash requires split Q/K/V and one indexer KV head")
127
+ if not self.enable_dsa or self.index_top_k <= 0:
128
+ raise ValueError("NaiveN05Flash requires DSA with a positive index_top_k")
129
+ if self.indexer_activation_dtype not in ("bf16", "fp8_e4m3"):
130
+ raise ValueError("indexer_activation_dtype must be bf16 or fp8_e4m3")
131
+ if self.scoring_func != "sigmoid" or self.topk_method != "noaux_tc":
132
+ raise ValueError("NaiveN05Flash requires sigmoid routing with correction bias")
133
+ if self.n_group != 1 or self.topk_group != 1:
134
+ raise ValueError("NaiveN05Flash uses one expert group")
135
+ for prefix in ("", "swa_"):
136
+ heads = getattr(self, prefix + "num_attention_heads")
137
+ kv_heads = getattr(self, prefix + "num_key_value_heads")
138
+ head_dim = getattr(self, prefix + "head_dim")
139
+ rotary_dim = int(head_dim * self.partial_rotary_factor)
140
+ if kv_heads <= 0 or heads % kv_heads or rotary_dim % 2 or not 0 < rotary_dim <= head_dim:
141
+ raise ValueError("Invalid attention head or rotary dimensions")
142
+ if int(self.head_dim * self.partial_rotary_factor) > self.index_head_dim:
143
+ raise ValueError("Indexer head dimension must cover the rotary dimension")
144
+ if self._attn_implementation not in (None, "eager"):
145
+ raise ValueError("NaiveN05Flash supports eager attention only")
146
+ if len(self.hybrid_layer_pattern) != self.num_hidden_layers:
147
+ raise ValueError("hybrid_layer_pattern must contain one entry per layer")
148
+ if len(self.moe_layer_freq) != self.num_hidden_layers:
149
+ raise ValueError("moe_layer_freq must contain one entry per layer")
150
+ self.layer_types = [
151
+ "sliding_attention" if is_swa else "deepseek_sparse_attention" for is_swa in self.hybrid_layer_pattern
152
+ ]
153
+
154
+
155
+ __all__ = ["NaiveN05FlashConfig"]
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_sample": true,
3
+ "temperature": 1.0,
4
+ "top_p": 0.95,
5
+ "repetition_penalty": 1.0,
6
+ "eos_token_id": 151645,
7
+ "pad_token_id": 151643,
8
+ "max_new_tokens": 131072
9
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42e3af1e796d1684d557a4ea5c86a16a44ac2a0f22d8e4c6f037a1cb619666d4
3
+ size 8087010992
model-00002-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3456afef81b352652047f566537776b6148eafd08427767e0038964b354ce39
3
+ size 6611149486
model-00003-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2561992afcaed488332eddf0517cfadb3041535d2fde74a07f99c52877d65719
3
+ size 6613536806
model-00004-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:070ec1b74e56de7a2c25b993a68f5b47dc3541dc999a68dd603357d1d3323b98
3
+ size 6611149486
model-00005-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53d1da81fc0add15870d77c6820b0db36b4ea0c25e30f3ee21901d32f639dd37
3
+ size 6611152579
model-00006-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74941483a1a84fcab3ec46b6142354238ad91bf0c09700782f758fb64e5e811b
3
+ size 6613543005
model-00007-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10237cb3d2f6a9b6bc4feddb10d181c837f7274eda45ab48a4b19fb8e636991e
3
+ size 6611155672
model-00008-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42b3ffe3e7fbec40e8bf892b0a5ba8b1a10b28e4abf4773788b48c4e085510c5
3
+ size 6611155672
model-00009-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c24818edeb51f28057abcb232ab6fad44933e94115edfb503bedd37fb508881
3
+ size 6613543005
model-00010-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:504a0693ce37f002c20e9f0ecbf81a12d443547950b6d4c0799d80a39b0ef997
3
+ size 6611155672
model-00011-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb6b4b7b549592f937286a985814a0305bd3ab20fe70878b896a3b8723965403
3
+ size 6611155672
model-00012-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:654176edda31382f12001024555023264ff157a998aea7c7dc050ef560e3b04f
3
+ size 6613543005
model-00013-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b07fde58523badd56f1fb2ea71c8d93dbae0567b9cf96771f800e4fce1e8ce7
3
+ size 6611155672
model-00014-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d3d5ebae01af1c480cbc21b4e54230a06a53521ec481b8a31ad3dede773eda6
3
+ size 6611155672
model-00015-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c815df50218f15e97371ad7965563af8378f9ecfbf45d284b8f25536eed2a5e
3
+ size 6613543005
model-00016-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:826ece4eeb60c44b88812998d307a7e40fcf4a0437f2babb53201cdb054df9b0
3
+ size 6611155672
model-00017-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:956d917971973e211f3128368eaa42c178ee3824fbfc3a5d29caaece0164616c
3
+ size 6611155672
model-00018-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:700a7579879ca33bba532162ce999fd0ee8649a5db65208726506e768e7af832
3
+ size 6613543005
model-00019-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c91381268219ec82c8771c1644411e64f18a3bdc7b82fb199e2ccfc626023141
3
+ size 6611155672
model-00020-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:121d86aaa9b0547cd68e6fc7e89c1041f5ebde48b752e90af7b29e70e5879cf5
3
+ size 6611155672
model-00021-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:499e3e378115912207a89cc2f07ee7bbd952a14f4e7ea13483e7a404192cb85a
3
+ size 6613543005
model-00022-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:816e1a8c012fe45c1365374b04ce8704d28f9e3eb7c2c82d718abe36235add83
3
+ size 6611155672
model-00023-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c9b0bb5671a96c959ae40321c50660778ebaabe17d816b3aa99358dd1fc8e79
3
+ size 6611155672
model-00024-of-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6368e5481852c67d9495de04fdfc8514a971ffacc345e0b1247576aa312bb5e
3
+ size 3776999554
model.safetensors.index.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fb058ed285464a798f34a53445d24b2b488d3c768574e322c717205607c3021
3
+ size 13521151
modeling_naive_n05_flash.py ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Naive AI.
2
+ # Copyright 2026 The HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from copy import copy
17
+
18
+ import torch
19
+ from torch import nn
20
+ from transformers.cache_utils import DynamicCache
21
+ from transformers.conversion_mapping import get_checkpoint_conversion_mapping, register_checkpoint_conversion_mapping
22
+ from transformers.generation import GenerationMixin
23
+ from transformers.modeling_outputs import CausalLMOutputWithPast
24
+ from transformers.modeling_utils import PreTrainedModel
25
+ from transformers.models.deepseek_v3.modeling_deepseek_v3 import DeepseekV3Experts, DeepseekV3TopkRouter
26
+ from transformers.models.deepseek_v3.modeling_deepseek_v3 import DeepseekV3MLP as NaiveN05FlashMLP
27
+ from transformers.models.gpt_neox.modeling_gpt_neox import GPTNeoXRotaryEmbedding as NaiveN05FlashRotaryEmbedding
28
+ from transformers.models.gpt_neox.modeling_gpt_neox import apply_rotary_pos_emb
29
+ from transformers.models.llama.modeling_llama import LlamaRMSNorm as NaiveN05FlashRMSNorm
30
+ from transformers.models.llama.modeling_llama import repeat_kv
31
+
32
+ from .configuration_naive_n05_flash import NaiveN05FlashConfig
33
+
34
+ # Fuse experts weights
35
+ # mlp.experts.{i}.{gate,up,down}_proj.weight[_scale_inv] -> mlp.experts.{gate,up,down}_proj.weight[_scale_inv]
36
+ register_checkpoint_conversion_mapping("naive_n05_flash", get_checkpoint_conversion_mapping("deepseek_v3"), overwrite=True)
37
+
38
+
39
+ def round_indexer_fp8(states):
40
+ states = states.float()
41
+ scale = states.abs().amax(dim=-1, keepdim=True).clamp_min(1e-4) / 448.0
42
+ return (states / scale).clamp(-448, 448).to(torch.float8_e4m3fn).float() * scale
43
+
44
+
45
+ class NaiveN05FlashMoE(nn.Module):
46
+ """DeepSeek-V3-style routed experts without a shared expert."""
47
+
48
+ def __init__(self, config):
49
+ super().__init__()
50
+ self.experts = DeepseekV3Experts(config)
51
+ self.gate = DeepseekV3TopkRouter(config)
52
+
53
+ def forward(self, states):
54
+ original_shape = states.shape
55
+ _, topk_weights, topk_indices = self.gate(states)
56
+ states = states.view(-1, states.shape[-1])
57
+ states = self.experts(states, topk_indices, topk_weights)
58
+ return states.view(*original_shape)
59
+
60
+
61
+ class NaiveN05FlashIndexer(nn.Module):
62
+ def __init__(self, config, layer_idx):
63
+ super().__init__()
64
+ self.config = config
65
+ self.layer_idx = layer_idx
66
+ self.wq = nn.Linear(config.hidden_size, config.index_n_heads * config.index_head_dim, bias=False)
67
+ self.wk = nn.Linear(config.hidden_size, config.index_head_dim, bias=False)
68
+ self.k_norm = nn.LayerNorm(config.index_head_dim, eps=1e-5)
69
+ self.weights_proj = nn.Linear(config.hidden_size, config.index_n_heads, bias=False)
70
+
71
+ def forward(self, states, position_embeddings, past_key_values=None):
72
+ c = self.config
73
+ batch, length, _ = states.shape
74
+ query = self.wq(states).view(batch, length, c.index_n_heads, c.index_head_dim).transpose(1, 2)
75
+ key = self.k_norm(self.wk(states)).unsqueeze(1)
76
+ query, key = apply_rotary_pos_emb(query, key, *position_embeddings)
77
+ if c.indexer_activation_dtype == "fp8_e4m3":
78
+ query, key = round_indexer_fp8(query), round_indexer_fp8(key)
79
+ if past_key_values is not None:
80
+ key = past_key_values.update_indexer(key.squeeze(1), self.layer_idx).unsqueeze(1)
81
+ scores = (query.float() @ key.float().transpose(-1, -2)).relu()
82
+ weights = self.weights_proj(states) * c.index_n_heads**-0.5
83
+ return (scores * weights.transpose(1, 2).unsqueeze(-1).float()).sum(dim=1)
84
+
85
+
86
+ class NaiveN05FlashAttention(nn.Module):
87
+ def __init__(self, config, layer_idx):
88
+ super().__init__()
89
+ self.config = config
90
+ self.layer_idx = layer_idx
91
+ self.is_swa = bool(config.hybrid_layer_pattern[layer_idx])
92
+ prefix = "swa_" if self.is_swa else ""
93
+ self.heads = getattr(config, prefix + "num_attention_heads")
94
+ self.kv_heads = getattr(config, prefix + "num_key_value_heads")
95
+ self.head_dim = getattr(config, prefix + "head_dim")
96
+ self.v_dim = getattr(config, prefix + "v_head_dim")
97
+ rope_config = copy(config)
98
+ rope_config.head_dim = self.head_dim
99
+ rope_config.rope_parameters = {
100
+ "rope_type": "default",
101
+ "rope_theta": getattr(config, prefix + "rope_theta"),
102
+ "partial_rotary_factor": config.partial_rotary_factor,
103
+ }
104
+ self.rotary_emb = NaiveN05FlashRotaryEmbedding(rope_config)
105
+ self.q_proj = nn.Linear(config.hidden_size, self.heads * self.head_dim, bias=config.attention_bias)
106
+ self.k_proj = nn.Linear(
107
+ config.hidden_size,
108
+ self.kv_heads * self.head_dim,
109
+ bias=config.attention_bias,
110
+ )
111
+ self.v_proj = nn.Linear(config.hidden_size, self.kv_heads * self.v_dim, bias=config.attention_bias)
112
+ self.o_proj = nn.Linear(self.heads * self.v_dim, config.hidden_size, bias=False)
113
+ self.indexer = None if self.is_swa else NaiveN05FlashIndexer(config, layer_idx)
114
+ sink = config.add_swa_attention_sink_bias if self.is_swa else config.add_full_attention_sink_bias
115
+ self.attention_sink_bias = nn.Parameter(torch.zeros(self.heads), requires_grad=False) if sink else None
116
+
117
+ def forward(self, states, positions, allowed, past_key_values=None):
118
+ batch, length, _ = states.shape
119
+ past_length = 0 if past_key_values is None else past_key_values.get_seq_length(self.layer_idx)
120
+ key_offset = 0 if past_key_values is None else past_key_values.get_mask_sizes(length, self.layer_idx)[1]
121
+ query = self.q_proj(states).view(batch, length, self.heads, self.head_dim).transpose(1, 2)
122
+ key = self.k_proj(states).view(batch, length, self.kv_heads, self.head_dim).transpose(1, 2)
123
+ value = self.v_proj(states).view(batch, length, self.kv_heads, self.v_dim).transpose(1, 2)
124
+ position_embeddings = self.rotary_emb(states, positions)
125
+ query, key = apply_rotary_pos_emb(query, key, *position_embeddings)
126
+ if past_key_values is not None:
127
+ key, value = past_key_values.update(key, value, self.layer_idx)
128
+ key_length = key.shape[-2]
129
+ allowed = allowed[..., key_offset : key_offset + key_length]
130
+ if self.is_swa:
131
+ query_offsets = past_length + torch.arange(length, device=states.device)
132
+ key_offsets = key_offset + torch.arange(key_length, device=states.device)
133
+ allowed = allowed & (query_offsets[:, None] - key_offsets[None, :] < self.config.sliding_window)
134
+ else:
135
+ scores = self.indexer(states, position_embeddings, past_key_values).masked_fill(~allowed, -torch.inf)
136
+ # Stable ties keep padding from changing which equal-score keys win.
137
+ selected = scores.argsort(dim=-1, descending=True, stable=True)[..., : self.config.index_top_k]
138
+ allowed = allowed & torch.zeros_like(scores, dtype=torch.bool).scatter(-1, selected, True)
139
+ key = repeat_kv(key, self.heads // self.kv_heads)
140
+ value = repeat_kv(value, self.heads // self.kv_heads)
141
+ if self.config.attention_value_scale is not None:
142
+ value = value * self.config.attention_value_scale
143
+ logits = (query @ key.transpose(-1, -2)) * self.head_dim**-0.5
144
+ logits = logits.masked_fill(~allowed[:, None], -torch.inf)
145
+ if self.attention_sink_bias is not None:
146
+ sink = self.attention_sink_bias[None, :, None, None].expand(batch, -1, length, -1)
147
+ logits = torch.cat((logits, sink), dim=-1)
148
+ probabilities = logits.float().softmax(-1).nan_to_num(0.0)[..., :key_length].to(value.dtype)
149
+ output = (probabilities @ value).transpose(1, 2).reshape(batch, length, -1)
150
+ return self.o_proj(output)
151
+
152
+
153
+ class NaiveN05FlashDecoderLayer(nn.Module):
154
+ def __init__(self, config, layer_idx):
155
+ super().__init__()
156
+ self.self_attn = NaiveN05FlashAttention(config, layer_idx)
157
+ self.mlp = NaiveN05FlashMoE(config) if config.moe_layer_freq[layer_idx] else NaiveN05FlashMLP(config)
158
+ self.input_layernorm = NaiveN05FlashRMSNorm(config.hidden_size, config.layernorm_epsilon)
159
+ self.post_attention_layernorm = NaiveN05FlashRMSNorm(config.hidden_size, config.layernorm_epsilon)
160
+
161
+ def forward(self, states, positions, allowed, past_key_values=None):
162
+ states = states + self.self_attn(self.input_layernorm(states), positions, allowed, past_key_values)
163
+ return states + self.mlp(self.post_attention_layernorm(states))
164
+
165
+
166
+ class NaiveN05FlashModel(PreTrainedModel):
167
+ config_class = NaiveN05FlashConfig
168
+ base_model_prefix = "model"
169
+ _can_set_experts_implementation_cached_value = True
170
+
171
+ def __init__(self, config):
172
+ super().__init__(config)
173
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size)
174
+ self.layers = nn.ModuleList([NaiveN05FlashDecoderLayer(config, i) for i in range(config.num_hidden_layers)])
175
+ self.norm = NaiveN05FlashRMSNorm(config.hidden_size, config.layernorm_epsilon)
176
+
177
+ def forward(self, states, positions, allowed, past_key_values=None):
178
+ for layer in self.layers:
179
+ states = layer(states, positions, allowed, past_key_values)
180
+ return self.norm(states)
181
+
182
+
183
+ class NaiveN05FlashForCausalLM(PreTrainedModel, GenerationMixin):
184
+ config_class = NaiveN05FlashConfig
185
+ base_model_prefix = "model"
186
+ _no_split_modules = ["NaiveN05FlashDecoderLayer"]
187
+ _skip_keys_device_placement = ["past_key_values"]
188
+ _keep_in_fp32_modules_strict = ["mlp.gate.weight", "mlp.gate.e_score_correction_bias"]
189
+ _can_set_experts_implementation_cached_value = True
190
+
191
+ def __init__(self, config):
192
+ config.validate()
193
+ super().__init__(config)
194
+ self.model = NaiveN05FlashModel(config)
195
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
196
+ self.post_init()
197
+ self.eval().requires_grad_(False)
198
+
199
+ def get_input_embeddings(self):
200
+ return self.model.embed_tokens
201
+
202
+ def get_output_embeddings(self):
203
+ return self.lm_head
204
+
205
+ @torch.inference_mode()
206
+ def forward(
207
+ self,
208
+ input_ids=None,
209
+ attention_mask=None,
210
+ position_ids=None,
211
+ inputs_embeds=None,
212
+ use_cache=None,
213
+ past_key_values=None,
214
+ **kwargs,
215
+ ):
216
+ use_cache = self.config.use_cache if use_cache is None else use_cache
217
+ if past_key_values is not None and not use_cache:
218
+ raise ValueError("Pass use_cache=True when providing past_key_values")
219
+ if use_cache and past_key_values is None:
220
+ past_key_values = DynamicCache(config=self.config)
221
+ if past_key_values is not None and not isinstance(past_key_values, DynamicCache):
222
+ raise ValueError("NaiveN05Flash supports DynamicCache only")
223
+ if (input_ids is None) == (inputs_embeds is None):
224
+ raise ValueError("Provide exactly one of input_ids or inputs_embeds")
225
+ states = self.model.embed_tokens(input_ids) if inputs_embeds is None else inputs_embeds
226
+ batch, length, _ = states.shape
227
+ past_length = 0 if past_key_values is None else past_key_values.get_seq_length()
228
+ total_length = past_length + length
229
+ if attention_mask is None:
230
+ attention_mask = torch.ones(batch, total_length, device=states.device, dtype=torch.bool)
231
+ if attention_mask.shape != (batch, total_length):
232
+ raise ValueError("Expected a 2-D attention_mask covering the cached prefix and new tokens")
233
+ if position_ids is None:
234
+ position_ids = (attention_mask.long().cumsum(-1) - 1).clamp_min(0)[:, -length:]
235
+ query_offsets = past_length + torch.arange(length, device=states.device)
236
+ key_offsets = torch.arange(total_length, device=states.device)
237
+ allowed = query_offsets[:, None] >= key_offsets[None, :]
238
+ allowed = allowed[None] & attention_mask[:, None].bool()
239
+ logits = self.lm_head(self.model(states, position_ids, allowed, past_key_values))
240
+ return CausalLMOutputWithPast(logits=logits, past_key_values=past_key_values)
241
+
242
+
243
+ __all__ = ["NaiveN05FlashForCausalLM", "NaiveN05FlashModel"]
quantization_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c7110f110f3a2df203835d6c95f4d4cd145bf6536bfe3b527d91e60f89b8d1a
3
+ size 44681475
special_tokens_map.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "eos_token": "<|im_end|>",
3
+ "pad_token": "<|endoftext|>",
4
+ "additional_special_tokens": [
5
+ "<|im_start|>",
6
+ "<|im_end|>",
7
+ "<|object_ref_start|>",
8
+ "<|object_ref_end|>",
9
+ "<|box_start|>",
10
+ "<|box_end|>",
11
+ "<|quad_start|>",
12
+ "<|quad_end|>",
13
+ "<|vision_start|>",
14
+ "<|vision_end|>",
15
+ "<|vision_pad|>",
16
+ "<|image_pad|>",
17
+ "<|video_pad|>",
18
+ "<|audio_pad|>"
19
+ ]
20
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_comment": "Tokenizer copied from the open-source MiMo 2.5",
3
+ "add_bos_token": false,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "151643": {
7
+ "content": "<|endoftext|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "151644": {
15
+ "content": "<|im_start|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "151645": {
23
+ "content": "<|im_end|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "151646": {
31
+ "content": "<|object_ref_start|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "151647": {
39
+ "content": "<|object_ref_end|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "151648": {
47
+ "content": "<|box_start|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "151649": {
55
+ "content": "<|box_end|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "151650": {
63
+ "content": "<|quad_start|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "151651": {
71
+ "content": "<|quad_end|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "151652": {
79
+ "content": "<|vision_start|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "151653": {
87
+ "content": "<|vision_end|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "151654": {
95
+ "content": "<|vision_pad|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "151655": {
103
+ "content": "<|image_pad|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "151656": {
111
+ "content": "<|video_pad|>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ },
118
+ "151657": {
119
+ "content": "<tool_call>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "151658": {
127
+ "content": "</tool_call>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "151659": {
135
+ "content": "<|fim_prefix|>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "151660": {
143
+ "content": "<|fim_middle|>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "151661": {
151
+ "content": "<|fim_suffix|>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "151662": {
159
+ "content": "<|fim_pad|>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "151663": {
167
+ "content": "<|repo_name|>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "151664": {
175
+ "content": "<|file_sep|>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": false
181
+ },
182
+ "151665": {
183
+ "content": "<tool_response>",
184
+ "lstrip": false,
185
+ "normalized": false,
186
+ "rstrip": false,
187
+ "single_word": false,
188
+ "special": false
189
+ },
190
+ "151666": {
191
+ "content": "</tool_response>",
192
+ "lstrip": false,
193
+ "normalized": false,
194
+ "rstrip": false,
195
+ "single_word": false,
196
+ "special": false
197
+ },
198
+ "151667": {
199
+ "content": "<think>",
200
+ "lstrip": false,
201
+ "normalized": false,
202
+ "rstrip": false,
203
+ "single_word": false,
204
+ "special": false
205
+ },
206
+ "151668": {
207
+ "content": "</think>",
208
+ "lstrip": false,
209
+ "normalized": false,
210
+ "rstrip": false,
211
+ "single_word": false,
212
+ "special": false
213
+ },
214
+ "151669": {
215
+ "content": "<|audio_pad|>",
216
+ "lstrip": false,
217
+ "normalized": false,
218
+ "rstrip": false,
219
+ "single_word": false,
220
+ "special": true
221
+ }
222
+ },
223
+ "additional_special_tokens": [
224
+ "<|im_start|>",
225
+ "<|im_end|>",
226
+ "<|object_ref_start|>",
227
+ "<|object_ref_end|>",
228
+ "<|box_start|>",
229
+ "<|box_end|>",
230
+ "<|quad_start|>",
231
+ "<|quad_end|>",
232
+ "<|vision_start|>",
233
+ "<|vision_end|>",
234
+ "<|vision_pad|>",
235
+ "<|image_pad|>",
236
+ "<|video_pad|>",
237
+ "<|audio_pad|>"
238
+ ],
239
+ "bos_token": null,
240
+ "clean_up_tokenization_spaces": false,
241
+ "eos_token": "<|im_end|>",
242
+ "errors": "replace",
243
+ "model_max_length": 1048576,
244
+ "pad_token": "<|endoftext|>",
245
+ "split_special_tokens": false,
246
+ "tokenizer_class": "Qwen2Tokenizer",
247
+ "unk_token": null
248
+ }
vocab.README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # vocab.json
2
+
3
+ Tokenizer copied from the open-source MiMo 2.5
vocab.json ADDED
The diff for this file is too large to render. See raw diff