agentmish commited on
Commit
d9975bf
·
verified ·
1 Parent(s): 69ea47b

Add files using upload-large-folder tool

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
README.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ pipeline_tag: text-generation
4
+ tags:
5
+ - mlx
6
+ library_name: mlx
7
+ ---
__pycache__/mlx_pplx_qwen3.cpython-312.pyc ADDED
Binary file (12.8 kB). View file
 
config.json ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "PPLXQwen3Model"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attn_implementation": "sdpa",
8
+ "auto_map": {
9
+ "AutoConfig": "configuration.PPLXQwen3Config",
10
+ "AutoModel": "modeling.PPLXQwen3Model"
11
+ },
12
+ "bos_token_id": 151643,
13
+ "dtype": "float32",
14
+ "eos_token_id": 151643,
15
+ "head_dim": 128,
16
+ "hidden_act": "silu",
17
+ "hidden_size": 2560,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 9728,
20
+ "layer_types": [
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention",
56
+ "full_attention"
57
+ ],
58
+ "max_position_embeddings": 32768,
59
+ "max_window_layers": 36,
60
+ "model_file": "mlx_pplx_qwen3.py",
61
+ "model_type": "bidirectional_pplx_qwen3",
62
+ "num_attention_heads": 32,
63
+ "num_hidden_layers": 36,
64
+ "num_key_value_heads": 8,
65
+ "rms_norm_eps": 1e-06,
66
+ "rope_parameters": {
67
+ "rope_theta": 1000000,
68
+ "rope_type": "default"
69
+ },
70
+ "rope_theta": 1000000,
71
+ "sliding_window": null,
72
+ "source_model_type": "bidirectional_pplx_qwen3",
73
+ "tie_word_embeddings": true,
74
+ "transformers_version": "5.0.0.dev0",
75
+ "use_bidirectional_attention": true,
76
+ "use_cache": false,
77
+ "use_sliding_window": false,
78
+ "vocab_size": 151936
79
+ }
configuration.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from transformers.models.qwen3.configuration_qwen3 import Qwen3Config
2
+
3
+
4
+ class PPLXQwen3Config(Qwen3Config):
5
+ model_type = "bidirectional_pplx_qwen3"
mlx_pplx_qwen3.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from typing import Any, Dict, Optional, Union
3
+
4
+ import mlx.core as mx
5
+ import mlx.nn as nn
6
+ from mlx.nn.layers.distributed import shard_linear
7
+
8
+ from mlx_lm.models.activations import swiglu
9
+ from mlx_lm.models.base import (
10
+ BaseModelArgs,
11
+ scaled_dot_product_attention,
12
+ )
13
+ from mlx_lm.models.rope_utils import initialize_rope
14
+
15
+
16
+ @dataclass
17
+ class ModelArgs(BaseModelArgs):
18
+ model_type: str
19
+ hidden_size: int
20
+ num_hidden_layers: int
21
+ intermediate_size: int
22
+ num_attention_heads: int
23
+ rms_norm_eps: float
24
+ vocab_size: int
25
+ num_key_value_heads: int
26
+ max_position_embeddings: int
27
+ rope_theta: float
28
+ head_dim: int
29
+ tie_word_embeddings: bool
30
+ rope_scaling: Optional[Dict[str, Union[float, str]]] = None
31
+
32
+
33
+ def _make_bidirectional_mask(
34
+ attention_mask: mx.array,
35
+ batch_size: int,
36
+ seq_len: int,
37
+ offset: int = 0,
38
+ ) -> mx.array:
39
+ if attention_mask.ndim != 2:
40
+ raise ValueError(
41
+ f"Expected 2D attention_mask with shape [batch, seq], got {attention_mask.shape}"
42
+ )
43
+ if attention_mask.shape[0] != batch_size:
44
+ raise ValueError(
45
+ "attention_mask batch size does not match input batch size"
46
+ )
47
+ if attention_mask.shape[1] < offset + seq_len:
48
+ raise ValueError(
49
+ "attention_mask sequence length is shorter than the required cached length"
50
+ )
51
+
52
+ # Build a full (non-causal) valid-token mask from the 2D attention mask.
53
+ q = attention_mask[:, offset : offset + seq_len].astype(mx.bool_)
54
+ k = attention_mask[:, : offset + seq_len].astype(mx.bool_)
55
+ mask = q[:, :, None] & k[:, None, :]
56
+ return mask[:, None, :, :]
57
+
58
+
59
+ class Attention(nn.Module):
60
+ def __init__(self, args: ModelArgs):
61
+ super().__init__()
62
+
63
+ dim = args.hidden_size
64
+ self.n_heads = n_heads = args.num_attention_heads
65
+ self.n_kv_heads = n_kv_heads = args.num_key_value_heads
66
+ head_dim = args.head_dim
67
+ self.scale = head_dim**-0.5
68
+
69
+ self.q_proj = nn.Linear(dim, n_heads * head_dim, bias=False)
70
+ self.k_proj = nn.Linear(dim, n_kv_heads * head_dim, bias=False)
71
+ self.v_proj = nn.Linear(dim, n_kv_heads * head_dim, bias=False)
72
+ self.o_proj = nn.Linear(n_heads * head_dim, dim, bias=False)
73
+
74
+ self.q_norm = nn.RMSNorm(head_dim, eps=args.rms_norm_eps)
75
+ self.k_norm = nn.RMSNorm(head_dim, eps=args.rms_norm_eps)
76
+ self.rope = initialize_rope(
77
+ head_dim,
78
+ base=args.rope_theta,
79
+ traditional=False,
80
+ scaling_config=args.rope_scaling,
81
+ max_position_embeddings=args.max_position_embeddings,
82
+ )
83
+
84
+ def __call__(
85
+ self,
86
+ x: mx.array,
87
+ mask: Optional[mx.array] = None,
88
+ cache: Optional[Any] = None,
89
+ ) -> mx.array:
90
+ bsz, seq_len, _ = x.shape
91
+
92
+ queries = self.q_proj(x)
93
+ keys = self.k_proj(x)
94
+ values = self.v_proj(x)
95
+
96
+ queries = self.q_norm(queries.reshape(bsz, seq_len, self.n_heads, -1)).transpose(
97
+ 0, 2, 1, 3
98
+ )
99
+ keys = self.k_norm(keys.reshape(bsz, seq_len, self.n_kv_heads, -1)).transpose(
100
+ 0, 2, 1, 3
101
+ )
102
+ values = values.reshape(bsz, seq_len, self.n_kv_heads, -1).transpose(0, 2, 1, 3)
103
+
104
+ if cache is not None:
105
+ queries = self.rope(queries, offset=cache.offset)
106
+ keys = self.rope(keys, offset=cache.offset)
107
+ keys, values = cache.update_and_fetch(keys, values)
108
+ else:
109
+ queries = self.rope(queries)
110
+ keys = self.rope(keys)
111
+
112
+ output = scaled_dot_product_attention(
113
+ queries,
114
+ keys,
115
+ values,
116
+ cache=cache,
117
+ scale=self.scale,
118
+ mask=mask,
119
+ )
120
+ output = output.transpose(0, 2, 1, 3).reshape(bsz, seq_len, -1)
121
+ return self.o_proj(output)
122
+
123
+
124
+ class MLP(nn.Module):
125
+ def __init__(self, dim: int, hidden_dim: int):
126
+ super().__init__()
127
+ self.gate_proj = nn.Linear(dim, hidden_dim, bias=False)
128
+ self.down_proj = nn.Linear(hidden_dim, dim, bias=False)
129
+ self.up_proj = nn.Linear(dim, hidden_dim, bias=False)
130
+
131
+ def __call__(self, x: mx.array) -> mx.array:
132
+ return self.down_proj(swiglu(self.gate_proj(x), self.up_proj(x)))
133
+
134
+
135
+ class TransformerBlock(nn.Module):
136
+ def __init__(self, args: ModelArgs):
137
+ super().__init__()
138
+ self.self_attn = Attention(args)
139
+ self.mlp = MLP(args.hidden_size, args.intermediate_size)
140
+ self.input_layernorm = nn.RMSNorm(args.hidden_size, eps=args.rms_norm_eps)
141
+ self.post_attention_layernorm = nn.RMSNorm(
142
+ args.hidden_size, eps=args.rms_norm_eps
143
+ )
144
+
145
+ def __call__(
146
+ self,
147
+ x: mx.array,
148
+ mask: Optional[mx.array] = None,
149
+ cache: Optional[Any] = None,
150
+ ) -> mx.array:
151
+ residual = x + self.self_attn(self.input_layernorm(x), mask, cache)
152
+ return residual + self.mlp(self.post_attention_layernorm(residual))
153
+
154
+
155
+ class Model(nn.Module):
156
+ def __init__(self, args: ModelArgs):
157
+ super().__init__()
158
+ self.args = args
159
+ self.model_type = args.model_type
160
+ self.embed_tokens = nn.Embedding(args.vocab_size, args.hidden_size)
161
+ self.layers = [TransformerBlock(args) for _ in range(args.num_hidden_layers)]
162
+ self.norm = nn.RMSNorm(args.hidden_size, eps=args.rms_norm_eps)
163
+
164
+ def __call__(
165
+ self,
166
+ inputs: mx.array,
167
+ cache=None,
168
+ input_embeddings: Optional[mx.array] = None,
169
+ attention_mask: Optional[mx.array] = None,
170
+ ) -> mx.array:
171
+ if input_embeddings is not None:
172
+ h = input_embeddings
173
+ else:
174
+ h = self.embed_tokens(inputs)
175
+
176
+ if cache is None:
177
+ cache = [None] * len(self.layers)
178
+ elif len(cache) != len(self.layers):
179
+ raise ValueError(
180
+ f"Expected cache with {len(self.layers)} layers, got {len(cache)}"
181
+ )
182
+
183
+ if any(layer_cache is not None for layer_cache in cache):
184
+ raise ValueError(
185
+ "KV cache is not supported for this bidirectional embedding model."
186
+ )
187
+
188
+ if attention_mask is not None:
189
+ mask = _make_bidirectional_mask(
190
+ attention_mask,
191
+ batch_size=h.shape[0],
192
+ seq_len=h.shape[1],
193
+ offset=0,
194
+ )
195
+ else:
196
+ mask = None
197
+
198
+ for layer, layer_cache in zip(self.layers, cache):
199
+ h = layer(h, mask, layer_cache)
200
+
201
+ return self.norm(h)
202
+
203
+ def shard(self, group: Optional[mx.distributed.Group] = None):
204
+ group = group or mx.distributed.init()
205
+ n = group.size()
206
+ for layer in self.layers:
207
+ layer.self_attn.q_proj = shard_linear(
208
+ layer.self_attn.q_proj, "all-to-sharded", group=group
209
+ )
210
+ layer.self_attn.k_proj = shard_linear(
211
+ layer.self_attn.k_proj, "all-to-sharded", group=group
212
+ )
213
+ layer.self_attn.v_proj = shard_linear(
214
+ layer.self_attn.v_proj, "all-to-sharded", group=group
215
+ )
216
+ layer.self_attn.o_proj = shard_linear(
217
+ layer.self_attn.o_proj, "sharded-to-all", group=group
218
+ )
219
+ layer.self_attn.n_heads //= n
220
+ layer.self_attn.n_kv_heads //= n
221
+
222
+ layer.mlp.gate_proj = shard_linear(
223
+ layer.mlp.gate_proj, "all-to-sharded", group=group
224
+ )
225
+ layer.mlp.down_proj = shard_linear(
226
+ layer.mlp.down_proj, "sharded-to-all", group=group
227
+ )
228
+ layer.mlp.up_proj = shard_linear(
229
+ layer.mlp.up_proj, "all-to-sharded", group=group
230
+ )
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f384893878795ee18bd9a351ef2f1173b1949a013d6c64afab71b353c564336
3
+ size 5321131845
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e32d5e4c3d725972a8f4fc6938668d44c4dd096040483783b8e0efcb2cf5c4e
3
+ size 2723847252
model.safetensors.index.json ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 8044936192,
4
+ "total_parameters": 4022468096
5
+ },
6
+ "weight_map": {
7
+ "embed_tokens.weight": "model-00001-of-00002.safetensors",
8
+ "layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
9
+ "layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
10
+ "layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
11
+ "layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
12
+ "layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "layers.0.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
14
+ "layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
15
+ "layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
16
+ "layers.0.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
17
+ "layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
18
+ "layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
19
+ "layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
20
+ "layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
21
+ "layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
22
+ "layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
23
+ "layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
24
+ "layers.1.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
25
+ "layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
26
+ "layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
27
+ "layers.1.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
28
+ "layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
29
+ "layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
30
+ "layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
31
+ "layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
32
+ "layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
33
+ "layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
34
+ "layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
35
+ "layers.10.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
36
+ "layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
37
+ "layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
38
+ "layers.10.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
39
+ "layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
40
+ "layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
41
+ "layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
42
+ "layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
43
+ "layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
44
+ "layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
45
+ "layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
46
+ "layers.11.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
47
+ "layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
48
+ "layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
49
+ "layers.11.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
50
+ "layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
51
+ "layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
52
+ "layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
53
+ "layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
54
+ "layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
55
+ "layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
56
+ "layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
57
+ "layers.12.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
58
+ "layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
59
+ "layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
60
+ "layers.12.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
61
+ "layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
62
+ "layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
63
+ "layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
64
+ "layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
65
+ "layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
66
+ "layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
67
+ "layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
68
+ "layers.13.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
69
+ "layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
70
+ "layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
71
+ "layers.13.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
72
+ "layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
73
+ "layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
74
+ "layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
75
+ "layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
76
+ "layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
77
+ "layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
78
+ "layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
79
+ "layers.14.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
80
+ "layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
81
+ "layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
82
+ "layers.14.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
83
+ "layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
84
+ "layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
85
+ "layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
86
+ "layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
87
+ "layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
88
+ "layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
89
+ "layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
90
+ "layers.15.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
91
+ "layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
92
+ "layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
93
+ "layers.15.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
94
+ "layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
95
+ "layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
96
+ "layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
97
+ "layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
98
+ "layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
99
+ "layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
100
+ "layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
101
+ "layers.16.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
102
+ "layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
103
+ "layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
104
+ "layers.16.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
105
+ "layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
106
+ "layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
107
+ "layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
108
+ "layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
109
+ "layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
110
+ "layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
111
+ "layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
112
+ "layers.17.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
113
+ "layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
114
+ "layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
115
+ "layers.17.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
116
+ "layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
117
+ "layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
118
+ "layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
119
+ "layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
120
+ "layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
121
+ "layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
122
+ "layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
123
+ "layers.18.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
124
+ "layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
125
+ "layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
126
+ "layers.18.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
127
+ "layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
128
+ "layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
129
+ "layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
130
+ "layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
131
+ "layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
132
+ "layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
133
+ "layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
134
+ "layers.19.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
135
+ "layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
136
+ "layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
137
+ "layers.19.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
138
+ "layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
139
+ "layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
140
+ "layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
141
+ "layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
142
+ "layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
143
+ "layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
144
+ "layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
145
+ "layers.2.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
146
+ "layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
147
+ "layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
148
+ "layers.2.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
149
+ "layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
150
+ "layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
151
+ "layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
152
+ "layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
153
+ "layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
154
+ "layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
155
+ "layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
156
+ "layers.20.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
157
+ "layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
158
+ "layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
159
+ "layers.20.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
160
+ "layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
161
+ "layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
162
+ "layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors",
163
+ "layers.21.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
164
+ "layers.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
165
+ "layers.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
166
+ "layers.21.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
167
+ "layers.21.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
168
+ "layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
169
+ "layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
170
+ "layers.21.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
171
+ "layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
172
+ "layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
173
+ "layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
174
+ "layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
175
+ "layers.22.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
176
+ "layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
177
+ "layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
178
+ "layers.22.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
179
+ "layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
180
+ "layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
181
+ "layers.22.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
182
+ "layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
183
+ "layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
184
+ "layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
185
+ "layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
186
+ "layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
187
+ "layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
188
+ "layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
189
+ "layers.23.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
190
+ "layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
191
+ "layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
192
+ "layers.23.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
193
+ "layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
194
+ "layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
195
+ "layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
196
+ "layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
197
+ "layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
198
+ "layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
199
+ "layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
200
+ "layers.24.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
201
+ "layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
202
+ "layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
203
+ "layers.24.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
204
+ "layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
205
+ "layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
206
+ "layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
207
+ "layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
208
+ "layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
209
+ "layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
210
+ "layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
211
+ "layers.25.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
212
+ "layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
213
+ "layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
214
+ "layers.25.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
215
+ "layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
216
+ "layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
217
+ "layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
218
+ "layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
219
+ "layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
220
+ "layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
221
+ "layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
222
+ "layers.26.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
223
+ "layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
224
+ "layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
225
+ "layers.26.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
226
+ "layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
227
+ "layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
228
+ "layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
229
+ "layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
230
+ "layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
231
+ "layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
232
+ "layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
233
+ "layers.27.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
234
+ "layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
235
+ "layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
236
+ "layers.27.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
237
+ "layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
238
+ "layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
239
+ "layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
240
+ "layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
241
+ "layers.28.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
242
+ "layers.28.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
243
+ "layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
244
+ "layers.28.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
245
+ "layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
246
+ "layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
247
+ "layers.28.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
248
+ "layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
249
+ "layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
250
+ "layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
251
+ "layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
252
+ "layers.29.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
253
+ "layers.29.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
254
+ "layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
255
+ "layers.29.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
256
+ "layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
257
+ "layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
258
+ "layers.29.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
259
+ "layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
260
+ "layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
261
+ "layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
262
+ "layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
263
+ "layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
264
+ "layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
265
+ "layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
266
+ "layers.3.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
267
+ "layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
268
+ "layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
269
+ "layers.3.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
270
+ "layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
271
+ "layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
272
+ "layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
273
+ "layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
274
+ "layers.30.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
275
+ "layers.30.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
276
+ "layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
277
+ "layers.30.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
278
+ "layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
279
+ "layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
280
+ "layers.30.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
281
+ "layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
282
+ "layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
283
+ "layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
284
+ "layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
285
+ "layers.31.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
286
+ "layers.31.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
287
+ "layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
288
+ "layers.31.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
289
+ "layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
290
+ "layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
291
+ "layers.31.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
292
+ "layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
293
+ "layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
294
+ "layers.32.input_layernorm.weight": "model-00002-of-00002.safetensors",
295
+ "layers.32.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
296
+ "layers.32.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
297
+ "layers.32.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
298
+ "layers.32.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
299
+ "layers.32.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
300
+ "layers.32.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
301
+ "layers.32.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
302
+ "layers.32.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
303
+ "layers.32.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
304
+ "layers.32.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
305
+ "layers.33.input_layernorm.weight": "model-00002-of-00002.safetensors",
306
+ "layers.33.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
307
+ "layers.33.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
308
+ "layers.33.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
309
+ "layers.33.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
310
+ "layers.33.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
311
+ "layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
312
+ "layers.33.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
313
+ "layers.33.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
314
+ "layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
315
+ "layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
316
+ "layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
317
+ "layers.34.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
318
+ "layers.34.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
319
+ "layers.34.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
320
+ "layers.34.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
321
+ "layers.34.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
322
+ "layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
323
+ "layers.34.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
324
+ "layers.34.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
325
+ "layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
326
+ "layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
327
+ "layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
328
+ "layers.35.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
329
+ "layers.35.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
330
+ "layers.35.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
331
+ "layers.35.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
332
+ "layers.35.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
333
+ "layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
334
+ "layers.35.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
335
+ "layers.35.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
336
+ "layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
337
+ "layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
338
+ "layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
339
+ "layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
340
+ "layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
341
+ "layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
342
+ "layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
343
+ "layers.4.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
344
+ "layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
345
+ "layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
346
+ "layers.4.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
347
+ "layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
348
+ "layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
349
+ "layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
350
+ "layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
351
+ "layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
352
+ "layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
353
+ "layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
354
+ "layers.5.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
355
+ "layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
356
+ "layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
357
+ "layers.5.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
358
+ "layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
359
+ "layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
360
+ "layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
361
+ "layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
362
+ "layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
363
+ "layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
364
+ "layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
365
+ "layers.6.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
366
+ "layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
367
+ "layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
368
+ "layers.6.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
369
+ "layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
370
+ "layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
371
+ "layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
372
+ "layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
373
+ "layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
374
+ "layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
375
+ "layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
376
+ "layers.7.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
377
+ "layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
378
+ "layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
379
+ "layers.7.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
380
+ "layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
381
+ "layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
382
+ "layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
383
+ "layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
384
+ "layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
385
+ "layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
386
+ "layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
387
+ "layers.8.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
388
+ "layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
389
+ "layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
390
+ "layers.8.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
391
+ "layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
392
+ "layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
393
+ "layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
394
+ "layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
395
+ "layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
396
+ "layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
397
+ "layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
398
+ "layers.9.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
399
+ "layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
400
+ "layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
401
+ "layers.9.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
402
+ "layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
403
+ "layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
404
+ "norm.weight": "model-00002-of-00002.safetensors"
405
+ }
406
+ }
modeling.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable
2
+ import torch
3
+ from transformers import Qwen3Model
4
+ from transformers.cache_utils import Cache
5
+ from transformers.masking_utils import create_causal_mask
6
+ from transformers.modeling_outputs import BaseModelOutputWithPooling
7
+ from transformers.processing_utils import Unpack
8
+ from transformers.utils import TransformersKwargs
9
+ from .configuration import PPLXQwen3Config
10
+
11
+
12
+ # From modeling_t5gemma.py
13
+ def bidirectional_mask_function(attention_mask: torch.Tensor | None) -> Callable:
14
+ """
15
+ This creates bidirectional attention mask.
16
+ """
17
+
18
+ def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool:
19
+ if attention_mask is None:
20
+ return torch.ones((), dtype=torch.bool)
21
+ return attention_mask[batch_idx, kv_idx].to(torch.bool)
22
+
23
+ return inner_mask
24
+
25
+
26
+ class PPLXQwen3Model(Qwen3Model):
27
+ _supports_flash_attn = True
28
+ _supports_sdpa = True
29
+
30
+ config_class = PPLXQwen3Config
31
+
32
+ def __init__(self, config):
33
+ super().__init__(config)
34
+ self.post_init()
35
+
36
+ def post_init(self):
37
+ super().post_init()
38
+ # Override to set all layers to non-causal attention. This'll work with attn_implementation="flash_attention_2" or "sdpa"
39
+ for layer in self.layers:
40
+ layer.self_attn.is_causal = False
41
+
42
+ def forward(
43
+ self,
44
+ input_ids: torch.LongTensor | None = None,
45
+ attention_mask: torch.Tensor | None = None,
46
+ position_ids: torch.LongTensor | None = None,
47
+ past_key_values: Cache | None = None,
48
+ inputs_embeds: torch.FloatTensor | None = None,
49
+ use_cache: bool | None = None,
50
+ cache_position: torch.LongTensor | None = None,
51
+ **kwargs: Unpack[TransformersKwargs],
52
+ ) -> BaseModelOutputWithPooling:
53
+ if inputs_embeds is None:
54
+ inputs_embeds = self.embed_tokens(input_ids)
55
+ input_ids = None
56
+
57
+ # We construct a dummy tensor imitating initial positions
58
+ dummy_cache_position = torch.arange(
59
+ inputs_embeds.shape[1], device=inputs_embeds.device, dtype=torch.long
60
+ )
61
+ attention_mask = {
62
+ "full_attention": create_causal_mask(
63
+ config=self.config,
64
+ input_embeds=inputs_embeds,
65
+ attention_mask=attention_mask,
66
+ cache_position=dummy_cache_position,
67
+ past_key_values=None,
68
+ position_ids=position_ids,
69
+ or_mask_function=bidirectional_mask_function(attention_mask),
70
+ )
71
+ }
72
+
73
+ outputs = super().forward(
74
+ input_ids=input_ids,
75
+ attention_mask=attention_mask,
76
+ position_ids=position_ids,
77
+ past_key_values=past_key_values,
78
+ inputs_embeds=inputs_embeds,
79
+ use_cache=use_cache,
80
+ cache_position=cache_position,
81
+ **kwargs,
82
+ )
83
+ return outputs
st_quantize.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import numpy as np
3
+ from typing import Literal
4
+ from sentence_transformers.models import Module
5
+
6
+
7
+ class Quantizer(torch.nn.Module):
8
+ def __init__(self, hard: bool = True):
9
+ """
10
+ Args:
11
+ hard: Whether to use hard or soft quantization. Defaults to True.
12
+ """
13
+ super().__init__()
14
+ self._hard = hard
15
+
16
+ def _hard_quantize(self, x, *args, **kwargs) -> torch.Tensor:
17
+ raise NotImplementedError
18
+
19
+ def _soft_quantize(self, x, *args, **kwargs) -> torch.Tensor:
20
+ raise NotImplementedError
21
+
22
+ def forward(self, x, *args, **kwargs) -> torch.Tensor:
23
+ soft = self._soft_quantize(x, *args, **kwargs)
24
+
25
+ if not self._hard:
26
+ result = soft
27
+ else:
28
+ result = (
29
+ self._hard_quantize(x, *args, **kwargs).detach() + soft - soft.detach()
30
+ )
31
+
32
+ return result
33
+
34
+
35
+ class Int8TanhQuantizer(Quantizer):
36
+ def __init__(
37
+ self,
38
+ hard: bool = True,
39
+ ):
40
+ super().__init__(hard=hard)
41
+ self.qmin = -128
42
+ self.qmax = 127
43
+
44
+ def _soft_quantize(self, x, *args, **kwargs):
45
+ return torch.tanh(x)
46
+
47
+ def _hard_quantize(self, x, *args, **kwargs):
48
+ soft = self._soft_quantize(x)
49
+ int_x = torch.round(soft * self.qmax)
50
+ int_x = torch.clamp(int_x, self.qmin, self.qmax)
51
+ return int_x
52
+
53
+
54
+ class BinaryTanhQuantizer(Quantizer):
55
+ def __init__(
56
+ self,
57
+ hard: bool = True,
58
+ scale: float = 1.0,
59
+ ):
60
+ super().__init__(hard)
61
+ self._scale = scale
62
+
63
+ def _soft_quantize(self, x, *args, **kwargs):
64
+ return torch.tanh(self._scale * x)
65
+
66
+ def _hard_quantize(self, x, *args, **kwargs):
67
+ return torch.where(x >= 0, 1.0, -1.0)
68
+
69
+
70
+ class PackedBinaryQuantizer:
71
+ def __call__(self, x: torch.Tensor) -> torch.Tensor:
72
+ bits = np.where(x.cpu().numpy() >= 0, True, False)
73
+ packed = np.packbits(bits, axis=-1)
74
+ return torch.from_numpy(packed).to(x.device)
75
+
76
+
77
+ class FlexibleQuantizer(Module):
78
+ def __init__(self):
79
+ super().__init__()
80
+ self._int8_quantizer = Int8TanhQuantizer()
81
+ self._binary_quantizer = BinaryTanhQuantizer()
82
+ self._packed_binary_quantizer = PackedBinaryQuantizer()
83
+
84
+ def forward(
85
+ self,
86
+ features: dict[str, torch.Tensor],
87
+ quantization: Literal["int8", "binary", "ubinary"] = "int8",
88
+ **kwargs
89
+ ) -> dict[str, torch.Tensor]:
90
+ if quantization == "int8":
91
+ features["sentence_embedding"] = self._int8_quantizer(
92
+ features["sentence_embedding"]
93
+ )
94
+ elif quantization == "binary":
95
+ features["sentence_embedding"] = self._binary_quantizer(
96
+ features["sentence_embedding"]
97
+ )
98
+ elif quantization == "ubinary":
99
+ features["sentence_embedding"] = self._packed_binary_quantizer(
100
+ features["sentence_embedding"]
101
+ )
102
+ else:
103
+ raise ValueError(
104
+ f"Invalid quantization type: {quantization}. Must be 'binary', 'ubinary', or 'int8'."
105
+ )
106
+ return features
107
+
108
+ @classmethod
109
+ def load(
110
+ cls,
111
+ model_name_or_path: str,
112
+ subfolder: str = "",
113
+ token: bool | str | None = None,
114
+ cache_folder: str | None = None,
115
+ revision: str | None = None,
116
+ local_files_only: bool = False,
117
+ **kwargs,
118
+ ):
119
+ return cls()
120
+
121
+ def save(self, output_path: str, *args, **kwargs) -> None:
122
+ return
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db3914d7cce5125c42bbbf875116cef2697023ba144bda8264ad1368595dde2b
3
+ size 11423107
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "mask_token": "â½Ĺ",
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "sep_token": "<|endoftext|>",
13
+ "split_special_tokens": false,
14
+ "tokenizer_class": "Qwen2Tokenizer",
15
+ "unk_token": null
16
+ }