abenzerps commited on
Commit
8f3e832
·
0 Parent(s):

Publish MLX 4-bit release

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - XHToken/Spark-X2.5-4B
4
+ license: apache-2.0
5
+ language:
6
+ - en
7
+ - zh
8
+ library_name: mlx
9
+ pipeline_tag: text-generation
10
+ tags:
11
+ - mlx
12
+ - spark-x2.5
13
+ - long-context
14
+ - 1m-context
15
+ ---
16
+
17
+ # Spark-X2.5-4B MLX 4-bit
18
+
19
+ MLX 4-bit quantization of [XHToken/Spark-X2.5-4B](https://huggingface.co/XHToken/Spark-X2.5-4B), a 4B general-purpose language model for reasoning, coding, tool use, and agentic workflows. Native context: **1,048,576 tokens (1M)**.
20
+
21
+ ## Benchmarks
22
+
23
+ ![Upstream Spark-X2.5-4B benchmark comparison](assets/benchmark.png)
24
+
25
+ *Benchmark results reported by XHToken for Spark-X2.5-4B in thinking mode.*
26
+
27
+ ## Files
28
+
29
+ | Format | Weights | Size |
30
+ | --- | --- | ---: |
31
+ | MLX 4-bit | [model.safetensors](model.safetensors) | 2.31 GB |
32
+
33
+ Includes the upstream `chat_template.jinja`. Checksums: [SHA256SUMS.txt](SHA256SUMS.txt).
34
+
35
+ ## Source
36
+
37
+ - Source model: [XHToken/Spark-X2.5-4B](https://huggingface.co/XHToken/Spark-X2.5-4B)
38
+ - Source revision: [`ea14618d20e76b5b093d3ee20a5b9d733bb12410`](https://huggingface.co/XHToken/Spark-X2.5-4B/tree/ea14618d20e76b5b093d3ee20a5b9d733bb12410)
39
+ - Source license: [Apache-2.0](https://huggingface.co/XHToken/Spark-X2.5-4B/blob/main/LICENSE)
SHA256SUMS.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 1fd6370f641e7fbffb2f57562793bf0493f48d55e3e85c8fe9091bd870a87e8b model.safetensors
SPARK_MLX_LLM_LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
assets/benchmark.png ADDED
chat_template.jinja ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- 0826版本 -#}
2
+ {%- if not messages %}
3
+ {{- raise_exception('No messages provided.') }}
4
+ {%- endif %}
5
+ {%- set enable_thinking = enable_thinking | default(true) %}
6
+
7
+ {#- Render a string or a list of text blocks. -#}
8
+ {%- macro render_content(content, context_name) %}
9
+ {%- if content is string %}
10
+ {{- content }}
11
+ {%- elif content is none or content is undefined %}
12
+ {{- '' }}
13
+ {%- elif content is iterable and content is not mapping %}
14
+ {%- for block in content %}
15
+ {%- if block.type == 'text' %}
16
+ {{- block.text }}
17
+ {%- else %}
18
+ {{- raise_exception('Unsupported ' ~ context_name ~ ' content block type: ' ~ (block.type | string)) }}
19
+ {%- endif %}
20
+ {%- endfor %}
21
+ {%- else %}
22
+ {{- raise_exception(context_name ~ ' content must be a string or a list of text blocks') }}
23
+ {%- endif %}
24
+ {%- endmacro %}
25
+
26
+ {#- Default system prompt -#}
27
+ {%- set default_system = "you are a helpful assistant." %}
28
+
29
+ {#- The first message-level system is placed in the initial system block. -#}
30
+ {%- set ns = namespace(initial_system='') %}
31
+ {%- if messages[0].role == "system" %}
32
+ {%- set ns.initial_system = render_content(messages[0].content, 'system') %}
33
+ {%- endif %}
34
+
35
+ {#- System block -#}
36
+ {{- '<|start▁of▁sentence|><|System|>' + '\n' + default_system }}
37
+ {%- if tools %}
38
+ {{- '## Tools' + '\n' + 'You have access to the following functions:' + '\n' + '<tools>' }}
39
+ {%- for tool in tools %}
40
+ {{- '\n' + tool.function | tojson}}
41
+ {%- endfor %}
42
+ {{- '\n' + '</tools>' }}
43
+ {%- endif %}
44
+ {%- if ns.initial_system %}
45
+ {{- '\n\n' + ns.initial_system }}
46
+ {%- endif %}
47
+ {{- '<|end▁of▁sentence|>'}}
48
+
49
+ {#- Conversation turns -#}
50
+ {%- for message in messages %}
51
+ {%- if message.role == "system" %}
52
+ {#- The first system message was consumed by the initial block. -#}
53
+ {%- if not loop.first %}
54
+ {{- '<|start▁of▁sentence|><|System|>\n' + render_content(message.content, 'system') + '<|end▁of▁sentence|>' }}
55
+ {%- endif %}
56
+ {%- elif message.role == "user" %}
57
+ {{- '<|start▁of▁sentence|><|User|>' + render_content(message.content, 'user') + '<|end▁of▁sentence|>' }}
58
+ {%- elif message.role == "assistant" %}
59
+ {%- set assistant_content = render_content(message.content, 'assistant') %}
60
+ {%- if message.reasoning_content is defined and message.reasoning_content %}
61
+ {%- set reasoning_content = message.reasoning_content %}
62
+ {%- else %}
63
+ {%- set reasoning_content = '' %}
64
+ {%- endif %}
65
+ {{- '<|start▁of▁sentence|><|Bot|>'}}
66
+ {%- if reasoning_content %}
67
+ {{- '<think>' + reasoning_content + '</think>'}}
68
+ {%- else %}
69
+ {{- '</think>' }}
70
+ {%- endif %}
71
+ {%- if assistant_content %}
72
+ {{- assistant_content }}
73
+ {%- endif %}
74
+ {%- if message.tool_calls is defined and message.tool_calls is not none %}
75
+ {%- for tool_call in message.tool_calls %}
76
+ {%- if tool_call.function.arguments is not mapping %}
77
+ {{- raise_exception('tool_call.function.arguments must be a dictionary; normalize JSON strings before apply_chat_template') }}
78
+ {%- endif %}
79
+ {%- set args = tool_call.function.arguments %}
80
+ {{- '<tool_call>' + tool_call.function.name }}
81
+ {%- for k, v in args.items() %}
82
+ {{- '<arg_key>' ~ k ~ '</arg_key><arg_value>' ~ (v if v is string else v | tojson) ~ '</arg_value>' }}
83
+ {%- endfor %}
84
+ {{- '</tool_call>' }}
85
+ {%- endfor %}
86
+ {%- endif %}
87
+ {{- '<|end▁of▁sentence|>' }}
88
+ {%- elif message.role == "tool" %}
89
+ {%- if loop.previtem is undefined or loop.previtem.role != "tool" %}
90
+ {{- '<|start▁of▁sentence|><|Tool|>' }}
91
+ {%- endif %}
92
+ {{- '<tool_response>' ~ message.content ~ '</tool_response>' }}
93
+ {%- if loop.nextitem is undefined or loop.nextitem.role != "tool" %}
94
+ {{- '<|end▁of▁sentence|>' }}
95
+ {%- endif %}
96
+ {%- else %}
97
+ {{- raise_exception('Unsupported message role: ' ~ message.role) }}
98
+ {%- endif %}
99
+ {%- endfor %}
100
+
101
+ {#- Generation prompt -#}
102
+ {%- if add_generation_prompt %}
103
+ {{- '<|start▁of▁sentence|><|Bot|>' }}
104
+ {%- if enable_thinking is defined and enable_thinking %}
105
+ {{- '<think>' }}
106
+ {%- endif %}
107
+ {%- if enable_thinking is defined and not enable_thinking %}
108
+ {{- '</think>' }}
109
+ {%- endif %}
110
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Spark2_5ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_spark.Spark2_5Config",
9
+ "AutoModel": "modeling_spark.Spark2_5Model",
10
+ "AutoModelForCausalLM": "modeling_spark.Spark2_5ForCausalLM"
11
+ },
12
+ "bos_token_id": 0,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 1,
15
+ "gate_attn_act_mode": "sigmoid",
16
+ "head_dim": 256,
17
+ "headwise_attn_output_gate": true,
18
+ "hidden_act": "gelu",
19
+ "hidden_size": 2560,
20
+ "initializer_range": 0.01976,
21
+ "intermediate_size": 10240,
22
+ "layer_types": [
23
+ "sliding_attention",
24
+ "sliding_attention",
25
+ "sliding_attention",
26
+ "full_attention",
27
+ "sliding_attention",
28
+ "sliding_attention",
29
+ "sliding_attention",
30
+ "full_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "sliding_attention",
34
+ "full_attention",
35
+ "sliding_attention",
36
+ "sliding_attention",
37
+ "sliding_attention",
38
+ "full_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "sliding_attention",
46
+ "full_attention",
47
+ "sliding_attention",
48
+ "sliding_attention",
49
+ "sliding_attention",
50
+ "full_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "full_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "sliding_attention",
58
+ "full_attention"
59
+ ],
60
+ "max_position_embeddings": 1048576,
61
+ "mlp_bias": false,
62
+ "model_type": "spark2_5",
63
+ "num_attention_heads": 16,
64
+ "num_hidden_layers": 36,
65
+ "num_key_value_heads": 4,
66
+ "pad_token_id": 2,
67
+ "quantization": {
68
+ "group_size": 64,
69
+ "bits": 4,
70
+ "mode": "affine"
71
+ },
72
+ "quantization_config": {
73
+ "group_size": 64,
74
+ "bits": 4,
75
+ "mode": "affine"
76
+ },
77
+ "rms_norm_eps": 1e-06,
78
+ "rope_parameters": {
79
+ "full_attention": {
80
+ "partial_rotary_factor": 0.25,
81
+ "rope_theta": 5000000
82
+ },
83
+ "sliding_attention": {
84
+ "partial_rotary_factor": 1.0,
85
+ "rope_theta": 10000
86
+ }
87
+ },
88
+ "sliding_window": 512,
89
+ "tie_word_embeddings": true,
90
+ "transformers_version": "4.57.1",
91
+ "use_cache": true,
92
+ "vocab_size": 131072
93
+ }
configuration_spark.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2026 The XHToken team and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from transformers import PretrainedConfig
17
+
18
+
19
+ class Spark2_5Config(PretrainedConfig):
20
+ model_type = "spark2_5"
21
+ keys_to_ignore_at_inference = ["past_key_values"]
22
+
23
+ base_model_tp_plan = {
24
+ "layers.*.self_attn.q_k_v_proj": "colwise",
25
+ "layers.*.self_attn.g_proj": "colwise",
26
+ "layers.*.self_attn.out_proj": "rowwise",
27
+ "layers.*.mlp.gate_proj": "colwise",
28
+ "layers.*.mlp.up_proj": "colwise",
29
+ "layers.*.mlp.down_proj": "rowwise",
30
+ }
31
+ base_model_pp_plan = {
32
+ "embedding": (["input_ids"], ["inputs_embeds"]),
33
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
34
+ "norm": (["hidden_states"], ["hidden_states"]),
35
+ }
36
+
37
+ def __init__(
38
+ self,
39
+ vocab_size=32000,
40
+ hidden_size=4096,
41
+ intermediate_size=11008,
42
+ num_hidden_layers=32,
43
+ num_attention_heads=32,
44
+ num_key_value_heads=None,
45
+ hidden_act="gelu",
46
+ max_position_embeddings=2048,
47
+ initializer_range=0.02,
48
+ rms_norm_eps=1e-6,
49
+ use_cache=True,
50
+ pad_token_id=None,
51
+ bos_token_id=1,
52
+ eos_token_id=2,
53
+ tie_word_embeddings=False,
54
+ rope_parameters=None,
55
+ attention_bias=False,
56
+ attention_dropout=0.0,
57
+ mlp_bias=False,
58
+ head_dim=None,
59
+ headwise_attn_output_gate=False,
60
+ gate_attn_act_mode="sigmoid",
61
+ sliding_window=None,
62
+ layer_types=None,
63
+ **kwargs,
64
+ ):
65
+ self.vocab_size = vocab_size
66
+ self.max_position_embeddings = max_position_embeddings
67
+ self.hidden_size = hidden_size
68
+ self.intermediate_size = intermediate_size
69
+ self.num_hidden_layers = num_hidden_layers
70
+ self.num_attention_heads = num_attention_heads
71
+
72
+ if num_key_value_heads is None:
73
+ num_key_value_heads = num_attention_heads
74
+ if num_attention_heads % num_key_value_heads != 0:
75
+ raise ValueError(
76
+ f"num_attention_heads ({num_attention_heads}) must be divisible by num_key_value_heads ({num_key_value_heads})"
77
+ )
78
+ self.num_key_value_heads = num_key_value_heads
79
+
80
+ self.hidden_act = hidden_act
81
+ self.initializer_range = initializer_range
82
+ self.rms_norm_eps = rms_norm_eps
83
+ self.use_cache = use_cache
84
+ self.attention_bias = attention_bias
85
+ self.attention_dropout = attention_dropout
86
+ self.mlp_bias = mlp_bias
87
+ self.head_dim = head_dim if head_dim is not None else self.hidden_size // self.num_attention_heads
88
+ self.headwise_attn_output_gate = headwise_attn_output_gate
89
+ self.gate_attn_act_mode = gate_attn_act_mode
90
+ self.sliding_window = sliding_window
91
+ self.rope_parameters = rope_parameters
92
+
93
+ if layer_types is None:
94
+ layer_types = ["full_attention"] * num_hidden_layers
95
+ if len(layer_types) != num_hidden_layers:
96
+ raise ValueError(
97
+ f"layer_types length ({len(layer_types)}) must match num_hidden_layers ({num_hidden_layers})"
98
+ )
99
+ self.layer_types = layer_types
100
+
101
+ super().__init__(
102
+ pad_token_id=pad_token_id,
103
+ bos_token_id=bos_token_id,
104
+ eos_token_id=eos_token_id,
105
+ tie_word_embeddings=tie_word_embeddings,
106
+ **kwargs,
107
+ )
108
+
109
+ def get_rope_theta(self, layer_type):
110
+ params = self.rope_parameters.get(layer_type, {})
111
+ return params.get("rope_theta", 10000)
112
+
113
+ def get_partial_rotary_factor(self, layer_type):
114
+ params = self.rope_parameters.get(layer_type, {})
115
+ return params.get("partial_rotary_factor", 1.0)
116
+
117
+
118
+ __all__ = ["Spark2_5Config"]
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 0,
3
+ "eos_token_id": 1,
4
+ "pad_token_id": 2,
5
+ "max_tokens": 1048576,
6
+ "temperature": 1.0,
7
+ "top_p": 0.95,
8
+ "top_k": -1,
9
+ "repetition_penalty": 1.0,
10
+ "presence_penalty":0,
11
+ "frequency_penalty":0,
12
+ "do_sample": true,
13
+ "transformers_version": "4.57.1"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fd6370f641e7fbffb2f57562793bf0493f48d55e3e85c8fe9091bd870a87e8b
3
+ size 2313395808
model.safetensors.index.json ADDED
@@ -0,0 +1,732 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 2313313280,
4
+ "total_parameters": 4112079360
5
+ },
6
+ "weight_map": {
7
+ "model.embedding.biases": "model.safetensors",
8
+ "model.embedding.scales": "model.safetensors",
9
+ "model.embedding.weight": "model.safetensors",
10
+ "model.layers.0.input_layernorm.weight": "model.safetensors",
11
+ "model.layers.0.mlp.down_proj.biases": "model.safetensors",
12
+ "model.layers.0.mlp.down_proj.scales": "model.safetensors",
13
+ "model.layers.0.mlp.down_proj.weight": "model.safetensors",
14
+ "model.layers.0.mlp.gate_proj.biases": "model.safetensors",
15
+ "model.layers.0.mlp.gate_proj.scales": "model.safetensors",
16
+ "model.layers.0.mlp.gate_proj.weight": "model.safetensors",
17
+ "model.layers.0.mlp.up_proj.biases": "model.safetensors",
18
+ "model.layers.0.mlp.up_proj.scales": "model.safetensors",
19
+ "model.layers.0.mlp.up_proj.weight": "model.safetensors",
20
+ "model.layers.0.post_attention_layernorm.weight": "model.safetensors",
21
+ "model.layers.0.self_attn.g_proj.biases": "model.safetensors",
22
+ "model.layers.0.self_attn.g_proj.scales": "model.safetensors",
23
+ "model.layers.0.self_attn.g_proj.weight": "model.safetensors",
24
+ "model.layers.0.self_attn.out_proj.biases": "model.safetensors",
25
+ "model.layers.0.self_attn.out_proj.scales": "model.safetensors",
26
+ "model.layers.0.self_attn.out_proj.weight": "model.safetensors",
27
+ "model.layers.0.self_attn.q_k_v_proj.biases": "model.safetensors",
28
+ "model.layers.0.self_attn.q_k_v_proj.scales": "model.safetensors",
29
+ "model.layers.0.self_attn.q_k_v_proj.weight": "model.safetensors",
30
+ "model.layers.1.input_layernorm.weight": "model.safetensors",
31
+ "model.layers.1.mlp.down_proj.biases": "model.safetensors",
32
+ "model.layers.1.mlp.down_proj.scales": "model.safetensors",
33
+ "model.layers.1.mlp.down_proj.weight": "model.safetensors",
34
+ "model.layers.1.mlp.gate_proj.biases": "model.safetensors",
35
+ "model.layers.1.mlp.gate_proj.scales": "model.safetensors",
36
+ "model.layers.1.mlp.gate_proj.weight": "model.safetensors",
37
+ "model.layers.1.mlp.up_proj.biases": "model.safetensors",
38
+ "model.layers.1.mlp.up_proj.scales": "model.safetensors",
39
+ "model.layers.1.mlp.up_proj.weight": "model.safetensors",
40
+ "model.layers.1.post_attention_layernorm.weight": "model.safetensors",
41
+ "model.layers.1.self_attn.g_proj.biases": "model.safetensors",
42
+ "model.layers.1.self_attn.g_proj.scales": "model.safetensors",
43
+ "model.layers.1.self_attn.g_proj.weight": "model.safetensors",
44
+ "model.layers.1.self_attn.out_proj.biases": "model.safetensors",
45
+ "model.layers.1.self_attn.out_proj.scales": "model.safetensors",
46
+ "model.layers.1.self_attn.out_proj.weight": "model.safetensors",
47
+ "model.layers.1.self_attn.q_k_v_proj.biases": "model.safetensors",
48
+ "model.layers.1.self_attn.q_k_v_proj.scales": "model.safetensors",
49
+ "model.layers.1.self_attn.q_k_v_proj.weight": "model.safetensors",
50
+ "model.layers.10.input_layernorm.weight": "model.safetensors",
51
+ "model.layers.10.mlp.down_proj.biases": "model.safetensors",
52
+ "model.layers.10.mlp.down_proj.scales": "model.safetensors",
53
+ "model.layers.10.mlp.down_proj.weight": "model.safetensors",
54
+ "model.layers.10.mlp.gate_proj.biases": "model.safetensors",
55
+ "model.layers.10.mlp.gate_proj.scales": "model.safetensors",
56
+ "model.layers.10.mlp.gate_proj.weight": "model.safetensors",
57
+ "model.layers.10.mlp.up_proj.biases": "model.safetensors",
58
+ "model.layers.10.mlp.up_proj.scales": "model.safetensors",
59
+ "model.layers.10.mlp.up_proj.weight": "model.safetensors",
60
+ "model.layers.10.post_attention_layernorm.weight": "model.safetensors",
61
+ "model.layers.10.self_attn.g_proj.biases": "model.safetensors",
62
+ "model.layers.10.self_attn.g_proj.scales": "model.safetensors",
63
+ "model.layers.10.self_attn.g_proj.weight": "model.safetensors",
64
+ "model.layers.10.self_attn.out_proj.biases": "model.safetensors",
65
+ "model.layers.10.self_attn.out_proj.scales": "model.safetensors",
66
+ "model.layers.10.self_attn.out_proj.weight": "model.safetensors",
67
+ "model.layers.10.self_attn.q_k_v_proj.biases": "model.safetensors",
68
+ "model.layers.10.self_attn.q_k_v_proj.scales": "model.safetensors",
69
+ "model.layers.10.self_attn.q_k_v_proj.weight": "model.safetensors",
70
+ "model.layers.11.input_layernorm.weight": "model.safetensors",
71
+ "model.layers.11.mlp.down_proj.biases": "model.safetensors",
72
+ "model.layers.11.mlp.down_proj.scales": "model.safetensors",
73
+ "model.layers.11.mlp.down_proj.weight": "model.safetensors",
74
+ "model.layers.11.mlp.gate_proj.biases": "model.safetensors",
75
+ "model.layers.11.mlp.gate_proj.scales": "model.safetensors",
76
+ "model.layers.11.mlp.gate_proj.weight": "model.safetensors",
77
+ "model.layers.11.mlp.up_proj.biases": "model.safetensors",
78
+ "model.layers.11.mlp.up_proj.scales": "model.safetensors",
79
+ "model.layers.11.mlp.up_proj.weight": "model.safetensors",
80
+ "model.layers.11.post_attention_layernorm.weight": "model.safetensors",
81
+ "model.layers.11.self_attn.g_proj.biases": "model.safetensors",
82
+ "model.layers.11.self_attn.g_proj.scales": "model.safetensors",
83
+ "model.layers.11.self_attn.g_proj.weight": "model.safetensors",
84
+ "model.layers.11.self_attn.out_proj.biases": "model.safetensors",
85
+ "model.layers.11.self_attn.out_proj.scales": "model.safetensors",
86
+ "model.layers.11.self_attn.out_proj.weight": "model.safetensors",
87
+ "model.layers.11.self_attn.q_k_v_proj.biases": "model.safetensors",
88
+ "model.layers.11.self_attn.q_k_v_proj.scales": "model.safetensors",
89
+ "model.layers.11.self_attn.q_k_v_proj.weight": "model.safetensors",
90
+ "model.layers.12.input_layernorm.weight": "model.safetensors",
91
+ "model.layers.12.mlp.down_proj.biases": "model.safetensors",
92
+ "model.layers.12.mlp.down_proj.scales": "model.safetensors",
93
+ "model.layers.12.mlp.down_proj.weight": "model.safetensors",
94
+ "model.layers.12.mlp.gate_proj.biases": "model.safetensors",
95
+ "model.layers.12.mlp.gate_proj.scales": "model.safetensors",
96
+ "model.layers.12.mlp.gate_proj.weight": "model.safetensors",
97
+ "model.layers.12.mlp.up_proj.biases": "model.safetensors",
98
+ "model.layers.12.mlp.up_proj.scales": "model.safetensors",
99
+ "model.layers.12.mlp.up_proj.weight": "model.safetensors",
100
+ "model.layers.12.post_attention_layernorm.weight": "model.safetensors",
101
+ "model.layers.12.self_attn.g_proj.biases": "model.safetensors",
102
+ "model.layers.12.self_attn.g_proj.scales": "model.safetensors",
103
+ "model.layers.12.self_attn.g_proj.weight": "model.safetensors",
104
+ "model.layers.12.self_attn.out_proj.biases": "model.safetensors",
105
+ "model.layers.12.self_attn.out_proj.scales": "model.safetensors",
106
+ "model.layers.12.self_attn.out_proj.weight": "model.safetensors",
107
+ "model.layers.12.self_attn.q_k_v_proj.biases": "model.safetensors",
108
+ "model.layers.12.self_attn.q_k_v_proj.scales": "model.safetensors",
109
+ "model.layers.12.self_attn.q_k_v_proj.weight": "model.safetensors",
110
+ "model.layers.13.input_layernorm.weight": "model.safetensors",
111
+ "model.layers.13.mlp.down_proj.biases": "model.safetensors",
112
+ "model.layers.13.mlp.down_proj.scales": "model.safetensors",
113
+ "model.layers.13.mlp.down_proj.weight": "model.safetensors",
114
+ "model.layers.13.mlp.gate_proj.biases": "model.safetensors",
115
+ "model.layers.13.mlp.gate_proj.scales": "model.safetensors",
116
+ "model.layers.13.mlp.gate_proj.weight": "model.safetensors",
117
+ "model.layers.13.mlp.up_proj.biases": "model.safetensors",
118
+ "model.layers.13.mlp.up_proj.scales": "model.safetensors",
119
+ "model.layers.13.mlp.up_proj.weight": "model.safetensors",
120
+ "model.layers.13.post_attention_layernorm.weight": "model.safetensors",
121
+ "model.layers.13.self_attn.g_proj.biases": "model.safetensors",
122
+ "model.layers.13.self_attn.g_proj.scales": "model.safetensors",
123
+ "model.layers.13.self_attn.g_proj.weight": "model.safetensors",
124
+ "model.layers.13.self_attn.out_proj.biases": "model.safetensors",
125
+ "model.layers.13.self_attn.out_proj.scales": "model.safetensors",
126
+ "model.layers.13.self_attn.out_proj.weight": "model.safetensors",
127
+ "model.layers.13.self_attn.q_k_v_proj.biases": "model.safetensors",
128
+ "model.layers.13.self_attn.q_k_v_proj.scales": "model.safetensors",
129
+ "model.layers.13.self_attn.q_k_v_proj.weight": "model.safetensors",
130
+ "model.layers.14.input_layernorm.weight": "model.safetensors",
131
+ "model.layers.14.mlp.down_proj.biases": "model.safetensors",
132
+ "model.layers.14.mlp.down_proj.scales": "model.safetensors",
133
+ "model.layers.14.mlp.down_proj.weight": "model.safetensors",
134
+ "model.layers.14.mlp.gate_proj.biases": "model.safetensors",
135
+ "model.layers.14.mlp.gate_proj.scales": "model.safetensors",
136
+ "model.layers.14.mlp.gate_proj.weight": "model.safetensors",
137
+ "model.layers.14.mlp.up_proj.biases": "model.safetensors",
138
+ "model.layers.14.mlp.up_proj.scales": "model.safetensors",
139
+ "model.layers.14.mlp.up_proj.weight": "model.safetensors",
140
+ "model.layers.14.post_attention_layernorm.weight": "model.safetensors",
141
+ "model.layers.14.self_attn.g_proj.biases": "model.safetensors",
142
+ "model.layers.14.self_attn.g_proj.scales": "model.safetensors",
143
+ "model.layers.14.self_attn.g_proj.weight": "model.safetensors",
144
+ "model.layers.14.self_attn.out_proj.biases": "model.safetensors",
145
+ "model.layers.14.self_attn.out_proj.scales": "model.safetensors",
146
+ "model.layers.14.self_attn.out_proj.weight": "model.safetensors",
147
+ "model.layers.14.self_attn.q_k_v_proj.biases": "model.safetensors",
148
+ "model.layers.14.self_attn.q_k_v_proj.scales": "model.safetensors",
149
+ "model.layers.14.self_attn.q_k_v_proj.weight": "model.safetensors",
150
+ "model.layers.15.input_layernorm.weight": "model.safetensors",
151
+ "model.layers.15.mlp.down_proj.biases": "model.safetensors",
152
+ "model.layers.15.mlp.down_proj.scales": "model.safetensors",
153
+ "model.layers.15.mlp.down_proj.weight": "model.safetensors",
154
+ "model.layers.15.mlp.gate_proj.biases": "model.safetensors",
155
+ "model.layers.15.mlp.gate_proj.scales": "model.safetensors",
156
+ "model.layers.15.mlp.gate_proj.weight": "model.safetensors",
157
+ "model.layers.15.mlp.up_proj.biases": "model.safetensors",
158
+ "model.layers.15.mlp.up_proj.scales": "model.safetensors",
159
+ "model.layers.15.mlp.up_proj.weight": "model.safetensors",
160
+ "model.layers.15.post_attention_layernorm.weight": "model.safetensors",
161
+ "model.layers.15.self_attn.g_proj.biases": "model.safetensors",
162
+ "model.layers.15.self_attn.g_proj.scales": "model.safetensors",
163
+ "model.layers.15.self_attn.g_proj.weight": "model.safetensors",
164
+ "model.layers.15.self_attn.out_proj.biases": "model.safetensors",
165
+ "model.layers.15.self_attn.out_proj.scales": "model.safetensors",
166
+ "model.layers.15.self_attn.out_proj.weight": "model.safetensors",
167
+ "model.layers.15.self_attn.q_k_v_proj.biases": "model.safetensors",
168
+ "model.layers.15.self_attn.q_k_v_proj.scales": "model.safetensors",
169
+ "model.layers.15.self_attn.q_k_v_proj.weight": "model.safetensors",
170
+ "model.layers.16.input_layernorm.weight": "model.safetensors",
171
+ "model.layers.16.mlp.down_proj.biases": "model.safetensors",
172
+ "model.layers.16.mlp.down_proj.scales": "model.safetensors",
173
+ "model.layers.16.mlp.down_proj.weight": "model.safetensors",
174
+ "model.layers.16.mlp.gate_proj.biases": "model.safetensors",
175
+ "model.layers.16.mlp.gate_proj.scales": "model.safetensors",
176
+ "model.layers.16.mlp.gate_proj.weight": "model.safetensors",
177
+ "model.layers.16.mlp.up_proj.biases": "model.safetensors",
178
+ "model.layers.16.mlp.up_proj.scales": "model.safetensors",
179
+ "model.layers.16.mlp.up_proj.weight": "model.safetensors",
180
+ "model.layers.16.post_attention_layernorm.weight": "model.safetensors",
181
+ "model.layers.16.self_attn.g_proj.biases": "model.safetensors",
182
+ "model.layers.16.self_attn.g_proj.scales": "model.safetensors",
183
+ "model.layers.16.self_attn.g_proj.weight": "model.safetensors",
184
+ "model.layers.16.self_attn.out_proj.biases": "model.safetensors",
185
+ "model.layers.16.self_attn.out_proj.scales": "model.safetensors",
186
+ "model.layers.16.self_attn.out_proj.weight": "model.safetensors",
187
+ "model.layers.16.self_attn.q_k_v_proj.biases": "model.safetensors",
188
+ "model.layers.16.self_attn.q_k_v_proj.scales": "model.safetensors",
189
+ "model.layers.16.self_attn.q_k_v_proj.weight": "model.safetensors",
190
+ "model.layers.17.input_layernorm.weight": "model.safetensors",
191
+ "model.layers.17.mlp.down_proj.biases": "model.safetensors",
192
+ "model.layers.17.mlp.down_proj.scales": "model.safetensors",
193
+ "model.layers.17.mlp.down_proj.weight": "model.safetensors",
194
+ "model.layers.17.mlp.gate_proj.biases": "model.safetensors",
195
+ "model.layers.17.mlp.gate_proj.scales": "model.safetensors",
196
+ "model.layers.17.mlp.gate_proj.weight": "model.safetensors",
197
+ "model.layers.17.mlp.up_proj.biases": "model.safetensors",
198
+ "model.layers.17.mlp.up_proj.scales": "model.safetensors",
199
+ "model.layers.17.mlp.up_proj.weight": "model.safetensors",
200
+ "model.layers.17.post_attention_layernorm.weight": "model.safetensors",
201
+ "model.layers.17.self_attn.g_proj.biases": "model.safetensors",
202
+ "model.layers.17.self_attn.g_proj.scales": "model.safetensors",
203
+ "model.layers.17.self_attn.g_proj.weight": "model.safetensors",
204
+ "model.layers.17.self_attn.out_proj.biases": "model.safetensors",
205
+ "model.layers.17.self_attn.out_proj.scales": "model.safetensors",
206
+ "model.layers.17.self_attn.out_proj.weight": "model.safetensors",
207
+ "model.layers.17.self_attn.q_k_v_proj.biases": "model.safetensors",
208
+ "model.layers.17.self_attn.q_k_v_proj.scales": "model.safetensors",
209
+ "model.layers.17.self_attn.q_k_v_proj.weight": "model.safetensors",
210
+ "model.layers.18.input_layernorm.weight": "model.safetensors",
211
+ "model.layers.18.mlp.down_proj.biases": "model.safetensors",
212
+ "model.layers.18.mlp.down_proj.scales": "model.safetensors",
213
+ "model.layers.18.mlp.down_proj.weight": "model.safetensors",
214
+ "model.layers.18.mlp.gate_proj.biases": "model.safetensors",
215
+ "model.layers.18.mlp.gate_proj.scales": "model.safetensors",
216
+ "model.layers.18.mlp.gate_proj.weight": "model.safetensors",
217
+ "model.layers.18.mlp.up_proj.biases": "model.safetensors",
218
+ "model.layers.18.mlp.up_proj.scales": "model.safetensors",
219
+ "model.layers.18.mlp.up_proj.weight": "model.safetensors",
220
+ "model.layers.18.post_attention_layernorm.weight": "model.safetensors",
221
+ "model.layers.18.self_attn.g_proj.biases": "model.safetensors",
222
+ "model.layers.18.self_attn.g_proj.scales": "model.safetensors",
223
+ "model.layers.18.self_attn.g_proj.weight": "model.safetensors",
224
+ "model.layers.18.self_attn.out_proj.biases": "model.safetensors",
225
+ "model.layers.18.self_attn.out_proj.scales": "model.safetensors",
226
+ "model.layers.18.self_attn.out_proj.weight": "model.safetensors",
227
+ "model.layers.18.self_attn.q_k_v_proj.biases": "model.safetensors",
228
+ "model.layers.18.self_attn.q_k_v_proj.scales": "model.safetensors",
229
+ "model.layers.18.self_attn.q_k_v_proj.weight": "model.safetensors",
230
+ "model.layers.19.input_layernorm.weight": "model.safetensors",
231
+ "model.layers.19.mlp.down_proj.biases": "model.safetensors",
232
+ "model.layers.19.mlp.down_proj.scales": "model.safetensors",
233
+ "model.layers.19.mlp.down_proj.weight": "model.safetensors",
234
+ "model.layers.19.mlp.gate_proj.biases": "model.safetensors",
235
+ "model.layers.19.mlp.gate_proj.scales": "model.safetensors",
236
+ "model.layers.19.mlp.gate_proj.weight": "model.safetensors",
237
+ "model.layers.19.mlp.up_proj.biases": "model.safetensors",
238
+ "model.layers.19.mlp.up_proj.scales": "model.safetensors",
239
+ "model.layers.19.mlp.up_proj.weight": "model.safetensors",
240
+ "model.layers.19.post_attention_layernorm.weight": "model.safetensors",
241
+ "model.layers.19.self_attn.g_proj.biases": "model.safetensors",
242
+ "model.layers.19.self_attn.g_proj.scales": "model.safetensors",
243
+ "model.layers.19.self_attn.g_proj.weight": "model.safetensors",
244
+ "model.layers.19.self_attn.out_proj.biases": "model.safetensors",
245
+ "model.layers.19.self_attn.out_proj.scales": "model.safetensors",
246
+ "model.layers.19.self_attn.out_proj.weight": "model.safetensors",
247
+ "model.layers.19.self_attn.q_k_v_proj.biases": "model.safetensors",
248
+ "model.layers.19.self_attn.q_k_v_proj.scales": "model.safetensors",
249
+ "model.layers.19.self_attn.q_k_v_proj.weight": "model.safetensors",
250
+ "model.layers.2.input_layernorm.weight": "model.safetensors",
251
+ "model.layers.2.mlp.down_proj.biases": "model.safetensors",
252
+ "model.layers.2.mlp.down_proj.scales": "model.safetensors",
253
+ "model.layers.2.mlp.down_proj.weight": "model.safetensors",
254
+ "model.layers.2.mlp.gate_proj.biases": "model.safetensors",
255
+ "model.layers.2.mlp.gate_proj.scales": "model.safetensors",
256
+ "model.layers.2.mlp.gate_proj.weight": "model.safetensors",
257
+ "model.layers.2.mlp.up_proj.biases": "model.safetensors",
258
+ "model.layers.2.mlp.up_proj.scales": "model.safetensors",
259
+ "model.layers.2.mlp.up_proj.weight": "model.safetensors",
260
+ "model.layers.2.post_attention_layernorm.weight": "model.safetensors",
261
+ "model.layers.2.self_attn.g_proj.biases": "model.safetensors",
262
+ "model.layers.2.self_attn.g_proj.scales": "model.safetensors",
263
+ "model.layers.2.self_attn.g_proj.weight": "model.safetensors",
264
+ "model.layers.2.self_attn.out_proj.biases": "model.safetensors",
265
+ "model.layers.2.self_attn.out_proj.scales": "model.safetensors",
266
+ "model.layers.2.self_attn.out_proj.weight": "model.safetensors",
267
+ "model.layers.2.self_attn.q_k_v_proj.biases": "model.safetensors",
268
+ "model.layers.2.self_attn.q_k_v_proj.scales": "model.safetensors",
269
+ "model.layers.2.self_attn.q_k_v_proj.weight": "model.safetensors",
270
+ "model.layers.20.input_layernorm.weight": "model.safetensors",
271
+ "model.layers.20.mlp.down_proj.biases": "model.safetensors",
272
+ "model.layers.20.mlp.down_proj.scales": "model.safetensors",
273
+ "model.layers.20.mlp.down_proj.weight": "model.safetensors",
274
+ "model.layers.20.mlp.gate_proj.biases": "model.safetensors",
275
+ "model.layers.20.mlp.gate_proj.scales": "model.safetensors",
276
+ "model.layers.20.mlp.gate_proj.weight": "model.safetensors",
277
+ "model.layers.20.mlp.up_proj.biases": "model.safetensors",
278
+ "model.layers.20.mlp.up_proj.scales": "model.safetensors",
279
+ "model.layers.20.mlp.up_proj.weight": "model.safetensors",
280
+ "model.layers.20.post_attention_layernorm.weight": "model.safetensors",
281
+ "model.layers.20.self_attn.g_proj.biases": "model.safetensors",
282
+ "model.layers.20.self_attn.g_proj.scales": "model.safetensors",
283
+ "model.layers.20.self_attn.g_proj.weight": "model.safetensors",
284
+ "model.layers.20.self_attn.out_proj.biases": "model.safetensors",
285
+ "model.layers.20.self_attn.out_proj.scales": "model.safetensors",
286
+ "model.layers.20.self_attn.out_proj.weight": "model.safetensors",
287
+ "model.layers.20.self_attn.q_k_v_proj.biases": "model.safetensors",
288
+ "model.layers.20.self_attn.q_k_v_proj.scales": "model.safetensors",
289
+ "model.layers.20.self_attn.q_k_v_proj.weight": "model.safetensors",
290
+ "model.layers.21.input_layernorm.weight": "model.safetensors",
291
+ "model.layers.21.mlp.down_proj.biases": "model.safetensors",
292
+ "model.layers.21.mlp.down_proj.scales": "model.safetensors",
293
+ "model.layers.21.mlp.down_proj.weight": "model.safetensors",
294
+ "model.layers.21.mlp.gate_proj.biases": "model.safetensors",
295
+ "model.layers.21.mlp.gate_proj.scales": "model.safetensors",
296
+ "model.layers.21.mlp.gate_proj.weight": "model.safetensors",
297
+ "model.layers.21.mlp.up_proj.biases": "model.safetensors",
298
+ "model.layers.21.mlp.up_proj.scales": "model.safetensors",
299
+ "model.layers.21.mlp.up_proj.weight": "model.safetensors",
300
+ "model.layers.21.post_attention_layernorm.weight": "model.safetensors",
301
+ "model.layers.21.self_attn.g_proj.biases": "model.safetensors",
302
+ "model.layers.21.self_attn.g_proj.scales": "model.safetensors",
303
+ "model.layers.21.self_attn.g_proj.weight": "model.safetensors",
304
+ "model.layers.21.self_attn.out_proj.biases": "model.safetensors",
305
+ "model.layers.21.self_attn.out_proj.scales": "model.safetensors",
306
+ "model.layers.21.self_attn.out_proj.weight": "model.safetensors",
307
+ "model.layers.21.self_attn.q_k_v_proj.biases": "model.safetensors",
308
+ "model.layers.21.self_attn.q_k_v_proj.scales": "model.safetensors",
309
+ "model.layers.21.self_attn.q_k_v_proj.weight": "model.safetensors",
310
+ "model.layers.22.input_layernorm.weight": "model.safetensors",
311
+ "model.layers.22.mlp.down_proj.biases": "model.safetensors",
312
+ "model.layers.22.mlp.down_proj.scales": "model.safetensors",
313
+ "model.layers.22.mlp.down_proj.weight": "model.safetensors",
314
+ "model.layers.22.mlp.gate_proj.biases": "model.safetensors",
315
+ "model.layers.22.mlp.gate_proj.scales": "model.safetensors",
316
+ "model.layers.22.mlp.gate_proj.weight": "model.safetensors",
317
+ "model.layers.22.mlp.up_proj.biases": "model.safetensors",
318
+ "model.layers.22.mlp.up_proj.scales": "model.safetensors",
319
+ "model.layers.22.mlp.up_proj.weight": "model.safetensors",
320
+ "model.layers.22.post_attention_layernorm.weight": "model.safetensors",
321
+ "model.layers.22.self_attn.g_proj.biases": "model.safetensors",
322
+ "model.layers.22.self_attn.g_proj.scales": "model.safetensors",
323
+ "model.layers.22.self_attn.g_proj.weight": "model.safetensors",
324
+ "model.layers.22.self_attn.out_proj.biases": "model.safetensors",
325
+ "model.layers.22.self_attn.out_proj.scales": "model.safetensors",
326
+ "model.layers.22.self_attn.out_proj.weight": "model.safetensors",
327
+ "model.layers.22.self_attn.q_k_v_proj.biases": "model.safetensors",
328
+ "model.layers.22.self_attn.q_k_v_proj.scales": "model.safetensors",
329
+ "model.layers.22.self_attn.q_k_v_proj.weight": "model.safetensors",
330
+ "model.layers.23.input_layernorm.weight": "model.safetensors",
331
+ "model.layers.23.mlp.down_proj.biases": "model.safetensors",
332
+ "model.layers.23.mlp.down_proj.scales": "model.safetensors",
333
+ "model.layers.23.mlp.down_proj.weight": "model.safetensors",
334
+ "model.layers.23.mlp.gate_proj.biases": "model.safetensors",
335
+ "model.layers.23.mlp.gate_proj.scales": "model.safetensors",
336
+ "model.layers.23.mlp.gate_proj.weight": "model.safetensors",
337
+ "model.layers.23.mlp.up_proj.biases": "model.safetensors",
338
+ "model.layers.23.mlp.up_proj.scales": "model.safetensors",
339
+ "model.layers.23.mlp.up_proj.weight": "model.safetensors",
340
+ "model.layers.23.post_attention_layernorm.weight": "model.safetensors",
341
+ "model.layers.23.self_attn.g_proj.biases": "model.safetensors",
342
+ "model.layers.23.self_attn.g_proj.scales": "model.safetensors",
343
+ "model.layers.23.self_attn.g_proj.weight": "model.safetensors",
344
+ "model.layers.23.self_attn.out_proj.biases": "model.safetensors",
345
+ "model.layers.23.self_attn.out_proj.scales": "model.safetensors",
346
+ "model.layers.23.self_attn.out_proj.weight": "model.safetensors",
347
+ "model.layers.23.self_attn.q_k_v_proj.biases": "model.safetensors",
348
+ "model.layers.23.self_attn.q_k_v_proj.scales": "model.safetensors",
349
+ "model.layers.23.self_attn.q_k_v_proj.weight": "model.safetensors",
350
+ "model.layers.24.input_layernorm.weight": "model.safetensors",
351
+ "model.layers.24.mlp.down_proj.biases": "model.safetensors",
352
+ "model.layers.24.mlp.down_proj.scales": "model.safetensors",
353
+ "model.layers.24.mlp.down_proj.weight": "model.safetensors",
354
+ "model.layers.24.mlp.gate_proj.biases": "model.safetensors",
355
+ "model.layers.24.mlp.gate_proj.scales": "model.safetensors",
356
+ "model.layers.24.mlp.gate_proj.weight": "model.safetensors",
357
+ "model.layers.24.mlp.up_proj.biases": "model.safetensors",
358
+ "model.layers.24.mlp.up_proj.scales": "model.safetensors",
359
+ "model.layers.24.mlp.up_proj.weight": "model.safetensors",
360
+ "model.layers.24.post_attention_layernorm.weight": "model.safetensors",
361
+ "model.layers.24.self_attn.g_proj.biases": "model.safetensors",
362
+ "model.layers.24.self_attn.g_proj.scales": "model.safetensors",
363
+ "model.layers.24.self_attn.g_proj.weight": "model.safetensors",
364
+ "model.layers.24.self_attn.out_proj.biases": "model.safetensors",
365
+ "model.layers.24.self_attn.out_proj.scales": "model.safetensors",
366
+ "model.layers.24.self_attn.out_proj.weight": "model.safetensors",
367
+ "model.layers.24.self_attn.q_k_v_proj.biases": "model.safetensors",
368
+ "model.layers.24.self_attn.q_k_v_proj.scales": "model.safetensors",
369
+ "model.layers.24.self_attn.q_k_v_proj.weight": "model.safetensors",
370
+ "model.layers.25.input_layernorm.weight": "model.safetensors",
371
+ "model.layers.25.mlp.down_proj.biases": "model.safetensors",
372
+ "model.layers.25.mlp.down_proj.scales": "model.safetensors",
373
+ "model.layers.25.mlp.down_proj.weight": "model.safetensors",
374
+ "model.layers.25.mlp.gate_proj.biases": "model.safetensors",
375
+ "model.layers.25.mlp.gate_proj.scales": "model.safetensors",
376
+ "model.layers.25.mlp.gate_proj.weight": "model.safetensors",
377
+ "model.layers.25.mlp.up_proj.biases": "model.safetensors",
378
+ "model.layers.25.mlp.up_proj.scales": "model.safetensors",
379
+ "model.layers.25.mlp.up_proj.weight": "model.safetensors",
380
+ "model.layers.25.post_attention_layernorm.weight": "model.safetensors",
381
+ "model.layers.25.self_attn.g_proj.biases": "model.safetensors",
382
+ "model.layers.25.self_attn.g_proj.scales": "model.safetensors",
383
+ "model.layers.25.self_attn.g_proj.weight": "model.safetensors",
384
+ "model.layers.25.self_attn.out_proj.biases": "model.safetensors",
385
+ "model.layers.25.self_attn.out_proj.scales": "model.safetensors",
386
+ "model.layers.25.self_attn.out_proj.weight": "model.safetensors",
387
+ "model.layers.25.self_attn.q_k_v_proj.biases": "model.safetensors",
388
+ "model.layers.25.self_attn.q_k_v_proj.scales": "model.safetensors",
389
+ "model.layers.25.self_attn.q_k_v_proj.weight": "model.safetensors",
390
+ "model.layers.26.input_layernorm.weight": "model.safetensors",
391
+ "model.layers.26.mlp.down_proj.biases": "model.safetensors",
392
+ "model.layers.26.mlp.down_proj.scales": "model.safetensors",
393
+ "model.layers.26.mlp.down_proj.weight": "model.safetensors",
394
+ "model.layers.26.mlp.gate_proj.biases": "model.safetensors",
395
+ "model.layers.26.mlp.gate_proj.scales": "model.safetensors",
396
+ "model.layers.26.mlp.gate_proj.weight": "model.safetensors",
397
+ "model.layers.26.mlp.up_proj.biases": "model.safetensors",
398
+ "model.layers.26.mlp.up_proj.scales": "model.safetensors",
399
+ "model.layers.26.mlp.up_proj.weight": "model.safetensors",
400
+ "model.layers.26.post_attention_layernorm.weight": "model.safetensors",
401
+ "model.layers.26.self_attn.g_proj.biases": "model.safetensors",
402
+ "model.layers.26.self_attn.g_proj.scales": "model.safetensors",
403
+ "model.layers.26.self_attn.g_proj.weight": "model.safetensors",
404
+ "model.layers.26.self_attn.out_proj.biases": "model.safetensors",
405
+ "model.layers.26.self_attn.out_proj.scales": "model.safetensors",
406
+ "model.layers.26.self_attn.out_proj.weight": "model.safetensors",
407
+ "model.layers.26.self_attn.q_k_v_proj.biases": "model.safetensors",
408
+ "model.layers.26.self_attn.q_k_v_proj.scales": "model.safetensors",
409
+ "model.layers.26.self_attn.q_k_v_proj.weight": "model.safetensors",
410
+ "model.layers.27.input_layernorm.weight": "model.safetensors",
411
+ "model.layers.27.mlp.down_proj.biases": "model.safetensors",
412
+ "model.layers.27.mlp.down_proj.scales": "model.safetensors",
413
+ "model.layers.27.mlp.down_proj.weight": "model.safetensors",
414
+ "model.layers.27.mlp.gate_proj.biases": "model.safetensors",
415
+ "model.layers.27.mlp.gate_proj.scales": "model.safetensors",
416
+ "model.layers.27.mlp.gate_proj.weight": "model.safetensors",
417
+ "model.layers.27.mlp.up_proj.biases": "model.safetensors",
418
+ "model.layers.27.mlp.up_proj.scales": "model.safetensors",
419
+ "model.layers.27.mlp.up_proj.weight": "model.safetensors",
420
+ "model.layers.27.post_attention_layernorm.weight": "model.safetensors",
421
+ "model.layers.27.self_attn.g_proj.biases": "model.safetensors",
422
+ "model.layers.27.self_attn.g_proj.scales": "model.safetensors",
423
+ "model.layers.27.self_attn.g_proj.weight": "model.safetensors",
424
+ "model.layers.27.self_attn.out_proj.biases": "model.safetensors",
425
+ "model.layers.27.self_attn.out_proj.scales": "model.safetensors",
426
+ "model.layers.27.self_attn.out_proj.weight": "model.safetensors",
427
+ "model.layers.27.self_attn.q_k_v_proj.biases": "model.safetensors",
428
+ "model.layers.27.self_attn.q_k_v_proj.scales": "model.safetensors",
429
+ "model.layers.27.self_attn.q_k_v_proj.weight": "model.safetensors",
430
+ "model.layers.28.input_layernorm.weight": "model.safetensors",
431
+ "model.layers.28.mlp.down_proj.biases": "model.safetensors",
432
+ "model.layers.28.mlp.down_proj.scales": "model.safetensors",
433
+ "model.layers.28.mlp.down_proj.weight": "model.safetensors",
434
+ "model.layers.28.mlp.gate_proj.biases": "model.safetensors",
435
+ "model.layers.28.mlp.gate_proj.scales": "model.safetensors",
436
+ "model.layers.28.mlp.gate_proj.weight": "model.safetensors",
437
+ "model.layers.28.mlp.up_proj.biases": "model.safetensors",
438
+ "model.layers.28.mlp.up_proj.scales": "model.safetensors",
439
+ "model.layers.28.mlp.up_proj.weight": "model.safetensors",
440
+ "model.layers.28.post_attention_layernorm.weight": "model.safetensors",
441
+ "model.layers.28.self_attn.g_proj.biases": "model.safetensors",
442
+ "model.layers.28.self_attn.g_proj.scales": "model.safetensors",
443
+ "model.layers.28.self_attn.g_proj.weight": "model.safetensors",
444
+ "model.layers.28.self_attn.out_proj.biases": "model.safetensors",
445
+ "model.layers.28.self_attn.out_proj.scales": "model.safetensors",
446
+ "model.layers.28.self_attn.out_proj.weight": "model.safetensors",
447
+ "model.layers.28.self_attn.q_k_v_proj.biases": "model.safetensors",
448
+ "model.layers.28.self_attn.q_k_v_proj.scales": "model.safetensors",
449
+ "model.layers.28.self_attn.q_k_v_proj.weight": "model.safetensors",
450
+ "model.layers.29.input_layernorm.weight": "model.safetensors",
451
+ "model.layers.29.mlp.down_proj.biases": "model.safetensors",
452
+ "model.layers.29.mlp.down_proj.scales": "model.safetensors",
453
+ "model.layers.29.mlp.down_proj.weight": "model.safetensors",
454
+ "model.layers.29.mlp.gate_proj.biases": "model.safetensors",
455
+ "model.layers.29.mlp.gate_proj.scales": "model.safetensors",
456
+ "model.layers.29.mlp.gate_proj.weight": "model.safetensors",
457
+ "model.layers.29.mlp.up_proj.biases": "model.safetensors",
458
+ "model.layers.29.mlp.up_proj.scales": "model.safetensors",
459
+ "model.layers.29.mlp.up_proj.weight": "model.safetensors",
460
+ "model.layers.29.post_attention_layernorm.weight": "model.safetensors",
461
+ "model.layers.29.self_attn.g_proj.biases": "model.safetensors",
462
+ "model.layers.29.self_attn.g_proj.scales": "model.safetensors",
463
+ "model.layers.29.self_attn.g_proj.weight": "model.safetensors",
464
+ "model.layers.29.self_attn.out_proj.biases": "model.safetensors",
465
+ "model.layers.29.self_attn.out_proj.scales": "model.safetensors",
466
+ "model.layers.29.self_attn.out_proj.weight": "model.safetensors",
467
+ "model.layers.29.self_attn.q_k_v_proj.biases": "model.safetensors",
468
+ "model.layers.29.self_attn.q_k_v_proj.scales": "model.safetensors",
469
+ "model.layers.29.self_attn.q_k_v_proj.weight": "model.safetensors",
470
+ "model.layers.3.input_layernorm.weight": "model.safetensors",
471
+ "model.layers.3.mlp.down_proj.biases": "model.safetensors",
472
+ "model.layers.3.mlp.down_proj.scales": "model.safetensors",
473
+ "model.layers.3.mlp.down_proj.weight": "model.safetensors",
474
+ "model.layers.3.mlp.gate_proj.biases": "model.safetensors",
475
+ "model.layers.3.mlp.gate_proj.scales": "model.safetensors",
476
+ "model.layers.3.mlp.gate_proj.weight": "model.safetensors",
477
+ "model.layers.3.mlp.up_proj.biases": "model.safetensors",
478
+ "model.layers.3.mlp.up_proj.scales": "model.safetensors",
479
+ "model.layers.3.mlp.up_proj.weight": "model.safetensors",
480
+ "model.layers.3.post_attention_layernorm.weight": "model.safetensors",
481
+ "model.layers.3.self_attn.g_proj.biases": "model.safetensors",
482
+ "model.layers.3.self_attn.g_proj.scales": "model.safetensors",
483
+ "model.layers.3.self_attn.g_proj.weight": "model.safetensors",
484
+ "model.layers.3.self_attn.out_proj.biases": "model.safetensors",
485
+ "model.layers.3.self_attn.out_proj.scales": "model.safetensors",
486
+ "model.layers.3.self_attn.out_proj.weight": "model.safetensors",
487
+ "model.layers.3.self_attn.q_k_v_proj.biases": "model.safetensors",
488
+ "model.layers.3.self_attn.q_k_v_proj.scales": "model.safetensors",
489
+ "model.layers.3.self_attn.q_k_v_proj.weight": "model.safetensors",
490
+ "model.layers.30.input_layernorm.weight": "model.safetensors",
491
+ "model.layers.30.mlp.down_proj.biases": "model.safetensors",
492
+ "model.layers.30.mlp.down_proj.scales": "model.safetensors",
493
+ "model.layers.30.mlp.down_proj.weight": "model.safetensors",
494
+ "model.layers.30.mlp.gate_proj.biases": "model.safetensors",
495
+ "model.layers.30.mlp.gate_proj.scales": "model.safetensors",
496
+ "model.layers.30.mlp.gate_proj.weight": "model.safetensors",
497
+ "model.layers.30.mlp.up_proj.biases": "model.safetensors",
498
+ "model.layers.30.mlp.up_proj.scales": "model.safetensors",
499
+ "model.layers.30.mlp.up_proj.weight": "model.safetensors",
500
+ "model.layers.30.post_attention_layernorm.weight": "model.safetensors",
501
+ "model.layers.30.self_attn.g_proj.biases": "model.safetensors",
502
+ "model.layers.30.self_attn.g_proj.scales": "model.safetensors",
503
+ "model.layers.30.self_attn.g_proj.weight": "model.safetensors",
504
+ "model.layers.30.self_attn.out_proj.biases": "model.safetensors",
505
+ "model.layers.30.self_attn.out_proj.scales": "model.safetensors",
506
+ "model.layers.30.self_attn.out_proj.weight": "model.safetensors",
507
+ "model.layers.30.self_attn.q_k_v_proj.biases": "model.safetensors",
508
+ "model.layers.30.self_attn.q_k_v_proj.scales": "model.safetensors",
509
+ "model.layers.30.self_attn.q_k_v_proj.weight": "model.safetensors",
510
+ "model.layers.31.input_layernorm.weight": "model.safetensors",
511
+ "model.layers.31.mlp.down_proj.biases": "model.safetensors",
512
+ "model.layers.31.mlp.down_proj.scales": "model.safetensors",
513
+ "model.layers.31.mlp.down_proj.weight": "model.safetensors",
514
+ "model.layers.31.mlp.gate_proj.biases": "model.safetensors",
515
+ "model.layers.31.mlp.gate_proj.scales": "model.safetensors",
516
+ "model.layers.31.mlp.gate_proj.weight": "model.safetensors",
517
+ "model.layers.31.mlp.up_proj.biases": "model.safetensors",
518
+ "model.layers.31.mlp.up_proj.scales": "model.safetensors",
519
+ "model.layers.31.mlp.up_proj.weight": "model.safetensors",
520
+ "model.layers.31.post_attention_layernorm.weight": "model.safetensors",
521
+ "model.layers.31.self_attn.g_proj.biases": "model.safetensors",
522
+ "model.layers.31.self_attn.g_proj.scales": "model.safetensors",
523
+ "model.layers.31.self_attn.g_proj.weight": "model.safetensors",
524
+ "model.layers.31.self_attn.out_proj.biases": "model.safetensors",
525
+ "model.layers.31.self_attn.out_proj.scales": "model.safetensors",
526
+ "model.layers.31.self_attn.out_proj.weight": "model.safetensors",
527
+ "model.layers.31.self_attn.q_k_v_proj.biases": "model.safetensors",
528
+ "model.layers.31.self_attn.q_k_v_proj.scales": "model.safetensors",
529
+ "model.layers.31.self_attn.q_k_v_proj.weight": "model.safetensors",
530
+ "model.layers.32.input_layernorm.weight": "model.safetensors",
531
+ "model.layers.32.mlp.down_proj.biases": "model.safetensors",
532
+ "model.layers.32.mlp.down_proj.scales": "model.safetensors",
533
+ "model.layers.32.mlp.down_proj.weight": "model.safetensors",
534
+ "model.layers.32.mlp.gate_proj.biases": "model.safetensors",
535
+ "model.layers.32.mlp.gate_proj.scales": "model.safetensors",
536
+ "model.layers.32.mlp.gate_proj.weight": "model.safetensors",
537
+ "model.layers.32.mlp.up_proj.biases": "model.safetensors",
538
+ "model.layers.32.mlp.up_proj.scales": "model.safetensors",
539
+ "model.layers.32.mlp.up_proj.weight": "model.safetensors",
540
+ "model.layers.32.post_attention_layernorm.weight": "model.safetensors",
541
+ "model.layers.32.self_attn.g_proj.biases": "model.safetensors",
542
+ "model.layers.32.self_attn.g_proj.scales": "model.safetensors",
543
+ "model.layers.32.self_attn.g_proj.weight": "model.safetensors",
544
+ "model.layers.32.self_attn.out_proj.biases": "model.safetensors",
545
+ "model.layers.32.self_attn.out_proj.scales": "model.safetensors",
546
+ "model.layers.32.self_attn.out_proj.weight": "model.safetensors",
547
+ "model.layers.32.self_attn.q_k_v_proj.biases": "model.safetensors",
548
+ "model.layers.32.self_attn.q_k_v_proj.scales": "model.safetensors",
549
+ "model.layers.32.self_attn.q_k_v_proj.weight": "model.safetensors",
550
+ "model.layers.33.input_layernorm.weight": "model.safetensors",
551
+ "model.layers.33.mlp.down_proj.biases": "model.safetensors",
552
+ "model.layers.33.mlp.down_proj.scales": "model.safetensors",
553
+ "model.layers.33.mlp.down_proj.weight": "model.safetensors",
554
+ "model.layers.33.mlp.gate_proj.biases": "model.safetensors",
555
+ "model.layers.33.mlp.gate_proj.scales": "model.safetensors",
556
+ "model.layers.33.mlp.gate_proj.weight": "model.safetensors",
557
+ "model.layers.33.mlp.up_proj.biases": "model.safetensors",
558
+ "model.layers.33.mlp.up_proj.scales": "model.safetensors",
559
+ "model.layers.33.mlp.up_proj.weight": "model.safetensors",
560
+ "model.layers.33.post_attention_layernorm.weight": "model.safetensors",
561
+ "model.layers.33.self_attn.g_proj.biases": "model.safetensors",
562
+ "model.layers.33.self_attn.g_proj.scales": "model.safetensors",
563
+ "model.layers.33.self_attn.g_proj.weight": "model.safetensors",
564
+ "model.layers.33.self_attn.out_proj.biases": "model.safetensors",
565
+ "model.layers.33.self_attn.out_proj.scales": "model.safetensors",
566
+ "model.layers.33.self_attn.out_proj.weight": "model.safetensors",
567
+ "model.layers.33.self_attn.q_k_v_proj.biases": "model.safetensors",
568
+ "model.layers.33.self_attn.q_k_v_proj.scales": "model.safetensors",
569
+ "model.layers.33.self_attn.q_k_v_proj.weight": "model.safetensors",
570
+ "model.layers.34.input_layernorm.weight": "model.safetensors",
571
+ "model.layers.34.mlp.down_proj.biases": "model.safetensors",
572
+ "model.layers.34.mlp.down_proj.scales": "model.safetensors",
573
+ "model.layers.34.mlp.down_proj.weight": "model.safetensors",
574
+ "model.layers.34.mlp.gate_proj.biases": "model.safetensors",
575
+ "model.layers.34.mlp.gate_proj.scales": "model.safetensors",
576
+ "model.layers.34.mlp.gate_proj.weight": "model.safetensors",
577
+ "model.layers.34.mlp.up_proj.biases": "model.safetensors",
578
+ "model.layers.34.mlp.up_proj.scales": "model.safetensors",
579
+ "model.layers.34.mlp.up_proj.weight": "model.safetensors",
580
+ "model.layers.34.post_attention_layernorm.weight": "model.safetensors",
581
+ "model.layers.34.self_attn.g_proj.biases": "model.safetensors",
582
+ "model.layers.34.self_attn.g_proj.scales": "model.safetensors",
583
+ "model.layers.34.self_attn.g_proj.weight": "model.safetensors",
584
+ "model.layers.34.self_attn.out_proj.biases": "model.safetensors",
585
+ "model.layers.34.self_attn.out_proj.scales": "model.safetensors",
586
+ "model.layers.34.self_attn.out_proj.weight": "model.safetensors",
587
+ "model.layers.34.self_attn.q_k_v_proj.biases": "model.safetensors",
588
+ "model.layers.34.self_attn.q_k_v_proj.scales": "model.safetensors",
589
+ "model.layers.34.self_attn.q_k_v_proj.weight": "model.safetensors",
590
+ "model.layers.35.input_layernorm.weight": "model.safetensors",
591
+ "model.layers.35.mlp.down_proj.biases": "model.safetensors",
592
+ "model.layers.35.mlp.down_proj.scales": "model.safetensors",
593
+ "model.layers.35.mlp.down_proj.weight": "model.safetensors",
594
+ "model.layers.35.mlp.gate_proj.biases": "model.safetensors",
595
+ "model.layers.35.mlp.gate_proj.scales": "model.safetensors",
596
+ "model.layers.35.mlp.gate_proj.weight": "model.safetensors",
597
+ "model.layers.35.mlp.up_proj.biases": "model.safetensors",
598
+ "model.layers.35.mlp.up_proj.scales": "model.safetensors",
599
+ "model.layers.35.mlp.up_proj.weight": "model.safetensors",
600
+ "model.layers.35.post_attention_layernorm.weight": "model.safetensors",
601
+ "model.layers.35.self_attn.g_proj.biases": "model.safetensors",
602
+ "model.layers.35.self_attn.g_proj.scales": "model.safetensors",
603
+ "model.layers.35.self_attn.g_proj.weight": "model.safetensors",
604
+ "model.layers.35.self_attn.out_proj.biases": "model.safetensors",
605
+ "model.layers.35.self_attn.out_proj.scales": "model.safetensors",
606
+ "model.layers.35.self_attn.out_proj.weight": "model.safetensors",
607
+ "model.layers.35.self_attn.q_k_v_proj.biases": "model.safetensors",
608
+ "model.layers.35.self_attn.q_k_v_proj.scales": "model.safetensors",
609
+ "model.layers.35.self_attn.q_k_v_proj.weight": "model.safetensors",
610
+ "model.layers.4.input_layernorm.weight": "model.safetensors",
611
+ "model.layers.4.mlp.down_proj.biases": "model.safetensors",
612
+ "model.layers.4.mlp.down_proj.scales": "model.safetensors",
613
+ "model.layers.4.mlp.down_proj.weight": "model.safetensors",
614
+ "model.layers.4.mlp.gate_proj.biases": "model.safetensors",
615
+ "model.layers.4.mlp.gate_proj.scales": "model.safetensors",
616
+ "model.layers.4.mlp.gate_proj.weight": "model.safetensors",
617
+ "model.layers.4.mlp.up_proj.biases": "model.safetensors",
618
+ "model.layers.4.mlp.up_proj.scales": "model.safetensors",
619
+ "model.layers.4.mlp.up_proj.weight": "model.safetensors",
620
+ "model.layers.4.post_attention_layernorm.weight": "model.safetensors",
621
+ "model.layers.4.self_attn.g_proj.biases": "model.safetensors",
622
+ "model.layers.4.self_attn.g_proj.scales": "model.safetensors",
623
+ "model.layers.4.self_attn.g_proj.weight": "model.safetensors",
624
+ "model.layers.4.self_attn.out_proj.biases": "model.safetensors",
625
+ "model.layers.4.self_attn.out_proj.scales": "model.safetensors",
626
+ "model.layers.4.self_attn.out_proj.weight": "model.safetensors",
627
+ "model.layers.4.self_attn.q_k_v_proj.biases": "model.safetensors",
628
+ "model.layers.4.self_attn.q_k_v_proj.scales": "model.safetensors",
629
+ "model.layers.4.self_attn.q_k_v_proj.weight": "model.safetensors",
630
+ "model.layers.5.input_layernorm.weight": "model.safetensors",
631
+ "model.layers.5.mlp.down_proj.biases": "model.safetensors",
632
+ "model.layers.5.mlp.down_proj.scales": "model.safetensors",
633
+ "model.layers.5.mlp.down_proj.weight": "model.safetensors",
634
+ "model.layers.5.mlp.gate_proj.biases": "model.safetensors",
635
+ "model.layers.5.mlp.gate_proj.scales": "model.safetensors",
636
+ "model.layers.5.mlp.gate_proj.weight": "model.safetensors",
637
+ "model.layers.5.mlp.up_proj.biases": "model.safetensors",
638
+ "model.layers.5.mlp.up_proj.scales": "model.safetensors",
639
+ "model.layers.5.mlp.up_proj.weight": "model.safetensors",
640
+ "model.layers.5.post_attention_layernorm.weight": "model.safetensors",
641
+ "model.layers.5.self_attn.g_proj.biases": "model.safetensors",
642
+ "model.layers.5.self_attn.g_proj.scales": "model.safetensors",
643
+ "model.layers.5.self_attn.g_proj.weight": "model.safetensors",
644
+ "model.layers.5.self_attn.out_proj.biases": "model.safetensors",
645
+ "model.layers.5.self_attn.out_proj.scales": "model.safetensors",
646
+ "model.layers.5.self_attn.out_proj.weight": "model.safetensors",
647
+ "model.layers.5.self_attn.q_k_v_proj.biases": "model.safetensors",
648
+ "model.layers.5.self_attn.q_k_v_proj.scales": "model.safetensors",
649
+ "model.layers.5.self_attn.q_k_v_proj.weight": "model.safetensors",
650
+ "model.layers.6.input_layernorm.weight": "model.safetensors",
651
+ "model.layers.6.mlp.down_proj.biases": "model.safetensors",
652
+ "model.layers.6.mlp.down_proj.scales": "model.safetensors",
653
+ "model.layers.6.mlp.down_proj.weight": "model.safetensors",
654
+ "model.layers.6.mlp.gate_proj.biases": "model.safetensors",
655
+ "model.layers.6.mlp.gate_proj.scales": "model.safetensors",
656
+ "model.layers.6.mlp.gate_proj.weight": "model.safetensors",
657
+ "model.layers.6.mlp.up_proj.biases": "model.safetensors",
658
+ "model.layers.6.mlp.up_proj.scales": "model.safetensors",
659
+ "model.layers.6.mlp.up_proj.weight": "model.safetensors",
660
+ "model.layers.6.post_attention_layernorm.weight": "model.safetensors",
661
+ "model.layers.6.self_attn.g_proj.biases": "model.safetensors",
662
+ "model.layers.6.self_attn.g_proj.scales": "model.safetensors",
663
+ "model.layers.6.self_attn.g_proj.weight": "model.safetensors",
664
+ "model.layers.6.self_attn.out_proj.biases": "model.safetensors",
665
+ "model.layers.6.self_attn.out_proj.scales": "model.safetensors",
666
+ "model.layers.6.self_attn.out_proj.weight": "model.safetensors",
667
+ "model.layers.6.self_attn.q_k_v_proj.biases": "model.safetensors",
668
+ "model.layers.6.self_attn.q_k_v_proj.scales": "model.safetensors",
669
+ "model.layers.6.self_attn.q_k_v_proj.weight": "model.safetensors",
670
+ "model.layers.7.input_layernorm.weight": "model.safetensors",
671
+ "model.layers.7.mlp.down_proj.biases": "model.safetensors",
672
+ "model.layers.7.mlp.down_proj.scales": "model.safetensors",
673
+ "model.layers.7.mlp.down_proj.weight": "model.safetensors",
674
+ "model.layers.7.mlp.gate_proj.biases": "model.safetensors",
675
+ "model.layers.7.mlp.gate_proj.scales": "model.safetensors",
676
+ "model.layers.7.mlp.gate_proj.weight": "model.safetensors",
677
+ "model.layers.7.mlp.up_proj.biases": "model.safetensors",
678
+ "model.layers.7.mlp.up_proj.scales": "model.safetensors",
679
+ "model.layers.7.mlp.up_proj.weight": "model.safetensors",
680
+ "model.layers.7.post_attention_layernorm.weight": "model.safetensors",
681
+ "model.layers.7.self_attn.g_proj.biases": "model.safetensors",
682
+ "model.layers.7.self_attn.g_proj.scales": "model.safetensors",
683
+ "model.layers.7.self_attn.g_proj.weight": "model.safetensors",
684
+ "model.layers.7.self_attn.out_proj.biases": "model.safetensors",
685
+ "model.layers.7.self_attn.out_proj.scales": "model.safetensors",
686
+ "model.layers.7.self_attn.out_proj.weight": "model.safetensors",
687
+ "model.layers.7.self_attn.q_k_v_proj.biases": "model.safetensors",
688
+ "model.layers.7.self_attn.q_k_v_proj.scales": "model.safetensors",
689
+ "model.layers.7.self_attn.q_k_v_proj.weight": "model.safetensors",
690
+ "model.layers.8.input_layernorm.weight": "model.safetensors",
691
+ "model.layers.8.mlp.down_proj.biases": "model.safetensors",
692
+ "model.layers.8.mlp.down_proj.scales": "model.safetensors",
693
+ "model.layers.8.mlp.down_proj.weight": "model.safetensors",
694
+ "model.layers.8.mlp.gate_proj.biases": "model.safetensors",
695
+ "model.layers.8.mlp.gate_proj.scales": "model.safetensors",
696
+ "model.layers.8.mlp.gate_proj.weight": "model.safetensors",
697
+ "model.layers.8.mlp.up_proj.biases": "model.safetensors",
698
+ "model.layers.8.mlp.up_proj.scales": "model.safetensors",
699
+ "model.layers.8.mlp.up_proj.weight": "model.safetensors",
700
+ "model.layers.8.post_attention_layernorm.weight": "model.safetensors",
701
+ "model.layers.8.self_attn.g_proj.biases": "model.safetensors",
702
+ "model.layers.8.self_attn.g_proj.scales": "model.safetensors",
703
+ "model.layers.8.self_attn.g_proj.weight": "model.safetensors",
704
+ "model.layers.8.self_attn.out_proj.biases": "model.safetensors",
705
+ "model.layers.8.self_attn.out_proj.scales": "model.safetensors",
706
+ "model.layers.8.self_attn.out_proj.weight": "model.safetensors",
707
+ "model.layers.8.self_attn.q_k_v_proj.biases": "model.safetensors",
708
+ "model.layers.8.self_attn.q_k_v_proj.scales": "model.safetensors",
709
+ "model.layers.8.self_attn.q_k_v_proj.weight": "model.safetensors",
710
+ "model.layers.9.input_layernorm.weight": "model.safetensors",
711
+ "model.layers.9.mlp.down_proj.biases": "model.safetensors",
712
+ "model.layers.9.mlp.down_proj.scales": "model.safetensors",
713
+ "model.layers.9.mlp.down_proj.weight": "model.safetensors",
714
+ "model.layers.9.mlp.gate_proj.biases": "model.safetensors",
715
+ "model.layers.9.mlp.gate_proj.scales": "model.safetensors",
716
+ "model.layers.9.mlp.gate_proj.weight": "model.safetensors",
717
+ "model.layers.9.mlp.up_proj.biases": "model.safetensors",
718
+ "model.layers.9.mlp.up_proj.scales": "model.safetensors",
719
+ "model.layers.9.mlp.up_proj.weight": "model.safetensors",
720
+ "model.layers.9.post_attention_layernorm.weight": "model.safetensors",
721
+ "model.layers.9.self_attn.g_proj.biases": "model.safetensors",
722
+ "model.layers.9.self_attn.g_proj.scales": "model.safetensors",
723
+ "model.layers.9.self_attn.g_proj.weight": "model.safetensors",
724
+ "model.layers.9.self_attn.out_proj.biases": "model.safetensors",
725
+ "model.layers.9.self_attn.out_proj.scales": "model.safetensors",
726
+ "model.layers.9.self_attn.out_proj.weight": "model.safetensors",
727
+ "model.layers.9.self_attn.q_k_v_proj.biases": "model.safetensors",
728
+ "model.layers.9.self_attn.q_k_v_proj.scales": "model.safetensors",
729
+ "model.layers.9.self_attn.q_k_v_proj.weight": "model.safetensors",
730
+ "model.norm.weight": "model.safetensors"
731
+ }
732
+ }
modeling_spark.py ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+
3
+ import torch
4
+ import torch.nn.functional as F
5
+ from torch import nn
6
+ from transformers.activations import ACT2FN
7
+ from transformers.cache_utils import Cache, DynamicCache
8
+ from transformers.generation import GenerationMixin
9
+ from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
10
+ from transformers.modeling_outputs import (
11
+ BaseModelOutputWithPast,
12
+ CausalLMOutputWithPast,
13
+ )
14
+ from transformers.modeling_utils import PreTrainedModel
15
+ from transformers.processing_utils import Unpack
16
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
17
+ from transformers.utils import TransformersKwargs, can_return_tuple, logging
18
+
19
+ from .configuration_spark import Spark2_5Config
20
+
21
+ logger = logging.get_logger(__name__)
22
+
23
+ _CONFIG_FOR_DOC = "Spark2_5Config"
24
+
25
+ def rotate_half(x):
26
+ x1 = x[..., : x.shape[-1] // 2]
27
+ x2 = x[..., x.shape[-1] // 2 :]
28
+ return torch.cat((-x2, x1), dim=-1)
29
+
30
+
31
+ def compute_rope_cos_sin(positions, head_dim, rope_theta, partial_rotary_factor=1.0, device="cpu"):
32
+ rope_head_dim = int(head_dim * partial_rotary_factor)
33
+ inv_freq = 1.0 / (rope_theta ** (torch.arange(0, rope_head_dim, 2, dtype=torch.int64).to(device="cpu", dtype=torch.float) / rope_head_dim))
34
+ inv_freq = inv_freq.to(device)
35
+ t = positions.to(device=device, dtype=torch.float32)
36
+ freqs = torch.outer(t, inv_freq)
37
+ freqs = torch.cat([freqs, freqs], dim=-1)
38
+ cos = freqs.cos()
39
+ sin = freqs.sin()
40
+ return cos, sin
41
+
42
+
43
+ def apply_rotary_pos_emb(x, cos, sin):
44
+ rope_head_dim = cos.shape[-1]
45
+ x_f32 = x.float()
46
+ if x_f32.shape[-1] > rope_head_dim:
47
+ x_rot = x_f32[..., :rope_head_dim]
48
+ x_pass = x_f32[..., rope_head_dim:]
49
+ c = cos.unsqueeze(0).unsqueeze(0)
50
+ s = sin.unsqueeze(0).unsqueeze(0)
51
+ x_rot = x_rot * c + rotate_half(x_rot) * s
52
+ result = torch.cat([x_rot, x_pass], dim=-1)
53
+ else:
54
+ c = cos.unsqueeze(0).unsqueeze(0)
55
+ s = sin.unsqueeze(0).unsqueeze(0)
56
+ result = x_f32 * c + rotate_half(x_f32) * s
57
+ return result.to(x.dtype)
58
+
59
+
60
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
61
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
62
+ if n_rep == 1:
63
+ return hidden_states
64
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
65
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
66
+
67
+
68
+ def eager_attention_forward(
69
+ module: nn.Module,
70
+ query: torch.Tensor,
71
+ key: torch.Tensor,
72
+ value: torch.Tensor,
73
+ attention_mask: torch.Tensor | None = None,
74
+ scaling: float | None = None,
75
+ dropout: float = 0.0,
76
+ **kwargs: Unpack[TransformersKwargs],
77
+ ):
78
+ key = repeat_kv(key, module.num_key_value_groups)
79
+ value = repeat_kv(value, module.num_key_value_groups)
80
+
81
+ if scaling is None:
82
+ scaling = 1.0 / math.sqrt(query.shape[-1])
83
+
84
+ attn_weights = torch.matmul(query, key.transpose(2, 3)) * scaling
85
+ if attention_mask is not None:
86
+ causal_mask = attention_mask[:, :, :, : key.shape[-2]]
87
+ attn_weights = attn_weights + causal_mask
88
+
89
+ attn_weights = attn_weights - attn_weights.max(dim=-1, keepdim=True).values
90
+ attn_weights = F.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
91
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
92
+ attn_output = torch.matmul(attn_weights, value)
93
+ return attn_output, attn_weights
94
+
95
+
96
+ class Spark2_5RMSNorm(nn.Module):
97
+ def __init__(self, hidden_size, eps=1e-6):
98
+ super().__init__()
99
+ self.weight = nn.Parameter(torch.ones(hidden_size))
100
+ self.variance_epsilon = eps
101
+
102
+ def forward(self, hidden_states):
103
+ input_dtype = hidden_states.dtype
104
+ hidden_states = hidden_states.to(torch.float32)
105
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
106
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
107
+ return (self.weight.float() * hidden_states).to(input_dtype)
108
+
109
+ def extra_repr(self):
110
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
111
+
112
+
113
+ ALL_LAYERNORM_LAYERS.append(Spark2_5RMSNorm)
114
+
115
+
116
+ class Spark2_5MLP(nn.Module):
117
+ def __init__(self, config):
118
+ super().__init__()
119
+ self.config = config
120
+ self.hidden_size = config.hidden_size
121
+ self.intermediate_size = config.intermediate_size
122
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
123
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
124
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=config.mlp_bias)
125
+
126
+ if config.hidden_act != "gelu":
127
+ raise ValueError(f"只支持hidden_act='gelu',当前传入:{config.hidden_act}")
128
+
129
+ self.act_fn = ACT2FN[config.hidden_act]
130
+
131
+ def forward(self, x):
132
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
133
+
134
+
135
+ class Spark2_5Attention(nn.Module):
136
+ def __init__(self, config: Spark2_5Config, layer_idx: int | None = None):
137
+ super().__init__()
138
+ self.config = config
139
+ self.layer_idx = layer_idx
140
+ self.attention_dropout = config.attention_dropout
141
+ self.hidden_size = config.hidden_size
142
+ self.num_heads = config.num_attention_heads
143
+ self.head_dim = config.head_dim
144
+ self.num_key_value_heads = config.num_key_value_heads
145
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
146
+ self.scaling = 1.0 / math.sqrt(self.head_dim)
147
+ self.headwise_attn_output_gate = config.headwise_attn_output_gate
148
+ self.gate_attn_act_mode = config.gate_attn_act_mode
149
+ self.q_dim = self.num_heads * self.head_dim
150
+ self.kv_dim = self.num_key_value_heads * self.head_dim
151
+
152
+ qkv_out_dim = self.q_dim + 2 * self.kv_dim
153
+ self.q_k_v_proj = nn.Linear(self.hidden_size, qkv_out_dim, bias=config.attention_bias)
154
+ self.g_proj = nn.Linear(self.hidden_size, self.num_heads, bias=config.attention_bias) if self.headwise_attn_output_gate else None
155
+ self.out_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
156
+ self.sliding_window = None
157
+
158
+ def forward(
159
+ self,
160
+ hidden_states: torch.Tensor,
161
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
162
+ attention_mask: torch.Tensor | None = None,
163
+ past_key_values: Cache | None = None,
164
+ cache_position: torch.LongTensor | None = None,
165
+ **kwargs: Unpack[TransformersKwargs],
166
+ ) -> tuple[torch.Tensor, torch.Tensor]:
167
+ input_shape = hidden_states.shape[:-1]
168
+ bsz, seq_len = input_shape
169
+
170
+ qkv = self.q_k_v_proj(hidden_states)
171
+ q = qkv[..., :self.q_dim]
172
+ k = qkv[..., self.q_dim:self.q_dim + self.kv_dim]
173
+ v = qkv[..., self.q_dim + self.kv_dim:]
174
+ gate_score = self.g_proj(hidden_states) if self.g_proj is not None else None
175
+
176
+ q = q.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2)
177
+ k = k.view(bsz, seq_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
178
+ v = v.view(bsz, seq_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
179
+ if gate_score is not None:
180
+ gate_score = gate_score.view(bsz, seq_len, self.num_heads, 1).transpose(1, 2)
181
+
182
+ cos, sin = position_embeddings
183
+ q = apply_rotary_pos_emb(q, cos, sin)
184
+ k = apply_rotary_pos_emb(k, cos, sin)
185
+
186
+
187
+ if past_key_values is not None:
188
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
189
+ k, v = past_key_values.update(k, v, self.layer_idx, cache_kwargs)
190
+
191
+ attn_output, attn_weights = eager_attention_forward(
192
+ self, q, k, v,
193
+ attention_mask=attention_mask,
194
+ scaling=self.scaling,
195
+ dropout=self.attention_dropout if self.training else 0.0,
196
+ )
197
+
198
+ if gate_score is not None:
199
+ if self.gate_attn_act_mode == "sigmoid":
200
+ gate = torch.sigmoid(gate_score.float())
201
+ elif self.gate_attn_act_mode == "silu":
202
+ gate = F.silu(gate_score.float())
203
+ else:
204
+ raise ValueError(f"Unsupported gate_attn_act_mode: {self.gate_attn_act_mode}")
205
+ gate = gate.to(attn_output.dtype)
206
+ attn_output = attn_output * gate
207
+
208
+ attn_output = attn_output.transpose(1, 2).contiguous().view(bsz, seq_len, -1)
209
+ attn_output = self.out_proj(attn_output)
210
+
211
+ return attn_output, attn_weights
212
+
213
+
214
+ class Spark2_5DecoderLayer(nn.Module):
215
+ def __init__(self, config: Spark2_5Config, layer_idx: int):
216
+ super().__init__()
217
+ self.hidden_size = config.hidden_size
218
+
219
+ self.self_attn = Spark2_5Attention(config=config, layer_idx=layer_idx)
220
+ self.mlp = Spark2_5MLP(config)
221
+ self.input_layernorm = Spark2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
222
+ self.post_attention_layernorm = Spark2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
223
+
224
+ self.layer_type = config.layer_types[layer_idx] if layer_idx < len(config.layer_types) else "full_attention"
225
+ if self.layer_type == "sliding_attention" and config.sliding_window is not None:
226
+ self.self_attn.sliding_window = config.sliding_window
227
+ else:
228
+ self.self_attn.sliding_window = None
229
+ self.self_attn.partial_rotary_factor = config.get_partial_rotary_factor(self.layer_type)
230
+
231
+ def forward(
232
+ self,
233
+ hidden_states: torch.Tensor,
234
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
235
+ attention_mask: torch.Tensor | None = None,
236
+ past_key_values: Cache | None = None,
237
+ cache_position: torch.LongTensor | None = None,
238
+ position_ids: torch.LongTensor | None = None,
239
+ **kwargs: Unpack[TransformersKwargs]
240
+ ) -> torch.Tensor:
241
+
242
+ residual = hidden_states
243
+ hidden_states = self.input_layernorm(hidden_states)
244
+ hidden_states = hidden_states.to(self.mlp.gate_proj.weight.dtype)
245
+
246
+ hidden_states, _ = self.self_attn(
247
+ hidden_states=hidden_states,
248
+ position_embeddings=position_embeddings,
249
+ attention_mask=attention_mask,
250
+ past_key_values=past_key_values,
251
+ cache_position=cache_position,
252
+ position_ids=position_ids,
253
+ )
254
+ hidden_states = residual + hidden_states
255
+
256
+ residual = hidden_states
257
+ hidden_states = self.post_attention_layernorm(hidden_states)
258
+ hidden_states = hidden_states.to(self.mlp.gate_proj.weight.dtype)
259
+
260
+
261
+ hidden_states = self.mlp(hidden_states)
262
+ hidden_states = residual + hidden_states
263
+
264
+ return hidden_states
265
+
266
+
267
+ class Spark2_5PreTrainedModel(PreTrainedModel):
268
+ config_class = Spark2_5Config
269
+ base_model_prefix = "model"
270
+ supports_gradient_checkpointing = True
271
+ _no_split_modules = ["Spark2_5DecoderLayer"] # noqa: RUF012
272
+ _skip_keys_device_placement = ["past_key_values"] # noqa: RUF012
273
+
274
+ def _init_weights(self, module):
275
+ std = self.config.initializer_range
276
+ if isinstance(module, nn.Linear):
277
+ module.weight.data.normal_(mean=0.0, std=std)
278
+ if module.bias is not None:
279
+ module.bias.data.zero_()
280
+ elif isinstance(module, nn.Embedding):
281
+ module.weight.data.normal_(mean=0.0, std=std)
282
+ if module.padding_idx is not None:
283
+ module.weight.data[module.padding_idx].zero_()
284
+
285
+
286
+ class Spark2_5Model(Spark2_5PreTrainedModel):
287
+ def __init__(self, config: Spark2_5Config):
288
+ super().__init__(config)
289
+ self.padding_idx = config.pad_token_id
290
+ self.vocab_size = config.vocab_size
291
+
292
+ self.embedding = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
293
+ self.layers = nn.ModuleList(
294
+ [Spark2_5DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
295
+ )
296
+ self.norm = Spark2_5RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
297
+ self.gradient_checkpointing = False
298
+ self.has_sliding_layers = "sliding_attention" in config.layer_types
299
+
300
+ self.post_init()
301
+
302
+ def get_input_embeddings(self):
303
+ return self.embedding
304
+
305
+ def set_input_embeddings(self, value):
306
+ self.embedding = value
307
+ def forward(
308
+ self,
309
+ input_ids: torch.LongTensor = None,
310
+ attention_mask: torch.Tensor | None = None,
311
+ position_ids: torch.LongTensor | None = None,
312
+ past_key_values: Cache | list[torch.FloatTensor] | None = None,
313
+ inputs_embeds: torch.FloatTensor | None = None,
314
+ use_cache: bool | None = None,
315
+ cache_position: torch.LongTensor | None = None,
316
+ token_type_ids: torch.LongTensor | None = None,
317
+ **kwargs: Unpack[TransformersKwargs],
318
+ ) -> BaseModelOutputWithPast:
319
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
320
+ if (input_ids is None) ^ (inputs_embeds is not None):
321
+ raise ValueError(
322
+ "You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
323
+ )
324
+
325
+ if self.gradient_checkpointing and self.training and use_cache:
326
+ logger.warning_once(
327
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
328
+ )
329
+ use_cache = False
330
+
331
+ if inputs_embeds is None:
332
+ inputs_embeds = self.embedding(input_ids)
333
+
334
+ if use_cache and past_key_values is None:
335
+ past_key_values = DynamicCache(config=self.config)
336
+
337
+ if cache_position is None:
338
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
339
+ cache_position = torch.arange(
340
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
341
+ )
342
+
343
+ if position_ids is None:
344
+ position_ids = cache_position.unsqueeze(0)
345
+
346
+ if not isinstance(attention_mask, dict):
347
+ mask_kwargs = {
348
+ "config": self.config,
349
+ "input_embeds": inputs_embeds,
350
+ "attention_mask": attention_mask,
351
+ "cache_position": cache_position,
352
+ "past_key_values": past_key_values,
353
+ "position_ids": position_ids,
354
+ }
355
+ causal_mask_mapping = {
356
+ "full_attention": create_causal_mask(**mask_kwargs),
357
+ }
358
+ if self.has_sliding_layers:
359
+ causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
360
+ else:
361
+ causal_mask_mapping = attention_mask
362
+
363
+ hidden_states = inputs_embeds.float()
364
+
365
+ device = hidden_states.device
366
+ dtype = self.embedding.weight.dtype
367
+
368
+ head_dim = self.config.head_dim
369
+ rope_cache = {}
370
+ for lt in set(self.config.layer_types):
371
+ rope_theta = self.config.get_rope_theta(lt)
372
+ prf = self.config.get_partial_rotary_factor(lt)
373
+ cos, sin = compute_rope_cos_sin(cache_position, head_dim, rope_theta, partial_rotary_factor=prf, device=device)
374
+ rope_cache[lt] = (cos, sin)
375
+
376
+ for decoder_layer in self.layers:
377
+ layer_type = decoder_layer.layer_type
378
+ position_embeddings = rope_cache.get(layer_type, rope_cache.get("full_attention"))
379
+ layer_attention_mask = causal_mask_mapping.get(layer_type, causal_mask_mapping.get("full_attention"))
380
+
381
+ if self.gradient_checkpointing and self.training:
382
+ layer_outputs = self._gradient_checkpointing_func(
383
+ decoder_layer.__call__,
384
+ hidden_states,
385
+ position_embeddings,
386
+ layer_attention_mask,
387
+ )
388
+ hidden_states = layer_outputs[0] if isinstance(layer_outputs, tuple) else layer_outputs
389
+ else:
390
+ hidden_states = decoder_layer(
391
+ hidden_states,
392
+ position_embeddings=position_embeddings,
393
+ attention_mask=layer_attention_mask,
394
+ past_key_values=past_key_values,
395
+ cache_position=cache_position,
396
+ position_ids=position_ids,
397
+ )
398
+
399
+ hidden_states = self.norm(hidden_states)
400
+ hidden_states = hidden_states.to(dtype)
401
+
402
+ return BaseModelOutputWithPast(
403
+ last_hidden_state=hidden_states,
404
+ past_key_values=past_key_values if use_cache else None,
405
+ )
406
+
407
+ class Spark2_5ForCausalLM(Spark2_5PreTrainedModel, GenerationMixin):
408
+ _tied_weights_keys = ["lm_head.weight"] # noqa: RUF012
409
+
410
+ def __init__(self, config):
411
+ super().__init__(config)
412
+ self.model = Spark2_5Model(config)
413
+ self.vocab_size = config.vocab_size
414
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
415
+ self.post_init()
416
+
417
+ def get_input_embeddings(self):
418
+ return self.model.embedding
419
+
420
+ def set_input_embeddings(self, value):
421
+ self.model.embedding = value
422
+
423
+ def get_output_embeddings(self):
424
+ return self.lm_head
425
+
426
+ def set_output_embeddings(self, new_embeddings):
427
+ self.lm_head = new_embeddings
428
+
429
+ def set_decoder(self, decoder):
430
+ self.model = decoder
431
+
432
+ def get_decoder(self):
433
+ return self.model
434
+
435
+ @can_return_tuple
436
+ def forward(
437
+ self,
438
+ input_ids: torch.LongTensor = None,
439
+ attention_mask: torch.Tensor | None = None,
440
+ position_ids: torch.LongTensor | None = None,
441
+ past_key_values: Cache | list[torch.FloatTensor] | None = None,
442
+ inputs_embeds: torch.FloatTensor | None = None,
443
+ labels: torch.LongTensor | None = None,
444
+ use_cache: bool | None = None,
445
+ cache_position: torch.LongTensor | None = None,
446
+ logits_to_keep: int = 0,
447
+ token_type_ids: torch.LongTensor | None = None,
448
+ **kwargs: Unpack[TransformersKwargs],
449
+ ) -> CausalLMOutputWithPast:
450
+ outputs: BaseModelOutputWithPast = self.model(
451
+ input_ids=input_ids,
452
+ attention_mask=attention_mask,
453
+ position_ids=position_ids,
454
+ past_key_values=past_key_values,
455
+ inputs_embeds=inputs_embeds,
456
+ use_cache=use_cache,
457
+ cache_position=cache_position,
458
+ )
459
+
460
+ hidden_states = outputs.last_hidden_state
461
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
462
+ hidden_states = hidden_states[:, slice_indices, :]
463
+
464
+ if self.config.tie_word_embeddings:
465
+ embed_weight = self.model.embedding.weight
466
+ logits = F.linear(hidden_states, embed_weight)
467
+ else:
468
+ logits = self.lm_head(hidden_states)
469
+
470
+ loss = None
471
+ if labels is not None:
472
+ loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
473
+
474
+ return CausalLMOutputWithPast(
475
+ loss=loss,
476
+ logits=logits,
477
+ past_key_values=outputs.past_key_values,
478
+ hidden_states=outputs.hidden_states,
479
+ attentions=outputs.attentions,
480
+ )
481
+
482
+
483
+ __all__ = ["Spark2_5Config", "Spark2_5ForCausalLM", "Spark2_5Model"]
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|start▁of▁sentence|>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<|end▁of▁sentence|>",
6
+ "is_local": true,
7
+ "legacy": true,
8
+ "local_files_only": false,
9
+ "model_max_length": 131072,
10
+ "pad_token": "<|▁pad▁|>",
11
+ "sp_model_kwargs": {},
12
+ "tokenizer_class": "TokenizersBackend",
13
+ "unk_token": "<unk>"
14
+ }