deepgrove-team commited on
Commit
361db5d
·
verified ·
1 Parent(s): 1ac3d4e

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
chat_template.jinja ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- '# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' }}
7
+ {%- for tool in tools %}
8
+ {{- '\n' }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- '\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n' }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+
18
+
19
+ {%- for message in messages %}
20
+ {%- if message.content is string %}
21
+ {%- set content = message.content %}
22
+ {%- else %}
23
+ {%- set content = '' %}
24
+ {%- endif %}
25
+
26
+ {%- if message.role == 'user' or (message.role == 'system' and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>\n' }}
28
+
29
+ {%- elif message.role == 'assistant' %}
30
+ {%- set reasoning_content = '' %}
31
+
32
+ {%- if message.reasoning_content is string %}
33
+ {%- set reasoning_content = message.reasoning_content %}
34
+ {%- elif '</think>' in content %}
35
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
36
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+
39
+ {%- if reasoning_content %}
40
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
41
+ {%- else %}
42
+ {{- '<|im_start|>' + message.role + '\n' + content }}
43
+ {%- endif %}
44
+
45
+ {%- if message.tool_calls %}
46
+ {%- for tool_call in message.tool_calls %}
47
+ {%- if (loop.first and content) or not loop.first %}
48
+ {{- '\n' }}
49
+ {%- endif %}
50
+
51
+ {%- if tool_call.function %}
52
+ {%- set tool_call = tool_call.function %}
53
+ {%- endif %}
54
+
55
+ {{- '<tool_call>\n{\"name\": \"' }}
56
+ {{- tool_call.name }}
57
+ {{- '\", \"arguments\": ' }}
58
+
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+
65
+ {{- '}\n</tool_call>' }}
66
+ {%- endfor %}
67
+ {%- endif %}
68
+
69
+ {{- '<|im_end|>\n' }}
70
+
71
+ {%- elif message.role == 'tool' %}
72
+ {%- if loop.first or messages[loop.index0 - 1].role != 'tool' %}
73
+ {{- '<|im_start|>user' }}
74
+ {%- endif %}
75
+
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+
80
+ {%- if loop.last or messages[loop.index0 + 1].role != 'tool' %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+
86
+ {%- if add_generation_prompt %}
87
+ {{- '<|im_start|>assistant\n<think>\n' }}
88
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MapleForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "dtype": "bfloat16",
8
+ "embedding_dropout": 0.0,
9
+ "eos_token_id": 151645,
10
+ "first_k_dense_replace": 0,
11
+ "flash_head": {
12
+ "bits": 4,
13
+ "cluster_size": 32,
14
+ "force_tokens": [
15
+ 151645,
16
+ 151668,
17
+ 151643
18
+ ],
19
+ "group_size": 64,
20
+ "head_bits": 4,
21
+ "head_group_size": 64,
22
+ "n_clusters": 4748,
23
+ "n_probes": 512,
24
+ "scaled_centroids": true
25
+ },
26
+ "hc": false,
27
+ "head_dim": 128,
28
+ "headwise_gate_swa": false,
29
+ "hidden_act": "silu",
30
+ "hidden_size": 2048,
31
+ "initializer_range": 0.02,
32
+ "intermediate_size": 5120,
33
+ "layer_types": [
34
+ "sliding_attention",
35
+ "sliding_attention",
36
+ "sliding_attention",
37
+ "full_attention",
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "full_attention",
42
+ "sliding_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "full_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "sliding_attention",
49
+ "full_attention",
50
+ "sliding_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "full_attention",
54
+ "sliding_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "full_attention"
58
+ ],
59
+ "max_position_embeddings": 128000,
60
+ "max_window_layers": 24,
61
+ "model_file": "maple.py",
62
+ "model_type": "maple",
63
+ "moe_intermediate_size": 512,
64
+ "moe_router_enable_expert_bias": false,
65
+ "moe_shared_expert_intermediate_size": 512,
66
+ "mtp_loss_scaling_factor": 0,
67
+ "nope_on_global_attention": false,
68
+ "norm_topk_prob": true,
69
+ "num_attention_heads": 16,
70
+ "num_experts": 256,
71
+ "num_experts_per_tok": 8,
72
+ "num_hidden_layers": 24,
73
+ "num_key_value_heads": 4,
74
+ "num_nextn_predict_layers": 0,
75
+ "num_shared_experts": 0,
76
+ "output_dropout": 0.0,
77
+ "output_router_logits": false,
78
+ "pad_token_id": null,
79
+ "partial_rotary_factor": 0.5,
80
+ "preaffine": false,
81
+ "quantization": {
82
+ "bits": 2,
83
+ "group_size": 128,
84
+ "lm_head": {
85
+ "bits": 4,
86
+ "group_size": 64
87
+ },
88
+ "mode": "affine",
89
+ "model.word_embeddings": {
90
+ "bits": 4,
91
+ "group_size": 64
92
+ }
93
+ },
94
+ "quantization_config": {
95
+ "bits": 2,
96
+ "group_size": 128,
97
+ "lm_head": {
98
+ "bits": 4,
99
+ "group_size": 64
100
+ },
101
+ "mode": "affine",
102
+ "model.word_embeddings": {
103
+ "bits": 4,
104
+ "group_size": 64
105
+ }
106
+ },
107
+ "rms_norm_eps": 1e-06,
108
+ "rope_scaling": null,
109
+ "rope_theta": 10000,
110
+ "router_dtype": "fp32",
111
+ "sliding_window": 512,
112
+ "tie_word_embeddings": false,
113
+ "transformers_version": "4.57.1",
114
+ "use_bias": false,
115
+ "use_cache": true,
116
+ "use_qk_norm": true,
117
+ "use_qkv_bias": false,
118
+ "use_rmsnorm": true,
119
+ "vocab_size": 151936
120
+ }
maple.py ADDED
@@ -0,0 +1,1058 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright © 2026 DeepGrove AI.
2
+
3
+ from dataclasses import dataclass
4
+ from functools import partial
5
+ from typing import Any, List, Optional
6
+
7
+ import mlx.core as mx
8
+ import mlx.nn as nn
9
+
10
+ # Absolute imports so this file also works standalone when shipped inside a
11
+ # checkpoint and loaded via the config's `model_file` (trust_remote_code).
12
+ from mlx_lm.models.activations import swiglu
13
+ from mlx_lm.models.base import (
14
+ BaseModelArgs,
15
+ create_attention_mask,
16
+ scaled_dot_product_attention,
17
+ )
18
+ from mlx_lm.models.cache import KVCache, RotatingKVCache
19
+ from mlx_lm.models.rope_utils import initialize_rope
20
+ from mlx_lm.models.switch_layers import SwitchLinear
21
+
22
+ # SwiGLU clamp for the MoE experts only (the dense MapleMLP is unclamped);
23
+ # part of the trained forward pass, not an optional guard.
24
+ MLP_CLAMP = 7.0
25
+
26
+
27
+ @partial(mx.compile, shapeless=True)
28
+ def clamped_swiglu(gate, x):
29
+ # Python floats, not 0-d arrays, so bf16 activations stay bf16.
30
+ return nn.silu(mx.minimum(gate, MLP_CLAMP)) * mx.clip(x, -MLP_CLAMP, MLP_CLAMP)
31
+
32
+
33
+ class MapleRMSNorm(nn.Module):
34
+ """RMSNorm with the weight multiply in float32.
35
+
36
+ The reference rounds only the finished product; mx.fast.rms_norm rounds
37
+ the normalized activation first (~1% per element). Float32 inputs to the
38
+ same kernel reproduce the reference bit-for-bit.
39
+ """
40
+
41
+ def __init__(self, dims: int, eps: float = 1e-6):
42
+ super().__init__()
43
+ self.weight = mx.ones((dims,))
44
+ self.eps = eps
45
+
46
+ def __call__(self, x: mx.array) -> mx.array:
47
+ return mx.fast.rms_norm(
48
+ x.astype(mx.float32), self.weight.astype(mx.float32), self.eps
49
+ ).astype(x.dtype)
50
+
51
+
52
+ def _make_add_rms_norm_kernel(eps):
53
+ """Residual add + RMSNorm in ONE dispatch for single-token decode.
54
+
55
+ Emits both h = x + r (the residual stream, rounded once like a bf16 add)
56
+ and hn = rmsnorm(h) with the weight multiply in fp32 (reference
57
+ semantics, identical to MapleRMSNorm). Folding the add into the norm and
58
+ skipping the astype round-trips replaces ~4 dispatches with 1, and the
59
+ decode step is bounded by its serial dispatch chain, not by this math.
60
+ """
61
+ source = """
62
+ uint tid = thread_position_in_threadgroup.x;
63
+ constexpr uint N = DIM;
64
+ constexpr uint PT = N / 256u;
65
+ float hb[PT];
66
+ float ss = 0.0f;
67
+ for (uint i = 0; i < PT; ++i) {
68
+ uint j = tid * PT + i;
69
+ float v = (float)x[j] + (float)r[j];
70
+ T_ vb = (T_)v; // one rounding, same as a bf16 add
71
+ h_out[j] = vb;
72
+ hb[i] = (float)vb; // norm sees the rounded stream
73
+ ss += hb[i] * hb[i];
74
+ }
75
+ ss = simd_sum(ss);
76
+ threadgroup float sums[8];
77
+ uint sg = tid / 32u;
78
+ uint lane = tid % 32u;
79
+ if (lane == 0u) sums[sg] = ss;
80
+ threadgroup_barrier(mem_flags::mem_threadgroup);
81
+ float tot = 0.0f;
82
+ for (uint i = 0; i < 8u; ++i) tot += sums[i];
83
+ float scale = metal::rsqrt(tot / (float)N + EPS_);
84
+ for (uint i = 0; i < PT; ++i) {
85
+ uint j = tid * PT + i;
86
+ hn_out[j] = (T_)(hb[i] * scale * (float)w[j]);
87
+ }
88
+ """.replace("EPS_", f"{eps:.10e}f")
89
+ tag = f"{eps:.3e}".replace(".", "_").replace("-", "m").replace("+", "p")
90
+ return mx.fast.metal_kernel(
91
+ name=f"maple_add_rms_norm_{tag}",
92
+ input_names=["x", "r", "w"],
93
+ output_names=["h_out", "hn_out"],
94
+ source=source,
95
+ )
96
+
97
+
98
+ _add_rms_kernels = {}
99
+
100
+
101
+ def _add_rms_norm(h, r, w, eps):
102
+ kernel = _add_rms_kernels.get(eps)
103
+ if kernel is None:
104
+ kernel = _add_rms_kernels[eps] = _make_add_rms_norm_kernel(eps)
105
+ return kernel(
106
+ inputs=[h.reshape(-1), r.reshape(-1), w],
107
+ template=[("T_", h.dtype), ("DIM", h.shape[-1])],
108
+ grid=(256, 1, 1),
109
+ threadgroup=(256, 1, 1),
110
+ output_shapes=[h.shape, h.shape],
111
+ output_dtypes=[h.dtype, h.dtype],
112
+ )
113
+
114
+
115
+ # Inlined rather than imported from switch_layers: those helpers are private
116
+ # (underscore-prefixed), and this file must keep loading against whatever
117
+ # mlx-lm a user has installed when it ships inside a checkpoint.
118
+ def _gather_sort(x, indices):
119
+ *_, M = indices.shape
120
+ indices = indices.flatten()
121
+ order = mx.argsort(indices)
122
+ inv_order = mx.argsort(order)
123
+ return x.flatten(0, -3)[order // M], indices[order], inv_order
124
+
125
+
126
+ def _scatter_unsort(x, inv_order, shape=None):
127
+ x = x[inv_order]
128
+ if shape is not None:
129
+ x = mx.unflatten(x, 0, shape)
130
+ return x
131
+
132
+
133
+ @dataclass
134
+ class ModelArgs(BaseModelArgs):
135
+ model_type: str = "maple"
136
+ hidden_size: int = 2048
137
+ intermediate_size: int = 5120
138
+ moe_intermediate_size: int = 512
139
+ num_hidden_layers: int = 24
140
+ num_attention_heads: int = 16
141
+ num_key_value_heads: int = 4
142
+ head_dim: int = 128
143
+ num_experts: int = 256
144
+ num_experts_per_tok: int = 8
145
+ first_k_dense_replace: int = 0
146
+ rms_norm_eps: float = 1e-6
147
+ rope_theta: float = 10000.0
148
+ rope_scaling: Optional[dict] = None
149
+ partial_rotary_factor: float = 0.5
150
+ max_position_embeddings: int = 140000
151
+ vocab_size: int = 151936
152
+ sliding_window: int = 512
153
+ layer_types: Optional[List[str]] = None
154
+ use_qk_norm: bool = True
155
+ use_bias: bool = False
156
+ tie_word_embeddings: bool = False
157
+ # FlashHead metadata written by `mlx_lm.ternary --flash-head`. The exact
158
+ # lm_head is the default; opt in to the approximate fast head with
159
+ # mlx_lm.load(..., model_config={"use_flash_head": True}).
160
+ flash_head: Optional[dict] = None
161
+ use_flash_head: bool = False
162
+ # Populated from the checkpoint's config; sanitize() reads group_size from
163
+ # it to expand row-scale (`row_alpha`) ternary tensors.
164
+ quantization: Optional[dict] = None
165
+
166
+ def __post_init__(self):
167
+ # Single source of truth for per-layer attention types: attention
168
+ # (RoPE/NoPE), masks, and caches all read this resolved list.
169
+ if not self.layer_types:
170
+ self.layer_types = ["full_attention"] * self.num_hidden_layers
171
+
172
+
173
+ def _make_qk_norm_rope_kernel():
174
+ """Fused per-head RMSNorm + partial RoPE for single-token decode.
175
+
176
+ One dispatch replaces q_norm, k_norm and two rope calls. One simdgroup per
177
+ head: normalize head_dim values, scale by the head's norm weight, and
178
+ rotate the first ROPE_DIM dims (non-traditional pairing i, i+R/2) at the
179
+ given position. NoPE layers pass ROPE_DIM=0.
180
+ """
181
+ source = """
182
+ uint head = thread_position_in_grid.y;
183
+ uint lane = thread_position_in_grid.x;
184
+
185
+ constexpr int per_lane = HEAD_DIM / 32;
186
+ const device T_* xh = x + head * HEAD_DIM;
187
+ const device T_* wh = w + head * HEAD_DIM;
188
+ device T_* oh = out + head * HEAD_DIM;
189
+
190
+ float ss = 0.0f;
191
+ for (int i = 0; i < per_lane; ++i) {
192
+ float v = (float)xh[lane * per_lane + i];
193
+ ss += v * v;
194
+ }
195
+ ss = simd_sum(ss);
196
+ float pos = pos_eps[0];
197
+ float eps = pos_eps[1];
198
+ float scale = metal::rsqrt(ss / HEAD_DIM + eps);
199
+
200
+ for (int i = 0; i < per_lane; ++i) {
201
+ int j = lane * per_lane + i;
202
+ float v = (float)xh[j] * scale * (float)wh[j];
203
+ if (ROPE_DIM > 0 && j < ROPE_DIM) {
204
+ constexpr int rhalf = ROPE_DIM > 0 ? ROPE_DIM / 2 : 1;
205
+ int p = j < rhalf ? j : j - rhalf;
206
+ float theta = pos * inv_freq[p];
207
+ float c = metal::cos(theta);
208
+ float s = metal::sin(theta);
209
+ int j2 = j < rhalf ? j + rhalf : j - rhalf;
210
+ float u = (float)xh[j2] * scale * (float)wh[j2];
211
+ v = j < rhalf ? (v * c - u * s) : (v * c + u * s);
212
+ }
213
+ oh[j] = (T_)v;
214
+ }
215
+ """
216
+ return mx.fast.metal_kernel(
217
+ name="maple_qk_norm_rope",
218
+ input_names=["x", "w", "inv_freq", "pos_eps"],
219
+ output_names=["out"],
220
+ source=source,
221
+ )
222
+
223
+
224
+ _qk_norm_rope_kernel = _make_qk_norm_rope_kernel()
225
+
226
+
227
+ class MapleAttention(nn.Module):
228
+ def __init__(self, args: ModelArgs, layer_idx: int):
229
+ super().__init__()
230
+ self.num_attention_heads = args.num_attention_heads
231
+ self.num_key_value_heads = args.num_key_value_heads
232
+ self.head_dim = args.head_dim or args.hidden_size // args.num_attention_heads
233
+ self.scale = self.head_dim**-0.5
234
+ self.use_qk_norm = args.use_qk_norm
235
+
236
+ # q/k/v are stored fused (one matmul per step); sanitize() concatenates
237
+ # the checkpoint's split projections.
238
+ self.qkv_proj = nn.Linear(
239
+ args.hidden_size,
240
+ (args.num_attention_heads + 2 * args.num_key_value_heads)
241
+ * self.head_dim,
242
+ bias=args.use_bias,
243
+ )
244
+ self.o_proj = nn.Linear(
245
+ args.num_attention_heads * self.head_dim,
246
+ args.hidden_size,
247
+ bias=args.use_bias,
248
+ )
249
+
250
+ if args.use_qk_norm:
251
+ self.q_norm = MapleRMSNorm(self.head_dim, eps=args.rms_norm_eps)
252
+ self.k_norm = MapleRMSNorm(self.head_dim, eps=args.rms_norm_eps)
253
+ self._eps = args.rms_norm_eps
254
+ self._rope_base = args.rope_theta
255
+ self._qk_w = None
256
+ self._inv_freq = None
257
+
258
+ # Maple applies RoPE only on sliding-window layers; full-attention
259
+ # layers use no positional encoding (NoPE).
260
+ self.use_rope = args.layer_types[layer_idx] == "sliding_attention"
261
+ if self.use_rope:
262
+ rope_dim = int(self.head_dim * args.partial_rotary_factor)
263
+ self.rope = initialize_rope(
264
+ rope_dim,
265
+ args.rope_theta,
266
+ traditional=False,
267
+ scaling_config=args.rope_scaling,
268
+ max_position_embeddings=args.max_position_embeddings,
269
+ )
270
+
271
+ def __call__(
272
+ self,
273
+ x: mx.array,
274
+ mask: Optional[mx.array] = None,
275
+ cache: Optional[Any] = None,
276
+ ) -> mx.array:
277
+ B, L, _ = x.shape
278
+
279
+ qkv = self.qkv_proj(x)
280
+ q_size = self.num_attention_heads * self.head_dim
281
+ kv_size = self.num_key_value_heads * self.head_dim
282
+
283
+ if B == 1 and L == 1 and self.use_qk_norm:
284
+ # Single-token decode: one fused dispatch for both norms and both
285
+ # rope applications.
286
+ n_q = self.num_attention_heads
287
+ n_kv = self.num_key_value_heads
288
+ if self._qk_w is None:
289
+ self._qk_w = mx.contiguous(
290
+ mx.concatenate(
291
+ [
292
+ mx.broadcast_to(
293
+ self.q_norm.weight[None], (n_q, self.head_dim)
294
+ ),
295
+ mx.broadcast_to(
296
+ self.k_norm.weight[None], (n_kv, self.head_dim)
297
+ ),
298
+ ]
299
+ )
300
+ )
301
+ if self.use_rope:
302
+ half = self.rope.dims // 2
303
+ self._inv_freq = self._rope_base ** (
304
+ -mx.arange(half, dtype=mx.float32) / half
305
+ )
306
+ else:
307
+ self._inv_freq = mx.ones((1,), dtype=mx.float32)
308
+ mx.eval(self._qk_w, self._inv_freq)
309
+
310
+ # cache.offset is a Python int for a plain cache but an mx.array
311
+ # for the server's mergeable prompt cache; coerce to a scalar so
312
+ # the pos/eps pair is always uniform.
313
+ offset = cache.offset if cache is not None else 0
314
+ pos_eps = mx.array([float(offset), self._eps], dtype=mx.float32)
315
+ qk = qkv.reshape(-1)[: (n_q + n_kv) * self.head_dim].reshape(
316
+ n_q + n_kv, self.head_dim
317
+ )
318
+ out = _qk_norm_rope_kernel(
319
+ inputs=[qk, self._qk_w, self._inv_freq, pos_eps],
320
+ template=[
321
+ ("T_", qkv.dtype),
322
+ ("HEAD_DIM", self.head_dim),
323
+ ("ROPE_DIM", self.rope.dims if self.use_rope else 0),
324
+ ],
325
+ grid=(32, n_q + n_kv, 1),
326
+ threadgroup=(32, 1, 1),
327
+ output_shapes=[qk.shape],
328
+ output_dtypes=[qkv.dtype],
329
+ )[0]
330
+ queries = out[:n_q].reshape(1, n_q, 1, self.head_dim)
331
+ keys = out[n_q:].reshape(1, n_kv, 1, self.head_dim)
332
+ values = qkv.reshape(-1)[(n_q + n_kv) * self.head_dim :].reshape(
333
+ 1, n_kv, 1, self.head_dim
334
+ )
335
+ else:
336
+ q, k, v = mx.split(qkv, [q_size, q_size + kv_size], axis=-1)
337
+
338
+ queries = q.reshape(B, L, self.num_attention_heads, self.head_dim)
339
+ keys = k.reshape(B, L, self.num_key_value_heads, self.head_dim)
340
+ values = v.reshape(B, L, self.num_key_value_heads, self.head_dim)
341
+
342
+ if self.use_qk_norm:
343
+ queries = self.q_norm(queries)
344
+ keys = self.k_norm(keys)
345
+
346
+ queries = queries.transpose(0, 2, 1, 3)
347
+ keys = keys.transpose(0, 2, 1, 3)
348
+ values = values.transpose(0, 2, 1, 3)
349
+
350
+ if self.use_rope:
351
+ offset = cache.offset if cache is not None else 0
352
+ queries = self.rope(queries, offset=offset)
353
+ keys = self.rope(keys, offset=offset)
354
+
355
+ if cache is not None:
356
+ keys, values = cache.update_and_fetch(keys, values)
357
+
358
+ output = scaled_dot_product_attention(
359
+ queries, keys, values, cache=cache, scale=self.scale, mask=mask
360
+ )
361
+
362
+ output = output.transpose(0, 2, 1, 3).reshape(B, L, -1)
363
+ return self.o_proj(output)
364
+
365
+
366
+ class MapleMLP(nn.Module):
367
+ def __init__(self, args: ModelArgs, intermediate_size: Optional[int] = None):
368
+ super().__init__()
369
+ intermediate_size = intermediate_size or args.intermediate_size
370
+ self.gate_proj = nn.Linear(args.hidden_size, intermediate_size, bias=args.use_bias)
371
+ self.up_proj = nn.Linear(args.hidden_size, intermediate_size, bias=args.use_bias)
372
+ self.down_proj = nn.Linear(intermediate_size, args.hidden_size, bias=args.use_bias)
373
+
374
+ def __call__(self, x) -> mx.array:
375
+ # Dense / shared-expert MLP: no clamp; only the MoE experts clamp.
376
+ # Unused at first_k_dense_replace=0 with no shared experts, but keep
377
+ # it faithful.
378
+ return self.down_proj(swiglu(self.gate_proj(x), self.up_proj(x)))
379
+
380
+
381
+ @mx.compile
382
+ def group_expert_select(gates, top_k):
383
+ # Maple routes with a plain softmax over all experts followed by top-k
384
+ # selection and renormalization, computed in float32.
385
+ scores = mx.softmax(gates.astype(mx.float32), axis=-1)
386
+ inds = mx.argpartition(scores, kth=-top_k, axis=-1)[..., -top_k:]
387
+ scores = mx.take_along_axis(scores, inds, axis=-1)
388
+ scores = scores / (scores.sum(axis=-1, keepdims=True) + 1e-20)
389
+ return inds, scores
390
+
391
+
392
+ def _make_fused_router_kernel():
393
+ """Router gemv + softmax + top-8 + renormalize in ONE dispatch (+18%).
394
+
395
+ Replaces ~6 kernels per layer. NE/32 threadgroups each compute 32 logits,
396
+ keep them in float32 (`router_dtype: fp32`), and publish through an
397
+ atomic-float scratch (plain device stores are not reliably visible across
398
+ threadgroups on Apple GPUs); the last threadgroup to arrive does the
399
+ softmax + top-8 + renorm.
400
+ """
401
+ source = """
402
+ constexpr uint NE = NEXP;
403
+ constexpr uint D = DIM;
404
+ constexpr uint NTG = NE / 32u;
405
+ constexpr uint TM = 4u;
406
+ constexpr uint TN = 4u;
407
+ constexpr uint BLOCKN = 32u * TN;
408
+ constexpr uint NITER = D / BLOCKN;
409
+
410
+ uint tid = thread_position_in_threadgroup.x;
411
+ uint tgid = threadgroup_position_in_grid.x;
412
+ uint n_threads = 256u;
413
+ uint sg_id = tid / 32u;
414
+ uint lane = tid % 32u;
415
+ uint n_sg = n_threads / 32u;
416
+
417
+ uint row0 = tgid * (n_sg * TM) + sg_id * TM;
418
+ float result[TM] = {0.0f, 0.0f, 0.0f, 0.0f};
419
+ uint bn = lane * TN;
420
+ for (uint i = 0u; i < NITER; ++i) {
421
+ float v[TN];
422
+ for (uint tn = 0u; tn < TN; ++tn) v[tn] = float(x[bn + tn]);
423
+ for (uint tm = 0u; tm < TM; ++tm) {
424
+ const device T_* wrow = w + (ulong)(row0 + tm) * D;
425
+ T_ inter[TN];
426
+ for (uint tn = 0u; tn < TN; ++tn) inter[tn] = wrow[bn + tn];
427
+ for (uint tn = 0u; tn < TN; ++tn) result[tm] += inter[tn] * v[tn];
428
+ }
429
+ bn += BLOCKN;
430
+ }
431
+ for (uint tm = 0u; tm < TM; ++tm) {
432
+ for (ushort sn = 16; sn >= 1; sn >>= 1) {
433
+ result[tm] += simd_shuffle_down(result[tm], sn);
434
+ }
435
+ }
436
+ device atomic_float* ls = (device atomic_float*)logits_scratch;
437
+ if (lane == 0u) {
438
+ for (uint tm = 0u; tm < TM; ++tm) {
439
+ atomic_store_explicit(&ls[row0 + tm], result[tm],
440
+ memory_order_relaxed);
441
+ }
442
+ }
443
+
444
+ threadgroup_barrier(mem_flags::mem_device);
445
+ threadgroup uint last_flag;
446
+ if (tid == 0u) {
447
+ device atomic_uint* ctr = (device atomic_uint*)ctr_in;
448
+ uint prev = atomic_fetch_add_explicit(ctr, 1u, memory_order_relaxed);
449
+ uint last = (prev == NTG - 1u) ? 1u : 0u;
450
+ if (last == 1u) atomic_store_explicit(ctr, 0u, memory_order_relaxed);
451
+ last_flag = last;
452
+ }
453
+ threadgroup_barrier(mem_flags::mem_threadgroup);
454
+ if (last_flag == 0u) return;
455
+ threadgroup_barrier(mem_flags::mem_device);
456
+
457
+ float my_max = -1e30f;
458
+ for (uint e = tid; e < NE; e += n_threads) {
459
+ float v = atomic_load_explicit(&ls[e], memory_order_relaxed);
460
+ if (v > my_max) my_max = v;
461
+ }
462
+ for (int off = 16; off > 0; off >>= 1) {
463
+ float other = simd_shuffle_down(my_max, off);
464
+ if (other > my_max) my_max = other;
465
+ }
466
+ threadgroup float sg_red[16];
467
+ if (lane == 0u) sg_red[sg_id] = my_max;
468
+ threadgroup_barrier(mem_flags::mem_threadgroup);
469
+ if (tid == 0u) {
470
+ float m = sg_red[0];
471
+ for (uint s = 1u; s < n_sg; s++) if (sg_red[s] > m) m = sg_red[s];
472
+ sg_red[0] = m;
473
+ }
474
+ threadgroup_barrier(mem_flags::mem_threadgroup);
475
+ float lmax = sg_red[0];
476
+
477
+ threadgroup float scores[NE];
478
+ float my_sum = 0.0f;
479
+ for (uint e = tid; e < NE; e += n_threads) {
480
+ float lv = atomic_load_explicit(&ls[e], memory_order_relaxed);
481
+ float v = metal::exp(lv - lmax);
482
+ scores[e] = v;
483
+ my_sum += v;
484
+ }
485
+ for (int off = 16; off > 0; off >>= 1) {
486
+ my_sum += simd_shuffle_down(my_sum, off);
487
+ }
488
+ threadgroup_barrier(mem_flags::mem_threadgroup);
489
+ if (lane == 0u) sg_red[sg_id] = my_sum;
490
+ threadgroup_barrier(mem_flags::mem_threadgroup);
491
+ if (tid == 0u) {
492
+ float ssum = sg_red[0];
493
+ for (uint i = 1u; i < n_sg; i++) ssum += sg_red[i];
494
+ sg_red[0] = ssum;
495
+ }
496
+ threadgroup_barrier(mem_flags::mem_threadgroup);
497
+ float inv_total = 1.0f / (sg_red[0] + 1e-20f);
498
+ for (uint e = tid; e < NE; e += n_threads) {
499
+ scores[e] = scores[e] * inv_total;
500
+ }
501
+ threadgroup_barrier(mem_flags::mem_threadgroup);
502
+
503
+ threadgroup int topk_idx[8];
504
+ threadgroup float topk_val[8];
505
+ threadgroup uint8_t used[NE];
506
+ for (uint e = tid; e < NE; e += n_threads) used[e] = 0;
507
+ threadgroup_barrier(mem_flags::mem_threadgroup);
508
+
509
+ for (int k = 0; k < 8; k++) {
510
+ float my_best = -1e30f;
511
+ int my_idx = 0;
512
+ for (int e = int(tid); e < int(NE); e += int(n_threads)) {
513
+ if (!used[e] && scores[e] > my_best) {
514
+ my_best = scores[e];
515
+ my_idx = e;
516
+ }
517
+ }
518
+ for (int off = 16; off > 0; off >>= 1) {
519
+ float other_v = simd_shuffle_down(my_best, off);
520
+ int other_i = simd_shuffle_down(my_idx, off);
521
+ if (other_v > my_best) { my_best = other_v; my_idx = other_i; }
522
+ }
523
+ threadgroup float sg_vals[16];
524
+ threadgroup int sg_idxs[16];
525
+ if (lane == 0u) { sg_vals[sg_id] = my_best; sg_idxs[sg_id] = my_idx; }
526
+ threadgroup_barrier(mem_flags::mem_threadgroup);
527
+ if (tid == 0u) {
528
+ float bv = sg_vals[0]; int bi = sg_idxs[0];
529
+ for (uint s = 1u; s < n_sg; s++) {
530
+ if (sg_vals[s] > bv) { bv = sg_vals[s]; bi = sg_idxs[s]; }
531
+ }
532
+ topk_val[k] = bv; topk_idx[k] = bi;
533
+ used[bi] = 1;
534
+ }
535
+ threadgroup_barrier(mem_flags::mem_threadgroup);
536
+ }
537
+
538
+ if (tid < 8u) {
539
+ float sel_sum = 0.0f;
540
+ for (int i = 0; i < 8; i++) sel_sum += topk_val[i];
541
+ out_indices[tid] = topk_idx[tid];
542
+ out_scores[tid] = float(topk_val[tid] / (sel_sum + 1e-20f));
543
+ }
544
+ """
545
+ return mx.fast.metal_kernel(
546
+ name="maple_fused_router",
547
+ input_names=["x", "w", "ctr_in"],
548
+ output_names=["out_indices", "out_scores", "logits_scratch"],
549
+ source=source,
550
+ )
551
+
552
+
553
+ _fused_router_kernel = _make_fused_router_kernel()
554
+
555
+
556
+ class MapleGate(nn.Module):
557
+ def __init__(self, args: ModelArgs):
558
+ super().__init__()
559
+ self.top_k = args.num_experts_per_tok
560
+ self.num_experts = args.num_experts
561
+ self.hidden_size = args.hidden_size
562
+ # Kept as a raw parameter (not nn.Linear) so quantization never
563
+ # touches it. The matmul accumulates in float32 and selection runs on
564
+ # float32 scores.
565
+ self.weight = mx.zeros((args.num_experts, args.hidden_size))
566
+ self._router_ctr = None
567
+ self._router_probed = False
568
+ self._fused_ok = (
569
+ args.num_experts % 32 == 0
570
+ and args.hidden_size % 128 == 0
571
+ and args.num_experts_per_tok == 8
572
+ )
573
+
574
+ def _fused(self, x):
575
+ if self._router_ctr is None:
576
+ self._router_ctr = mx.zeros((8,), dtype=mx.uint32)
577
+ mx.eval(self._router_ctr)
578
+ inds, scores, _ = _fused_router_kernel(
579
+ inputs=[x.reshape(-1), self.weight, self._router_ctr],
580
+ template=[
581
+ ("T_", self.weight.dtype),
582
+ ("NEXP", self.num_experts),
583
+ ("DIM", self.hidden_size),
584
+ ],
585
+ grid=((self.num_experts // 32) * 256, 1, 1),
586
+ threadgroup=(256, 1, 1),
587
+ output_shapes=[(8,), (8,), (self.num_experts,)],
588
+ output_dtypes=[mx.int32, mx.float32, mx.float32],
589
+ )
590
+ shape = x.shape[:-1] + (8,)
591
+ return inds.reshape(shape), scores.reshape(shape)
592
+
593
+ def __call__(self, x):
594
+ if (
595
+ self._fused_ok
596
+ and x.size == self.hidden_size
597
+ and self.weight.dtype == mx.bfloat16
598
+ ):
599
+ try:
600
+ inds, scores = self._fused(x)
601
+ if not self._router_probed:
602
+ # mlx is lazy: force one eval so a kernel failure surfaces
603
+ # here and latches the fallback.
604
+ mx.eval(inds, scores)
605
+ self._router_probed = True
606
+ return inds, scores
607
+ except Exception:
608
+ self._fused_ok = False
609
+ # `router_dtype: fp32`. In bf16 the near-tied top-8 boundary flips a
610
+ # few percent of picks per layer, which compounds over 24 layers.
611
+ gates = x.astype(mx.float32) @ self.weight.astype(mx.float32).T
612
+ return group_expert_select(gates, self.top_k)
613
+
614
+
615
+ @partial(mx.compile, shapeless=True)
616
+ def aggregate_expert_outputs(expert_outputs, scores):
617
+ # Combined in float32, rounded once at the end (reference `moe_infer`).
618
+ return (
619
+ (expert_outputs.astype(mx.float32) * scores[..., None])
620
+ .sum(axis=-2)
621
+ .astype(expert_outputs.dtype)
622
+ )
623
+
624
+
625
+ class MapleSwitchGLU(nn.Module):
626
+ """SwitchGLU with the up and gate projections fused into one gather
627
+ matmul; sanitize() concatenates the checkpoint's split tensors."""
628
+
629
+ def __init__(self, input_dims, hidden_dims, num_experts, bias=False):
630
+ super().__init__()
631
+ self.up_gate_proj = SwitchLinear(
632
+ input_dims, 2 * hidden_dims, num_experts, bias=bias
633
+ )
634
+ self.down_proj = SwitchLinear(hidden_dims, input_dims, num_experts, bias=bias)
635
+
636
+ def __call__(self, x, indices):
637
+ x = mx.expand_dims(x, (-2, -3))
638
+
639
+ do_sort = indices.size >= 64
640
+ idx = indices
641
+ inv_order = None
642
+ if do_sort:
643
+ x, idx, inv_order = _gather_sort(x, indices)
644
+
645
+ x_up, x_gate = mx.split(
646
+ self.up_gate_proj(x, idx, sorted_indices=do_sort), 2, axis=-1
647
+ )
648
+ x = self.down_proj(clamped_swiglu(x_gate, x_up), idx, sorted_indices=do_sort)
649
+
650
+ if do_sort:
651
+ x = _scatter_unsort(x, inv_order, indices.shape)
652
+
653
+ return x.squeeze(-2)
654
+
655
+
656
+ class MapleSparseMoeBlock(nn.Module):
657
+ def __init__(self, args: ModelArgs):
658
+ super().__init__()
659
+ self.gate = MapleGate(args)
660
+ self.switch_mlp = MapleSwitchGLU(
661
+ args.hidden_size,
662
+ args.moe_intermediate_size,
663
+ args.num_experts,
664
+ bias=args.use_bias,
665
+ )
666
+
667
+ def __call__(self, x):
668
+ inds, scores = self.gate(x)
669
+ y = self.switch_mlp(x, inds)
670
+ return aggregate_expert_outputs(y, scores)
671
+
672
+
673
+ class MapleDecoderLayer(nn.Module):
674
+ def __init__(self, args: ModelArgs, layer_idx: int):
675
+ super().__init__()
676
+ self.self_attn = MapleAttention(args, layer_idx)
677
+ self.mlp = (
678
+ MapleSparseMoeBlock(args)
679
+ if layer_idx >= args.first_k_dense_replace
680
+ else MapleMLP(args)
681
+ )
682
+ self.input_layernorm = MapleRMSNorm(args.hidden_size, eps=args.rms_norm_eps)
683
+ self.post_attention_layernorm = MapleRMSNorm(
684
+ args.hidden_size, eps=args.rms_norm_eps
685
+ )
686
+
687
+ def __call__(
688
+ self,
689
+ x: mx.array,
690
+ mask: Optional[mx.array] = None,
691
+ cache: Optional[Any] = None,
692
+ ) -> mx.array:
693
+ r = self.self_attn(self.input_layernorm(x), mask, cache)
694
+ h = x + r
695
+ r = self.mlp(self.post_attention_layernorm(h))
696
+ return h + r
697
+
698
+
699
+ class MapleModel(nn.Module):
700
+ def __init__(self, args: ModelArgs):
701
+ super().__init__()
702
+ self.args = args
703
+ self.word_embeddings = nn.Embedding(args.vocab_size, args.hidden_size)
704
+ self.layers = [
705
+ MapleDecoderLayer(args, layer_idx=i)
706
+ for i in range(args.num_hidden_layers)
707
+ ]
708
+ self.norm = MapleRMSNorm(args.hidden_size, eps=args.rms_norm_eps)
709
+
710
+ self.layer_types = args.layer_types
711
+ self.window_size = args.sliding_window
712
+ self.swa_idx = (
713
+ self.layer_types.index("sliding_attention")
714
+ if "sliding_attention" in self.layer_types
715
+ else None
716
+ )
717
+ self.ga_idx = (
718
+ self.layer_types.index("full_attention")
719
+ if "full_attention" in self.layer_types
720
+ else None
721
+ )
722
+ self._fused_add_norm = None # None = unprobed, then True/False
723
+ self._zero = None
724
+
725
+ def _decode_fused(self, h, cache, full_mask, swa_mask):
726
+ """Decode loop with residual adds folded into the norms.
727
+
728
+ Carries (h, r) instead of adding r back each step, so every
729
+ add+norm pair is one dispatch. Identical arithmetic: the kernel
730
+ rounds the sum once (as the bf16 add did) and norms the rounded
731
+ stream with an fp32 weight multiply.
732
+ """
733
+ if self._zero is None:
734
+ self._zero = mx.zeros(h.shape, h.dtype)
735
+ mx.eval(self._zero)
736
+ r = self._zero # x + 0 is exact in bf16
737
+ for layer, c, layer_type in zip(self.layers, cache, self.layer_types):
738
+ mask = full_mask if layer_type == "full_attention" else swa_mask
739
+ ln = layer.input_layernorm
740
+ h, hn = _add_rms_norm(h, r, ln.weight, ln.eps)
741
+ r = layer.self_attn(hn, mask, c)
742
+ ln = layer.post_attention_layernorm
743
+ h, hn = _add_rms_norm(h, r, ln.weight, ln.eps)
744
+ r = layer.mlp(hn)
745
+ return _add_rms_norm(h, r, self.norm.weight, self.norm.eps)[1]
746
+
747
+ def __call__(
748
+ self,
749
+ inputs: mx.array,
750
+ cache: Optional[Any] = None,
751
+ ):
752
+ h = self.word_embeddings(inputs)
753
+
754
+ if cache is None:
755
+ cache = [None] * len(self.layers)
756
+
757
+ full_mask = None
758
+ swa_mask = None
759
+ if self.ga_idx is not None:
760
+ full_mask = create_attention_mask(h, cache[self.ga_idx])
761
+ if self.swa_idx is not None:
762
+ swa_mask = create_attention_mask(
763
+ h, cache[self.swa_idx], window_size=self.window_size
764
+ )
765
+
766
+ if h.size == h.shape[-1] and h.shape[-1] % 256 == 0:
767
+ if self._fused_add_norm is None:
768
+ # Probe on dummy data, outside the real graph: a failure here
769
+ # must not leave the caches half-updated.
770
+ try:
771
+ z = mx.zeros((1, 1, h.shape[-1]), h.dtype)
772
+ mx.eval(_add_rms_norm(z, z, self.norm.weight, self.norm.eps))
773
+ self._fused_add_norm = True
774
+ except Exception:
775
+ self._fused_add_norm = False
776
+ if self._fused_add_norm:
777
+ return self._decode_fused(h, cache, full_mask, swa_mask)
778
+
779
+ for layer, c, layer_type in zip(self.layers, cache, self.layer_types):
780
+ mask = full_mask if layer_type == "full_attention" else swa_mask
781
+ h = layer(h, mask, c)
782
+
783
+ return self.norm(h)
784
+
785
+
786
+ class FlashHead(nn.Module):
787
+ """Two-phase approximate lm_head for single-stream decode.
788
+
789
+ Phase one scores quantized cluster centroids of the vocabulary; phase two
790
+ computes exact logits only for the tokens of the top ``n_probes`` clusters
791
+ (plus a fixed set of forced control tokens such as EOS). All other logits
792
+ are -inf, so greedy decoding is exact whenever the true argmax lies in the
793
+ probed clusters. Prefill and batched calls use the exact lm_head.
794
+
795
+ Reference: FlashHead — Efficient Drop-in Replacement for the
796
+ Classification Head in Language Model Inference.
797
+ """
798
+
799
+ def __init__(self, args: ModelArgs):
800
+ super().__init__()
801
+ meta = args.flash_head
802
+ n_clusters = meta["n_clusters"]
803
+ cluster_size = meta["cluster_size"]
804
+ # Default matches the converter's `--probes` default; every generated
805
+ # checkpoint records the value explicitly.
806
+ self.n_probes = min(meta.get("n_probes", 512), n_clusters)
807
+ self.head_group_size = meta.get("head_group_size", 64)
808
+ self.head_bits = meta.get("head_bits", 4)
809
+ self.centroids = nn.QuantizedLinear(
810
+ args.hidden_size,
811
+ n_clusters,
812
+ bias=False,
813
+ group_size=meta.get("group_size", 64),
814
+ bits=meta.get("bits", 4),
815
+ )
816
+ self.token_map = mx.zeros((n_clusters, cluster_size), dtype=mx.int32)
817
+ # Per-cluster max lm_head row norm. Centroids are directions; scaling
818
+ # by the largest member norm upper-bounds the cluster's best logit so
819
+ # high-frequency small-norm tokens are still probed. Newer checkpoints
820
+ # fold the scale into the centroid rows at generation time.
821
+ self.cluster_scale = mx.ones((n_clusters,), dtype=mx.bfloat16)
822
+ self._scaled_centroids = bool(meta.get("scaled_centroids", False))
823
+ # mlx >= the indexed_qmv release computes the subset logits in one
824
+ # dispatch straight from the flat head; older mlx uses a gather over
825
+ # the cluster-ordered head copy.
826
+ self._has_indexed_qmv = hasattr(mx.fast, "indexed_qmv")
827
+ # Cluster-ordered copy of the quantized lm_head: subset logits are one
828
+ # gather_qmm over the probed 32-row blocks, with no per-step gather.
829
+ # It is a row-permutation of lm_head by token_map and nothing more, so
830
+ # it is derived rather than stored: Model.sanitize rebuilds it at load
831
+ # when this path is live. The indexed_qmv path never reads it, so on
832
+ # those builds it is not allocated at all (~175 MB of the head saved).
833
+ hidden = args.hidden_size
834
+ self.head = (
835
+ {}
836
+ if self._has_indexed_qmv
837
+ else {
838
+ "weight": mx.zeros(
839
+ (n_clusters, cluster_size, hidden * self.head_bits // 32),
840
+ dtype=mx.uint32,
841
+ ),
842
+ "scales": mx.zeros(
843
+ (n_clusters, cluster_size, hidden // self.head_group_size),
844
+ dtype=mx.bfloat16,
845
+ ),
846
+ "biases": mx.zeros(
847
+ (n_clusters, cluster_size, hidden // self.head_group_size),
848
+ dtype=mx.bfloat16,
849
+ ),
850
+ }
851
+ )
852
+ self._force_ids = mx.array(meta.get("force_tokens", []), dtype=mx.int32)
853
+ self._force_rows = None
854
+
855
+ def __call__(self, h: mx.array, lm_head: nn.Module) -> mx.array:
856
+ hv = h[:, -1, :]
857
+ sims = self.centroids(hv)
858
+ if not self._scaled_centroids:
859
+ sims = sims * self.cluster_scale
860
+ top = mx.argpartition(sims, kth=-self.n_probes, axis=-1)[
861
+ ..., -self.n_probes :
862
+ ] # [1, n_probes]
863
+ oids = self.token_map[top[0]].reshape(-1)
864
+
865
+ if self._has_indexed_qmv:
866
+ if self._force_ids.size:
867
+ oids = mx.concatenate([oids, self._force_ids])
868
+ logits = mx.fast.indexed_qmv(
869
+ hv[0],
870
+ lm_head.weight,
871
+ lm_head.scales,
872
+ lm_head.biases,
873
+ oids,
874
+ group_size=lm_head.group_size,
875
+ bits=lm_head.bits,
876
+ )
877
+ vocab_size = lm_head.weight.shape[0]
878
+ full = mx.full((1, 1, vocab_size), float("-inf"), dtype=logits.dtype)
879
+ full[0, 0, oids] = logits
880
+ return full
881
+
882
+ logits = mx.gather_qmm(
883
+ hv.reshape(1, 1, 1, 1, -1),
884
+ self.head["weight"],
885
+ self.head["scales"],
886
+ self.head["biases"],
887
+ rhs_indices=top[:, None, :],
888
+ transpose=True,
889
+ group_size=self.head_group_size,
890
+ bits=self.head_bits,
891
+ ).reshape(-1)
892
+
893
+ if self._force_ids.size:
894
+ if self._force_rows is None:
895
+ self._force_rows = (
896
+ lm_head.weight[self._force_ids],
897
+ lm_head.scales[self._force_ids],
898
+ lm_head.biases[self._force_ids],
899
+ )
900
+ mx.eval(*self._force_rows)
901
+ fw, fs, fb = self._force_rows
902
+ force_logits = mx.quantized_matmul(
903
+ hv,
904
+ fw,
905
+ scales=fs,
906
+ biases=fb,
907
+ transpose=True,
908
+ group_size=lm_head.group_size,
909
+ bits=lm_head.bits,
910
+ mode=getattr(lm_head, "mode", "affine"),
911
+ )[0]
912
+ oids = mx.concatenate([oids, self._force_ids])
913
+ logits = mx.concatenate([logits, force_logits])
914
+
915
+ vocab_size = lm_head.weight.shape[0]
916
+ full = mx.full((1, 1, vocab_size), float("-inf"), dtype=logits.dtype)
917
+ full[0, 0, oids] = logits
918
+ return full
919
+
920
+
921
+ class Model(nn.Module):
922
+ def __init__(self, args: ModelArgs):
923
+ super().__init__()
924
+ self.args = args
925
+ self.model_type = args.model_type
926
+ self.model = MapleModel(args)
927
+ if not args.tie_word_embeddings:
928
+ self.lm_head = nn.Linear(args.hidden_size, args.vocab_size, bias=False)
929
+ if (args.flash_head and args.use_flash_head and not args.tie_word_embeddings):
930
+ self.lm_head_flash = FlashHead(args)
931
+ else:
932
+ self.lm_head_flash = None
933
+
934
+ def __call__(
935
+ self,
936
+ inputs: mx.array,
937
+ cache=None,
938
+ ):
939
+ out = self.model(inputs, cache)
940
+ if self.args.tie_word_embeddings:
941
+ return self.model.word_embeddings.as_linear(out)
942
+ if (
943
+ self.lm_head_flash is not None
944
+ and out.shape[0] == 1
945
+ and out.shape[1] == 1
946
+ and isinstance(self.lm_head, nn.QuantizedLinear)
947
+ and getattr(self.lm_head, "mode", "affine") == "affine"
948
+ ):
949
+ return self.lm_head_flash(out, self.lm_head)
950
+ return self.lm_head(out)
951
+
952
+ def sanitize(self, weights):
953
+ if self.args.tie_word_embeddings:
954
+ # Drop the head entirely (weight + quantization scales/biases).
955
+ weights = {
956
+ k: v for k, v in weights.items() if not k.startswith("lm_head.")
957
+ }
958
+
959
+ # FlashHead disabled (e.g. model_config={"flash_head": None}): drop its
960
+ # tensors so checkpoints that carry them still load.
961
+ if self.lm_head_flash is None:
962
+ weights = {
963
+ k: v for k, v in weights.items() if not k.startswith("lm_head_flash.")
964
+ }
965
+ else:
966
+ # `lm_head_flash.head.*` is lm_head permuted by token_map (see
967
+ # mlx_lm.ternary.generate_flash_head), so it is pure redundancy on
968
+ # disk. Checkpoints may ship it or omit it; reconcile both here.
969
+ if self.lm_head_flash._has_indexed_qmv:
970
+ # Dead on this build: indexed_qmv reads the flat lm_head.
971
+ weights = {
972
+ k: v
973
+ for k, v in weights.items()
974
+ if not k.startswith("lm_head_flash.head.")
975
+ }
976
+ elif "lm_head_flash.head.weight" not in weights:
977
+ token_map = weights["lm_head_flash.token_map"]
978
+ order = token_map.reshape(-1)
979
+ for k in ("weight", "scales", "biases"):
980
+ weights[f"lm_head_flash.head.{k}"] = weights[f"lm_head.{k}"][
981
+ order
982
+ ].reshape(*token_map.shape, -1)
983
+
984
+ # Ternary tensors carry one scale per output row, so checkpoints store
985
+ # it once as `row_alpha` and omit biases entirely (bias == -scale).
986
+ # Expand here so everything downstream — fusion below, and mlx's own
987
+ # quantized kernels — sees the per-group layout. Checkpoints written
988
+ # with `--group-scales` have no row_alpha and pass straight through.
989
+ row_alpha_keys = [k for k in weights if k.endswith(".row_alpha")]
990
+ if row_alpha_keys:
991
+ group_size = (self.args.quantization or {}).get("group_size", 128)
992
+ for key in row_alpha_keys:
993
+ alpha = weights.pop(key)
994
+ prefix = key[: -len(".row_alpha")]
995
+ packed = weights.get(f"{prefix}.weight")
996
+ if packed is None:
997
+ continue
998
+ # 2-bit packing stores 16 codes per uint32 word.
999
+ n_groups = (packed.shape[-1] * 16) // group_size
1000
+ scales = mx.contiguous(
1001
+ mx.broadcast_to(alpha[..., None], (*alpha.shape, n_groups))
1002
+ )
1003
+ weights[f"{prefix}.scales"] = scales
1004
+ weights[f"{prefix}.biases"] = -scales
1005
+
1006
+ # Stack per-expert weights from the Hugging Face layout into the
1007
+ # SwitchGLU layout. Already-converted checkpoints pass through.
1008
+ for l in range(self.args.num_hidden_layers):
1009
+ prefix = f"model.layers.{l}"
1010
+ for m in ["gate_proj", "down_proj", "up_proj"]:
1011
+ for k in ["weight", "scales", "biases", "bias"]:
1012
+ if f"{prefix}.mlp.experts.0.{m}.{k}" in weights:
1013
+ to_join = [
1014
+ weights.pop(f"{prefix}.mlp.experts.{e}.{m}.{k}")
1015
+ for e in range(self.args.num_experts)
1016
+ ]
1017
+ weights[f"{prefix}.mlp.switch_mlp.{m}.{k}"] = mx.stack(to_join)
1018
+
1019
+ # Fuse split projections: q/k/v -> qkv_proj (rows), MoE up/gate ->
1020
+ # up_gate_proj (per-expert rows). Row-wise quantized tensors
1021
+ # (weight/scales/biases) concatenate losslessly along the output
1022
+ # axis.
1023
+ for suffix in ["weight", "scales", "biases", "bias"]:
1024
+ qkv = [f"{prefix}.self_attn.{p}.{suffix}" for p in ("q_proj", "k_proj", "v_proj")]
1025
+ if qkv[0] in weights:
1026
+ weights[f"{prefix}.self_attn.qkv_proj.{suffix}"] = mx.concatenate(
1027
+ [weights.pop(k) for k in qkv], axis=0
1028
+ )
1029
+ up = f"{prefix}.mlp.switch_mlp.up_proj.{suffix}"
1030
+ gate = f"{prefix}.mlp.switch_mlp.gate_proj.{suffix}"
1031
+ if up in weights:
1032
+ weights[f"{prefix}.mlp.switch_mlp.up_gate_proj.{suffix}"] = (
1033
+ mx.concatenate([weights.pop(up), weights.pop(gate)], axis=1)
1034
+ )
1035
+
1036
+ return weights
1037
+
1038
+ def make_cache(self):
1039
+ caches = []
1040
+ for layer_type in self.model.layer_types:
1041
+ if layer_type == "sliding_attention":
1042
+ caches.append(RotatingKVCache(max_size=self.args.sliding_window))
1043
+ else:
1044
+ caches.append(KVCache())
1045
+ return caches
1046
+
1047
+ @property
1048
+ def layers(self):
1049
+ return self.model.layers
1050
+
1051
+ @property
1052
+ def quant_predicate(self):
1053
+ def predicate(path, _):
1054
+ if path.endswith("lm_head") or "word_embeddings" in path:
1055
+ return {"group_size": 64, "bits": 4}
1056
+ return True
1057
+
1058
+ return predicate
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1444bbc92e2842e9a612c32b6d6f30f0f026a107c8094a4ac273819a22eb84e1
3
+ size 2162084350
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d051e252c46570f989b65c5e037b94402d22f892e96dc91f5fb83dbb06b50d30
3
+ size 2187444586
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85c97321214c864597562d5b7286b9e8a0dac36e5abd622f11f9b8425ee88705
3
+ size 958711742
model-flashhead.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67d1af06cd8ec6f434ea57b9e066dedf1f7572a95d1af14c56a525cb8b7b03cd
3
+ size 6087456
model.safetensors.index.json ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 5314328134
4
+ },
5
+ "weight_map": {
6
+ "model.word_embeddings.weight": "model-00001-of-00003.safetensors",
7
+ "model.word_embeddings.scales": "model-00001-of-00003.safetensors",
8
+ "model.word_embeddings.biases": "model-00001-of-00003.safetensors",
9
+ "model.norm.weight": "model-00001-of-00003.safetensors",
10
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
11
+ "model.layers.7.mlp.gate.weight": "model-00001-of-00003.safetensors",
12
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
13
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
14
+ "model.layers.6.mlp.gate.weight": "model-00001-of-00003.safetensors",
15
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
16
+ "model.layers.5.mlp.gate.weight": "model-00001-of-00003.safetensors",
17
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
18
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
19
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
20
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
21
+ "model.layers.23.input_layernorm.weight": "model-00001-of-00003.safetensors",
22
+ "model.layers.22.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
23
+ "model.layers.22.mlp.gate.weight": "model-00001-of-00003.safetensors",
24
+ "model.layers.22.input_layernorm.weight": "model-00001-of-00003.safetensors",
25
+ "model.layers.21.input_layernorm.weight": "model-00001-of-00003.safetensors",
26
+ "model.layers.20.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
27
+ "model.layers.20.mlp.gate.weight": "model-00001-of-00003.safetensors",
28
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
29
+ "model.layers.2.mlp.gate.weight": "model-00001-of-00003.safetensors",
30
+ "model.layers.21.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
31
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
32
+ "model.layers.19.mlp.gate.weight": "model-00001-of-00003.safetensors",
33
+ "model.layers.16.mlp.gate.weight": "model-00001-of-00003.safetensors",
34
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00003.safetensors",
35
+ "model.layers.3.mlp.gate.weight": "model-00001-of-00003.safetensors",
36
+ "model.layers.20.input_layernorm.weight": "model-00001-of-00003.safetensors",
37
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00003.safetensors",
38
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
39
+ "model.layers.13.mlp.gate.weight": "model-00001-of-00003.safetensors",
40
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00003.safetensors",
41
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
42
+ "model.layers.10.mlp.gate.weight": "model-00001-of-00003.safetensors",
43
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00003.safetensors",
44
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
45
+ "model.layers.8.mlp.gate.weight": "model-00001-of-00003.safetensors",
46
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
47
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
48
+ "model.layers.1.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
49
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
50
+ "model.layers.1.mlp.gate.weight": "model-00001-of-00003.safetensors",
51
+ "model.layers.23.mlp.gate.weight": "model-00001-of-00003.safetensors",
52
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00003.safetensors",
53
+ "model.layers.17.mlp.gate.weight": "model-00001-of-00003.safetensors",
54
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00003.safetensors",
55
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
56
+ "model.layers.18.mlp.gate.weight": "model-00001-of-00003.safetensors",
57
+ "model.layers.4.mlp.gate.weight": "model-00001-of-00003.safetensors",
58
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
59
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
60
+ "model.layers.1.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
61
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00003.safetensors",
62
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00003.safetensors",
63
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
64
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
65
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
66
+ "model.layers.0.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
67
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
68
+ "model.layers.0.mlp.gate.weight": "model-00001-of-00003.safetensors",
69
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
70
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
71
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
72
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
73
+ "model.layers.0.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
74
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
75
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
76
+ "model.layers.0.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
77
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
78
+ "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
79
+ "model.layers.23.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
80
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
81
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00003.safetensors",
82
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
83
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
84
+ "model.layers.1.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
85
+ "model.layers.21.mlp.gate.weight": "model-00001-of-00003.safetensors",
86
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
87
+ "model.layers.12.mlp.gate.weight": "model-00001-of-00003.safetensors",
88
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
89
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
90
+ "model.layers.9.mlp.gate.weight": "model-00001-of-00003.safetensors",
91
+ "model.layers.15.mlp.gate.weight": "model-00001-of-00003.safetensors",
92
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
93
+ "model.layers.0.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
94
+ "model.layers.11.mlp.gate.weight": "model-00001-of-00003.safetensors",
95
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00003.safetensors",
96
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
97
+ "lm_head.weight": "model-00001-of-00003.safetensors",
98
+ "lm_head.scales": "model-00001-of-00003.safetensors",
99
+ "lm_head.biases": "model-00001-of-00003.safetensors",
100
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00003.safetensors",
101
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
102
+ "model.layers.1.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
103
+ "model.layers.14.mlp.gate.weight": "model-00001-of-00003.safetensors",
104
+ "model.layers.1.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
105
+ "model.layers.1.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
106
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00003.safetensors",
107
+ "model.layers.1.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
108
+ "model.layers.1.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
109
+ "model.layers.0.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
110
+ "model.layers.0.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
111
+ "model.layers.0.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
112
+ "model.layers.0.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
113
+ "model.layers.1.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
114
+ "model.layers.1.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
115
+ "model.layers.0.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
116
+ "model.layers.0.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
117
+ "model.layers.4.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
118
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
119
+ "model.layers.4.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
120
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
121
+ "model.layers.4.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
122
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
123
+ "model.layers.3.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
124
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
125
+ "model.layers.3.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
126
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
127
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
128
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
129
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
130
+ "model.layers.3.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
131
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
132
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
133
+ "model.layers.4.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
134
+ "model.layers.4.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
135
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
136
+ "model.layers.2.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
137
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
138
+ "model.layers.3.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
139
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
140
+ "model.layers.2.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
141
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
142
+ "model.layers.2.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
143
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
144
+ "model.layers.4.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
145
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
146
+ "model.layers.2.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
147
+ "model.layers.3.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
148
+ "model.layers.3.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
149
+ "model.layers.3.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
150
+ "model.layers.3.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
151
+ "model.layers.4.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
152
+ "model.layers.4.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
153
+ "model.layers.2.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
154
+ "model.layers.2.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
155
+ "model.layers.2.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
156
+ "model.layers.2.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
157
+ "model.layers.4.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
158
+ "model.layers.4.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
159
+ "model.layers.3.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
160
+ "model.layers.3.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
161
+ "model.layers.4.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
162
+ "model.layers.4.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
163
+ "model.layers.2.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
164
+ "model.layers.2.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
165
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
166
+ "model.layers.7.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
167
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
168
+ "model.layers.7.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
169
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
170
+ "model.layers.7.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
171
+ "model.layers.7.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
172
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
173
+ "model.layers.7.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
174
+ "model.layers.7.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
175
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
176
+ "model.layers.5.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
177
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
178
+ "model.layers.6.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
179
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
180
+ "model.layers.6.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
181
+ "model.layers.6.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
182
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
183
+ "model.layers.6.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
184
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
185
+ "model.layers.5.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
186
+ "model.layers.5.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
187
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
188
+ "model.layers.5.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
189
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
190
+ "model.layers.5.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
191
+ "model.layers.6.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
192
+ "model.layers.5.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
193
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
194
+ "model.layers.6.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
195
+ "model.layers.6.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
196
+ "model.layers.6.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
197
+ "model.layers.6.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
198
+ "model.layers.6.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
199
+ "model.layers.7.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
200
+ "model.layers.7.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
201
+ "model.layers.7.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
202
+ "model.layers.7.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
203
+ "model.layers.7.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
204
+ "model.layers.7.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
205
+ "model.layers.5.mlp.switch_mlp.up_proj.weight": "model-00001-of-00003.safetensors",
206
+ "model.layers.5.mlp.switch_mlp.up_proj.row_alpha": "model-00001-of-00003.safetensors",
207
+ "model.layers.6.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
208
+ "model.layers.6.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
209
+ "model.layers.5.mlp.switch_mlp.down_proj.weight": "model-00001-of-00003.safetensors",
210
+ "model.layers.5.mlp.switch_mlp.down_proj.row_alpha": "model-00001-of-00003.safetensors",
211
+ "model.layers.5.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
212
+ "model.layers.5.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
213
+ "model.layers.9.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
214
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
215
+ "model.layers.9.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
216
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
217
+ "model.layers.8.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
218
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
219
+ "model.layers.8.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
220
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
221
+ "model.layers.8.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
222
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
223
+ "model.layers.8.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
224
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
225
+ "model.layers.9.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
226
+ "model.layers.8.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
227
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
228
+ "model.layers.9.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
229
+ "model.layers.9.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
230
+ "model.layers.8.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
231
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
232
+ "model.layers.10.self_attn.q_proj.row_alpha": "model-00001-of-00003.safetensors",
233
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
234
+ "model.layers.10.self_attn.o_proj.row_alpha": "model-00001-of-00003.safetensors",
235
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
236
+ "model.layers.10.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
237
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
238
+ "model.layers.10.self_attn.k_proj.row_alpha": "model-00001-of-00003.safetensors",
239
+ "model.layers.10.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
240
+ "model.layers.10.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
241
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
242
+ "model.layers.9.self_attn.v_proj.row_alpha": "model-00001-of-00003.safetensors",
243
+ "model.layers.9.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
244
+ "model.layers.9.mlp.switch_mlp.gate_proj.row_alpha": "model-00001-of-00003.safetensors",
245
+ "model.layers.10.mlp.switch_mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
246
+ "model.layers.10.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
247
+ "model.layers.10.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
248
+ "model.layers.10.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
249
+ "model.layers.9.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
250
+ "model.layers.9.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
251
+ "model.layers.8.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
252
+ "model.layers.8.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
253
+ "model.layers.9.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
254
+ "model.layers.9.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
255
+ "model.layers.10.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
256
+ "model.layers.10.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
257
+ "model.layers.8.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
258
+ "model.layers.8.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
259
+ "model.layers.8.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
260
+ "model.layers.8.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
261
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
262
+ "model.layers.13.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
263
+ "model.layers.13.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
264
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
265
+ "model.layers.11.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
266
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
267
+ "model.layers.11.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
268
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
269
+ "model.layers.11.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
270
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
271
+ "model.layers.12.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
272
+ "model.layers.12.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
273
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
274
+ "model.layers.13.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
275
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
276
+ "model.layers.12.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
277
+ "model.layers.13.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
278
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
279
+ "model.layers.12.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
280
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
281
+ "model.layers.12.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
282
+ "model.layers.11.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
283
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
284
+ "model.layers.11.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
285
+ "model.layers.11.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
286
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
287
+ "model.layers.13.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
288
+ "model.layers.12.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
289
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
290
+ "model.layers.13.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
291
+ "model.layers.11.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
292
+ "model.layers.11.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
293
+ "model.layers.11.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
294
+ "model.layers.11.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
295
+ "model.layers.13.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
296
+ "model.layers.13.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
297
+ "model.layers.12.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
298
+ "model.layers.12.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
299
+ "model.layers.13.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
300
+ "model.layers.13.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
301
+ "model.layers.13.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
302
+ "model.layers.13.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
303
+ "model.layers.11.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
304
+ "model.layers.11.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
305
+ "model.layers.12.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
306
+ "model.layers.12.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
307
+ "model.layers.12.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
308
+ "model.layers.12.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
309
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
310
+ "model.layers.16.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
311
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
312
+ "model.layers.16.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
313
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
314
+ "model.layers.16.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
315
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
316
+ "model.layers.15.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
317
+ "model.layers.15.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
318
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
319
+ "model.layers.15.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
320
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
321
+ "model.layers.15.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
322
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
323
+ "model.layers.16.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
324
+ "model.layers.16.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
325
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
326
+ "model.layers.14.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
327
+ "model.layers.16.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
328
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
329
+ "model.layers.14.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
330
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
331
+ "model.layers.14.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
332
+ "model.layers.14.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
333
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
334
+ "model.layers.14.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
335
+ "model.layers.15.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
336
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
337
+ "model.layers.15.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
338
+ "model.layers.14.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
339
+ "model.layers.14.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
340
+ "model.layers.14.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
341
+ "model.layers.16.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
342
+ "model.layers.16.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
343
+ "model.layers.15.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
344
+ "model.layers.15.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
345
+ "model.layers.14.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
346
+ "model.layers.14.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
347
+ "model.layers.15.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
348
+ "model.layers.15.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
349
+ "model.layers.16.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
350
+ "model.layers.16.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
351
+ "model.layers.15.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
352
+ "model.layers.15.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
353
+ "model.layers.16.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
354
+ "model.layers.16.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
355
+ "model.layers.14.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
356
+ "model.layers.14.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
357
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
358
+ "model.layers.19.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
359
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
360
+ "model.layers.19.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
361
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
362
+ "model.layers.19.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
363
+ "model.layers.19.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
364
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
365
+ "model.layers.19.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
366
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
367
+ "model.layers.18.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
368
+ "model.layers.19.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
369
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
370
+ "model.layers.18.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
371
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
372
+ "model.layers.18.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
373
+ "model.layers.18.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
374
+ "model.layers.18.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
375
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
376
+ "model.layers.18.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
377
+ "model.layers.17.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
378
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
379
+ "model.layers.17.self_attn.o_proj.row_alpha": "model-00002-of-00003.safetensors",
380
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
381
+ "model.layers.17.self_attn.k_proj.row_alpha": "model-00002-of-00003.safetensors",
382
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
383
+ "model.layers.17.self_attn.q_proj.row_alpha": "model-00002-of-00003.safetensors",
384
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
385
+ "model.layers.17.self_attn.v_proj.row_alpha": "model-00002-of-00003.safetensors",
386
+ "model.layers.17.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
387
+ "model.layers.17.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
388
+ "model.layers.17.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
389
+ "model.layers.17.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
390
+ "model.layers.17.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
391
+ "model.layers.20.mlp.switch_mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
392
+ "model.layers.20.mlp.switch_mlp.gate_proj.row_alpha": "model-00002-of-00003.safetensors",
393
+ "model.layers.19.mlp.switch_mlp.down_proj.weight": "model-00002-of-00003.safetensors",
394
+ "model.layers.19.mlp.switch_mlp.down_proj.row_alpha": "model-00002-of-00003.safetensors",
395
+ "model.layers.18.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
396
+ "model.layers.18.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
397
+ "model.layers.19.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
398
+ "model.layers.19.mlp.switch_mlp.up_proj.row_alpha": "model-00002-of-00003.safetensors",
399
+ "model.layers.20.mlp.switch_mlp.up_proj.weight": "model-00002-of-00003.safetensors",
400
+ "model.layers.20.mlp.switch_mlp.up_proj.row_alpha": "model-00003-of-00003.safetensors",
401
+ "model.layers.19.mlp.switch_mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
402
+ "model.layers.19.mlp.switch_mlp.gate_proj.row_alpha": "model-00003-of-00003.safetensors",
403
+ "model.layers.18.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
404
+ "model.layers.18.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
405
+ "model.layers.18.mlp.switch_mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
406
+ "model.layers.18.mlp.switch_mlp.gate_proj.row_alpha": "model-00003-of-00003.safetensors",
407
+ "model.layers.17.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
408
+ "model.layers.17.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
409
+ "model.layers.22.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
410
+ "model.layers.22.self_attn.v_proj.row_alpha": "model-00003-of-00003.safetensors",
411
+ "model.layers.22.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
412
+ "model.layers.22.self_attn.q_proj.row_alpha": "model-00003-of-00003.safetensors",
413
+ "model.layers.22.self_attn.q_norm.weight": "model-00003-of-00003.safetensors",
414
+ "model.layers.22.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
415
+ "model.layers.22.self_attn.o_proj.row_alpha": "model-00003-of-00003.safetensors",
416
+ "model.layers.22.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
417
+ "model.layers.22.self_attn.k_proj.row_alpha": "model-00003-of-00003.safetensors",
418
+ "model.layers.21.self_attn.k_norm.weight": "model-00003-of-00003.safetensors",
419
+ "model.layers.21.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
420
+ "model.layers.21.self_attn.q_proj.row_alpha": "model-00003-of-00003.safetensors",
421
+ "model.layers.21.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
422
+ "model.layers.21.self_attn.k_proj.row_alpha": "model-00003-of-00003.safetensors",
423
+ "model.layers.20.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
424
+ "model.layers.20.self_attn.v_proj.row_alpha": "model-00003-of-00003.safetensors",
425
+ "model.layers.22.self_attn.k_norm.weight": "model-00003-of-00003.safetensors",
426
+ "model.layers.20.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
427
+ "model.layers.20.self_attn.o_proj.row_alpha": "model-00003-of-00003.safetensors",
428
+ "model.layers.20.self_attn.q_norm.weight": "model-00003-of-00003.safetensors",
429
+ "model.layers.20.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
430
+ "model.layers.20.self_attn.k_proj.row_alpha": "model-00003-of-00003.safetensors",
431
+ "model.layers.20.self_attn.k_norm.weight": "model-00003-of-00003.safetensors",
432
+ "model.layers.21.self_attn.q_norm.weight": "model-00003-of-00003.safetensors",
433
+ "model.layers.21.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
434
+ "model.layers.21.self_attn.v_proj.row_alpha": "model-00003-of-00003.safetensors",
435
+ "model.layers.20.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
436
+ "model.layers.20.self_attn.q_proj.row_alpha": "model-00003-of-00003.safetensors",
437
+ "model.layers.21.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
438
+ "model.layers.21.self_attn.o_proj.row_alpha": "model-00003-of-00003.safetensors",
439
+ "model.layers.21.mlp.switch_mlp.up_proj.weight": "model-00003-of-00003.safetensors",
440
+ "model.layers.21.mlp.switch_mlp.up_proj.row_alpha": "model-00003-of-00003.safetensors",
441
+ "model.layers.23.mlp.switch_mlp.up_proj.weight": "model-00003-of-00003.safetensors",
442
+ "model.layers.23.mlp.switch_mlp.up_proj.row_alpha": "model-00003-of-00003.safetensors",
443
+ "model.layers.22.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
444
+ "model.layers.22.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
445
+ "model.layers.21.mlp.switch_mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
446
+ "model.layers.21.mlp.switch_mlp.gate_proj.row_alpha": "model-00003-of-00003.safetensors",
447
+ "model.layers.22.mlp.switch_mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
448
+ "model.layers.22.mlp.switch_mlp.gate_proj.row_alpha": "model-00003-of-00003.safetensors",
449
+ "model.layers.22.mlp.switch_mlp.up_proj.weight": "model-00003-of-00003.safetensors",
450
+ "model.layers.22.mlp.switch_mlp.up_proj.row_alpha": "model-00003-of-00003.safetensors",
451
+ "model.layers.21.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
452
+ "model.layers.21.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
453
+ "model.layers.23.mlp.switch_mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
454
+ "model.layers.23.mlp.switch_mlp.gate_proj.row_alpha": "model-00003-of-00003.safetensors",
455
+ "model.layers.20.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
456
+ "model.layers.20.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
457
+ "model.layers.23.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
458
+ "model.layers.23.self_attn.v_proj.row_alpha": "model-00003-of-00003.safetensors",
459
+ "model.layers.23.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
460
+ "model.layers.23.self_attn.q_proj.row_alpha": "model-00003-of-00003.safetensors",
461
+ "model.layers.23.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
462
+ "model.layers.23.self_attn.o_proj.row_alpha": "model-00003-of-00003.safetensors",
463
+ "model.layers.23.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
464
+ "model.layers.23.self_attn.k_proj.row_alpha": "model-00003-of-00003.safetensors",
465
+ "model.layers.23.self_attn.k_norm.weight": "model-00003-of-00003.safetensors",
466
+ "model.layers.23.self_attn.q_norm.weight": "model-00003-of-00003.safetensors",
467
+ "model.layers.23.mlp.switch_mlp.down_proj.weight": "model-00003-of-00003.safetensors",
468
+ "model.layers.23.mlp.switch_mlp.down_proj.row_alpha": "model-00003-of-00003.safetensors",
469
+ "lm_head_flash.centroids.weight": "model-flashhead.safetensors",
470
+ "lm_head_flash.centroids.scales": "model-flashhead.safetensors",
471
+ "lm_head_flash.centroids.biases": "model-flashhead.safetensors",
472
+ "lm_head_flash.token_map": "model-flashhead.safetensors",
473
+ "lm_head_flash.cluster_scale": "model-flashhead.safetensors"
474
+ }
475
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 1010000,
235
+ "pad_token": "<|endoftext|>",
236
+ "padding_side": "right",
237
+ "split_special_tokens": false,
238
+ "tokenizer_class": "Qwen2Tokenizer",
239
+ "unk_token": null
240
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff