Upload folder using huggingface_hub
Browse files- config.json +42 -0
- configuration_qwen3_shared_moe.py +230 -0
- generation_config.json +4 -0
- merges.txt +0 -0
- model-00001-of-00013.safetensors +3 -0
- model-00002-of-00013.safetensors +3 -0
- model-00003-of-00013.safetensors +3 -0
- model-00004-of-00013.safetensors +3 -0
- model-00005-of-00013.safetensors +3 -0
- model-00006-of-00013.safetensors +3 -0
- model-00007-of-00013.safetensors +3 -0
- model-00008-of-00013.safetensors +3 -0
- model-00009-of-00013.safetensors +3 -0
- model-00010-of-00013.safetensors +3 -0
- model-00011-of-00013.safetensors +3 -0
- model-00012-of-00013.safetensors +3 -0
- model-00013-of-00013.safetensors +3 -0
- model.safetensors.index.json +539 -0
- modeling_qwen3_shared_moe.py +253 -0
- tokenizer.json +0 -0
- tokenizer_config.json +239 -0
- vocab.json +0 -0
config.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"Qwen3SharedMoeForCausalLM"
|
4 |
+
],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "configuration_qwen3_shared_moe.Qwen3SharedMoeConfig",
|
7 |
+
"AutoModel": "modeling_qwen3_shared_moe.Qwen3SharedMoeModel",
|
8 |
+
"AutoModelForCausalLM": "modeling_qwen3_shared_moe.Qwen3SharedMoeForCausalLM"
|
9 |
+
},
|
10 |
+
"attention_bias": false,
|
11 |
+
"attention_dropout": 0.0,
|
12 |
+
"decoder_sparse_step": 1,
|
13 |
+
"head_dim": 128,
|
14 |
+
"hidden_act": "silu",
|
15 |
+
"hidden_size": 2048,
|
16 |
+
"initializer_range": 0.02,
|
17 |
+
"intermediate_size": 5472,
|
18 |
+
"max_position_embeddings": 262144,
|
19 |
+
"max_window_layers": 28,
|
20 |
+
"mlp_only_layers": [],
|
21 |
+
"model_type": "qwen3_shared_moe",
|
22 |
+
"moe_intermediate_size": 768,
|
23 |
+
"norm_topk_prob": true,
|
24 |
+
"num_attention_heads": 32,
|
25 |
+
"num_experts": 128,
|
26 |
+
"num_experts_per_tok": 8,
|
27 |
+
"num_hidden_layers": 48,
|
28 |
+
"num_key_value_heads": 4,
|
29 |
+
"output_router_logits": false,
|
30 |
+
"rms_norm_eps": 1e-06,
|
31 |
+
"rope_scaling": null,
|
32 |
+
"rope_theta": 10000000,
|
33 |
+
"router_aux_loss_coef": 0.0,
|
34 |
+
"shared_expert_intermediate_size": null,
|
35 |
+
"sliding_window": null,
|
36 |
+
"tie_word_embeddings": false,
|
37 |
+
"torch_dtype": "bfloat16",
|
38 |
+
"transformers_version": "4.54.1",
|
39 |
+
"use_cache": true,
|
40 |
+
"use_sliding_window": false,
|
41 |
+
"vocab_size": 151936
|
42 |
+
}
|
configuration_qwen3_shared_moe.py
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2024 The Qwen team, Alibaba Group 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 |
+
"""Qwen3SharedMoE model configuration"""
|
16 |
+
|
17 |
+
from transformers.configuration_utils import PretrainedConfig
|
18 |
+
from transformers.modeling_rope_utils import rope_config_validation
|
19 |
+
from transformers.utils import logging
|
20 |
+
|
21 |
+
|
22 |
+
logger = logging.get_logger(__name__)
|
23 |
+
|
24 |
+
|
25 |
+
class Qwen3SharedMoeConfig(PretrainedConfig):
|
26 |
+
r"""
|
27 |
+
This is the configuration class to store the configuration of a [`Qwen3SharedMoeModel`]. It is used to instantiate a
|
28 |
+
Qwen3SharedMoE model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
29 |
+
with the defaults will yield a similar configuration to that of [Qwen/Qwen3-MoE-15B-A2B](https://huggingface.co/Qwen/Qwen3-15B-A2B).
|
30 |
+
|
31 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
32 |
+
documentation from [`PretrainedConfig`] for more information.
|
33 |
+
|
34 |
+
|
35 |
+
Args:
|
36 |
+
vocab_size (`int`, *optional*, defaults to 151936):
|
37 |
+
Vocabulary size of the Qwen3SharedMoE model. Defines the number of different tokens that can be represented by the
|
38 |
+
`inputs_ids` passed when calling [`Qwen3SharedMoeModel`]
|
39 |
+
hidden_size (`int`, *optional*, defaults to 2048):
|
40 |
+
Dimension of the hidden representations.
|
41 |
+
intermediate_size (`int`, *optional*, defaults to 6144):
|
42 |
+
Dimension of the MLP representations.
|
43 |
+
num_hidden_layers (`int`, *optional*, defaults to 24):
|
44 |
+
Number of hidden layers in the Transformer encoder.
|
45 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
46 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
47 |
+
num_key_value_heads (`int`, *optional*, defaults to 4):
|
48 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
49 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
50 |
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
51 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
52 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
53 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
|
54 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
55 |
+
The non-linear activation function (function or string) in the decoder.
|
56 |
+
max_position_embeddings (`int`, *optional*, defaults to 32768):
|
57 |
+
The maximum sequence length that this model might ever be used with.
|
58 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
59 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
60 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
61 |
+
The epsilon used by the rms normalization layers.
|
62 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
63 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
64 |
+
relevant if `config.is_decoder=True`.
|
65 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
66 |
+
Whether the model's input and output word embeddings should be tied.
|
67 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
68 |
+
The base period of the RoPE embeddings.
|
69 |
+
rope_scaling (`Dict`, *optional*):
|
70 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
71 |
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
72 |
+
accordingly.
|
73 |
+
Expected contents:
|
74 |
+
`rope_type` (`str`):
|
75 |
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
76 |
+
'llama3'], with 'default' being the original RoPE implementation.
|
77 |
+
`factor` (`float`, *optional*):
|
78 |
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
79 |
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
80 |
+
original maximum pre-trained length.
|
81 |
+
`original_max_position_embeddings` (`int`, *optional*):
|
82 |
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
83 |
+
pretraining.
|
84 |
+
`attention_factor` (`float`, *optional*):
|
85 |
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
86 |
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
87 |
+
`factor` field to infer the suggested value.
|
88 |
+
`beta_fast` (`float`, *optional*):
|
89 |
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
90 |
+
ramp function. If unspecified, it defaults to 32.
|
91 |
+
`beta_slow` (`float`, *optional*):
|
92 |
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
93 |
+
ramp function. If unspecified, it defaults to 1.
|
94 |
+
`short_factor` (`List[float]`, *optional*):
|
95 |
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
96 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
97 |
+
size divided by the number of attention heads divided by 2
|
98 |
+
`long_factor` (`List[float]`, *optional*):
|
99 |
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
100 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
101 |
+
size divided by the number of attention heads divided by 2
|
102 |
+
`low_freq_factor` (`float`, *optional*):
|
103 |
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
104 |
+
`high_freq_factor` (`float`, *optional*):
|
105 |
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
106 |
+
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
|
107 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
108 |
+
use_sliding_window (`bool`, *optional*, defaults to `False`):
|
109 |
+
Whether to use sliding window attention.
|
110 |
+
sliding_window (`int`, *optional*, defaults to 4096):
|
111 |
+
Sliding window attention (SWA) window size. If not specified, will default to `4096`.
|
112 |
+
max_window_layers (`int`, *optional*, defaults to 28):
|
113 |
+
The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.
|
114 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
115 |
+
The dropout ratio for the attention probabilities.
|
116 |
+
decoder_sparse_step (`int`, *optional*, defaults to 1):
|
117 |
+
The frequency of the MoE layer.
|
118 |
+
moe_intermediate_size (`int`, *optional*, defaults to 768):
|
119 |
+
Intermediate size of the routed expert.
|
120 |
+
shared_expert_intermediate_size (`int`, *optional*, defaults to None):
|
121 |
+
Intermediate size of the shared expert. `None` means no shared expert.
|
122 |
+
num_experts_per_tok (`int`, *optional*, defaults to 8):
|
123 |
+
Number of selected experts.
|
124 |
+
num_experts (`int`, *optional*, defaults to 128):
|
125 |
+
Number of routed experts.
|
126 |
+
norm_topk_prob (`bool`, *optional*, defaults to `False`):
|
127 |
+
Whether to normalize the topk probabilities.
|
128 |
+
output_router_logits (`bool`, *optional*, defaults to `False`):
|
129 |
+
Whether or not the router logits should be returned by the model. Enabling this will also
|
130 |
+
allow the model to output the auxiliary loss, including load balancing loss and router z-loss.
|
131 |
+
router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
|
132 |
+
The aux loss factor for the total loss.
|
133 |
+
mlp_only_layers (`List[int]`, *optional*, defaults to `[]`):
|
134 |
+
Indicate which layers use Qwen3SharedMoeMLP rather than Qwen3SharedMoeSparseMoeBlock
|
135 |
+
The list contains layer index, from 0 to num_layers-1 if we have num_layers layers
|
136 |
+
If `mlp_only_layers` is empty, `decoder_sparse_step` is used to determine the sparsity.
|
137 |
+
"""
|
138 |
+
|
139 |
+
model_type = "qwen3_shared_moe"
|
140 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
141 |
+
|
142 |
+
# Default tensor parallel plan for base model `Qwen3SharedMoe`
|
143 |
+
base_model_tp_plan = {
|
144 |
+
"layers.*.self_attn.q_proj": "colwise",
|
145 |
+
"layers.*.self_attn.k_proj": "colwise",
|
146 |
+
"layers.*.self_attn.v_proj": "colwise",
|
147 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
148 |
+
"layers.*.mlp.gate_proj": "colwise",
|
149 |
+
"layers.*.mlp.up_proj": "colwise",
|
150 |
+
"layers.*.mlp.down_proj": "rowwise",
|
151 |
+
}
|
152 |
+
base_model_pp_plan = {
|
153 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
154 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
155 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
156 |
+
}
|
157 |
+
|
158 |
+
def __init__(
|
159 |
+
self,
|
160 |
+
vocab_size=151936,
|
161 |
+
hidden_size=2048,
|
162 |
+
intermediate_size=6144,
|
163 |
+
num_hidden_layers=24,
|
164 |
+
num_attention_heads=32,
|
165 |
+
num_key_value_heads=4,
|
166 |
+
hidden_act="silu",
|
167 |
+
max_position_embeddings=32768,
|
168 |
+
initializer_range=0.02,
|
169 |
+
rms_norm_eps=1e-6,
|
170 |
+
use_cache=True,
|
171 |
+
tie_word_embeddings=False,
|
172 |
+
rope_theta=10000.0,
|
173 |
+
rope_scaling=None,
|
174 |
+
attention_bias=False,
|
175 |
+
use_sliding_window=False,
|
176 |
+
sliding_window=4096,
|
177 |
+
max_window_layers=28,
|
178 |
+
attention_dropout=0.0,
|
179 |
+
decoder_sparse_step=1,
|
180 |
+
moe_intermediate_size=768,
|
181 |
+
shared_expert_intermediate_size=None,
|
182 |
+
num_experts_per_tok=8,
|
183 |
+
num_experts=128,
|
184 |
+
norm_topk_prob=False,
|
185 |
+
output_router_logits=False,
|
186 |
+
router_aux_loss_coef=0.001,
|
187 |
+
mlp_only_layers=None,
|
188 |
+
**kwargs,
|
189 |
+
):
|
190 |
+
self.vocab_size = vocab_size
|
191 |
+
self.max_position_embeddings = max_position_embeddings
|
192 |
+
self.hidden_size = hidden_size
|
193 |
+
self.intermediate_size = intermediate_size
|
194 |
+
self.num_hidden_layers = num_hidden_layers
|
195 |
+
self.num_attention_heads = num_attention_heads
|
196 |
+
self.use_sliding_window = use_sliding_window
|
197 |
+
self.sliding_window = sliding_window if use_sliding_window else None
|
198 |
+
self.max_window_layers = max_window_layers
|
199 |
+
|
200 |
+
self.num_key_value_heads = num_key_value_heads
|
201 |
+
self.hidden_act = hidden_act
|
202 |
+
self.initializer_range = initializer_range
|
203 |
+
self.rms_norm_eps = rms_norm_eps
|
204 |
+
self.use_cache = use_cache
|
205 |
+
self.rope_theta = rope_theta
|
206 |
+
self.rope_scaling = rope_scaling
|
207 |
+
self.attention_bias = attention_bias
|
208 |
+
self.attention_dropout = attention_dropout
|
209 |
+
# Validate the correctness of rotary position embeddings parameters
|
210 |
+
# BC: if there is a 'type' field, move it to 'rope_type'.
|
211 |
+
if self.rope_scaling is not None and "type" in self.rope_scaling:
|
212 |
+
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
213 |
+
rope_config_validation(self)
|
214 |
+
|
215 |
+
# MoE arguments
|
216 |
+
self.decoder_sparse_step = decoder_sparse_step
|
217 |
+
self.moe_intermediate_size = moe_intermediate_size
|
218 |
+
self.shared_expert_intermediate_size = shared_expert_intermediate_size
|
219 |
+
self.num_experts_per_tok = num_experts_per_tok
|
220 |
+
self.num_experts = num_experts
|
221 |
+
self.norm_topk_prob = norm_topk_prob
|
222 |
+
self.output_router_logits = output_router_logits
|
223 |
+
self.router_aux_loss_coef = router_aux_loss_coef
|
224 |
+
self.mlp_only_layers = [] if mlp_only_layers is None else mlp_only_layers
|
225 |
+
|
226 |
+
super().__init__(
|
227 |
+
tie_word_embeddings=tie_word_embeddings,
|
228 |
+
**kwargs,
|
229 |
+
)
|
230 |
+
|
generation_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"transformers_version": "4.54.1"
|
4 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model-00001-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e4bc51223729e7e94e46819a7ad47bc605e0004ceb2afdc1f1cc158b6f7412a
|
3 |
+
size 4399332008
|
model-00002-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0abfac116abb48dafc3989c05a006613aa159288391987c5afc7ed552d1c0358
|
3 |
+
size 4984970264
|
model-00003-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9e0839d2e34a7f9fc2f81460d838a4c9273a5be6b9fff0551feee6c802f273a
|
3 |
+
size 4984970272
|
model-00004-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0fa85af58064c6226847717dad61f64ec7ba325710140a9f916f5843e40451d8
|
3 |
+
size 4984970312
|
model-00005-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3f6e9fe1e4366945748ea4129b243b97d702dfa7cf560a9383bd283d1f6a4c9
|
3 |
+
size 4984970312
|
model-00006-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5dccf2dbcb28d881f9b80904c8948430f54bc6d47d6825e7312eb1ae6027bdf5
|
3 |
+
size 4984970312
|
model-00007-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:edcb72301e7d2dbd6a8512fdf364e17f527fa91707feb72a83726772cdf1316c
|
3 |
+
size 4984970312
|
model-00008-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0334caf6b8e9124e85801fd6a41961e4aa892342f0b2bbba065e1e167b0c2567
|
3 |
+
size 4984970312
|
model-00009-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9429fb9ea9d57f1a5ec32dfa49e0434b8cba6bb7855f7c20a681503e559d78a2
|
3 |
+
size 4984970312
|
model-00010-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:755719f4dd11111c0037dc923043af8338ee3d8b2c045dd6fae87ae0c0dc7658
|
3 |
+
size 4984970312
|
model-00011-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c417dd8b3e5168b62fccfd70dc1be6d7f6c8743104d58805b24e02ad544af90
|
3 |
+
size 4984970312
|
model-00012-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:60496189195377cd81eb74843c0f184ad6f0ebd0a6cc34a02f7fdfcabdbc1a29
|
3 |
+
size 4984970312
|
model-00013-of-00013.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7ea4a7adc5c961c45d3273bd52e71c8bed2a54d70ff18596e066bfd77c46cb92
|
3 |
+
size 1830302400
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_parameters": 30532122624,
|
4 |
+
"total_size": 61064245248
|
5 |
+
},
|
6 |
+
"weight_map": {
|
7 |
+
"lm_head.weight": "model-00013-of-00013.safetensors",
|
8 |
+
"model.embed_tokens.weight": "model-00001-of-00013.safetensors",
|
9 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
10 |
+
"model.layers.0.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
11 |
+
"model.layers.0.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
12 |
+
"model.layers.0.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
13 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
14 |
+
"model.layers.0.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
15 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
16 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
17 |
+
"model.layers.0.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
18 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
19 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
20 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
21 |
+
"model.layers.1.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
22 |
+
"model.layers.1.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
23 |
+
"model.layers.1.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
24 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
25 |
+
"model.layers.1.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
26 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
27 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
28 |
+
"model.layers.1.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
29 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
30 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
31 |
+
"model.layers.10.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
32 |
+
"model.layers.10.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
33 |
+
"model.layers.10.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
34 |
+
"model.layers.10.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
35 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
36 |
+
"model.layers.10.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
37 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
38 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
39 |
+
"model.layers.10.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
40 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
41 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
42 |
+
"model.layers.11.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
43 |
+
"model.layers.11.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
44 |
+
"model.layers.11.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
45 |
+
"model.layers.11.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
46 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
47 |
+
"model.layers.11.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
48 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
49 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
50 |
+
"model.layers.11.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
51 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
52 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
53 |
+
"model.layers.12.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
54 |
+
"model.layers.12.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
55 |
+
"model.layers.12.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
56 |
+
"model.layers.12.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
57 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
58 |
+
"model.layers.12.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
59 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
60 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
61 |
+
"model.layers.12.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
62 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
63 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
64 |
+
"model.layers.13.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
65 |
+
"model.layers.13.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
66 |
+
"model.layers.13.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
67 |
+
"model.layers.13.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
68 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
69 |
+
"model.layers.13.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
70 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
71 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
72 |
+
"model.layers.13.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
73 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
74 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
75 |
+
"model.layers.14.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
76 |
+
"model.layers.14.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
77 |
+
"model.layers.14.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
78 |
+
"model.layers.14.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
79 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
80 |
+
"model.layers.14.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
81 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
82 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
83 |
+
"model.layers.14.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
84 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
85 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
86 |
+
"model.layers.15.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
87 |
+
"model.layers.15.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
88 |
+
"model.layers.15.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
89 |
+
"model.layers.15.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
90 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
91 |
+
"model.layers.15.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
92 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
93 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
94 |
+
"model.layers.15.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
95 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
96 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
97 |
+
"model.layers.16.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
98 |
+
"model.layers.16.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
99 |
+
"model.layers.16.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
100 |
+
"model.layers.16.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
101 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
102 |
+
"model.layers.16.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
103 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
104 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
105 |
+
"model.layers.16.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
106 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
107 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
108 |
+
"model.layers.17.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
109 |
+
"model.layers.17.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
110 |
+
"model.layers.17.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
111 |
+
"model.layers.17.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
112 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
113 |
+
"model.layers.17.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
114 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
115 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
116 |
+
"model.layers.17.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
117 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
118 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
119 |
+
"model.layers.18.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
120 |
+
"model.layers.18.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
121 |
+
"model.layers.18.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
122 |
+
"model.layers.18.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
123 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
124 |
+
"model.layers.18.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
125 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
126 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
127 |
+
"model.layers.18.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
128 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
129 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
130 |
+
"model.layers.19.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
131 |
+
"model.layers.19.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
132 |
+
"model.layers.19.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
133 |
+
"model.layers.19.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
134 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
135 |
+
"model.layers.19.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
136 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
137 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
138 |
+
"model.layers.19.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
139 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
140 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
141 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
142 |
+
"model.layers.2.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
143 |
+
"model.layers.2.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
144 |
+
"model.layers.2.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
145 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
146 |
+
"model.layers.2.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
147 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
148 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
149 |
+
"model.layers.2.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
150 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
151 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
152 |
+
"model.layers.20.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
153 |
+
"model.layers.20.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
154 |
+
"model.layers.20.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
155 |
+
"model.layers.20.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
156 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
157 |
+
"model.layers.20.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
158 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
159 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
160 |
+
"model.layers.20.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
161 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
162 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
163 |
+
"model.layers.21.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
164 |
+
"model.layers.21.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
165 |
+
"model.layers.21.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
166 |
+
"model.layers.21.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
167 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
168 |
+
"model.layers.21.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
169 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
170 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
171 |
+
"model.layers.21.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
172 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
173 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
174 |
+
"model.layers.22.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
175 |
+
"model.layers.22.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
176 |
+
"model.layers.22.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
177 |
+
"model.layers.22.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
178 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
179 |
+
"model.layers.22.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
180 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
181 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
182 |
+
"model.layers.22.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
183 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
184 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
185 |
+
"model.layers.23.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
186 |
+
"model.layers.23.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
187 |
+
"model.layers.23.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
188 |
+
"model.layers.23.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
189 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
190 |
+
"model.layers.23.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
191 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
192 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
193 |
+
"model.layers.23.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
194 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
195 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
196 |
+
"model.layers.24.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
197 |
+
"model.layers.24.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
198 |
+
"model.layers.24.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
199 |
+
"model.layers.24.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
200 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
201 |
+
"model.layers.24.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
202 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
203 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
204 |
+
"model.layers.24.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
205 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
206 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
207 |
+
"model.layers.25.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
208 |
+
"model.layers.25.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
209 |
+
"model.layers.25.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
210 |
+
"model.layers.25.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
211 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
212 |
+
"model.layers.25.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
213 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
214 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
215 |
+
"model.layers.25.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
216 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
217 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
218 |
+
"model.layers.26.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
219 |
+
"model.layers.26.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
220 |
+
"model.layers.26.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
221 |
+
"model.layers.26.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
222 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
223 |
+
"model.layers.26.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
224 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
225 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
226 |
+
"model.layers.26.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
227 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
228 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
229 |
+
"model.layers.27.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
230 |
+
"model.layers.27.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
231 |
+
"model.layers.27.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
232 |
+
"model.layers.27.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
233 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
234 |
+
"model.layers.27.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
235 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
236 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
237 |
+
"model.layers.27.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
238 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
239 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
240 |
+
"model.layers.28.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
241 |
+
"model.layers.28.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
242 |
+
"model.layers.28.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
243 |
+
"model.layers.28.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
244 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
245 |
+
"model.layers.28.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
246 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
247 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
248 |
+
"model.layers.28.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
249 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
250 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
251 |
+
"model.layers.29.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
252 |
+
"model.layers.29.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
253 |
+
"model.layers.29.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
254 |
+
"model.layers.29.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
255 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
256 |
+
"model.layers.29.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
257 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
258 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
259 |
+
"model.layers.29.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
260 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
261 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
262 |
+
"model.layers.3.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
263 |
+
"model.layers.3.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
264 |
+
"model.layers.3.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
265 |
+
"model.layers.3.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
266 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
267 |
+
"model.layers.3.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
268 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
269 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
270 |
+
"model.layers.3.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
271 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
272 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
273 |
+
"model.layers.30.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
274 |
+
"model.layers.30.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
275 |
+
"model.layers.30.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
276 |
+
"model.layers.30.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
277 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
278 |
+
"model.layers.30.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
279 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
280 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
281 |
+
"model.layers.30.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
282 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
283 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
284 |
+
"model.layers.31.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
285 |
+
"model.layers.31.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
286 |
+
"model.layers.31.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
287 |
+
"model.layers.31.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
288 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
289 |
+
"model.layers.31.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
290 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
291 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
292 |
+
"model.layers.31.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
293 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
294 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
295 |
+
"model.layers.32.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
296 |
+
"model.layers.32.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
297 |
+
"model.layers.32.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
298 |
+
"model.layers.32.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
299 |
+
"model.layers.32.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
300 |
+
"model.layers.32.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
301 |
+
"model.layers.32.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
302 |
+
"model.layers.32.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
303 |
+
"model.layers.32.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
304 |
+
"model.layers.32.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
305 |
+
"model.layers.32.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
306 |
+
"model.layers.33.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
307 |
+
"model.layers.33.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
308 |
+
"model.layers.33.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
309 |
+
"model.layers.33.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
310 |
+
"model.layers.33.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
311 |
+
"model.layers.33.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
312 |
+
"model.layers.33.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
313 |
+
"model.layers.33.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
314 |
+
"model.layers.33.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
315 |
+
"model.layers.33.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
316 |
+
"model.layers.33.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
317 |
+
"model.layers.34.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
318 |
+
"model.layers.34.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
319 |
+
"model.layers.34.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
320 |
+
"model.layers.34.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
321 |
+
"model.layers.34.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
322 |
+
"model.layers.34.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
323 |
+
"model.layers.34.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
324 |
+
"model.layers.34.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
325 |
+
"model.layers.34.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
326 |
+
"model.layers.34.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
327 |
+
"model.layers.34.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
328 |
+
"model.layers.35.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
329 |
+
"model.layers.35.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
330 |
+
"model.layers.35.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
331 |
+
"model.layers.35.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
332 |
+
"model.layers.35.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
333 |
+
"model.layers.35.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
334 |
+
"model.layers.35.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
335 |
+
"model.layers.35.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
336 |
+
"model.layers.35.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
337 |
+
"model.layers.35.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
338 |
+
"model.layers.35.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
339 |
+
"model.layers.36.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
340 |
+
"model.layers.36.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
341 |
+
"model.layers.36.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
342 |
+
"model.layers.36.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
343 |
+
"model.layers.36.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
344 |
+
"model.layers.36.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
345 |
+
"model.layers.36.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
346 |
+
"model.layers.36.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
347 |
+
"model.layers.36.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
348 |
+
"model.layers.36.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
349 |
+
"model.layers.36.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
350 |
+
"model.layers.37.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
351 |
+
"model.layers.37.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
352 |
+
"model.layers.37.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
353 |
+
"model.layers.37.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
354 |
+
"model.layers.37.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
355 |
+
"model.layers.37.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
356 |
+
"model.layers.37.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
357 |
+
"model.layers.37.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
358 |
+
"model.layers.37.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
359 |
+
"model.layers.37.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
360 |
+
"model.layers.37.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
361 |
+
"model.layers.38.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
362 |
+
"model.layers.38.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
363 |
+
"model.layers.38.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
364 |
+
"model.layers.38.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
365 |
+
"model.layers.38.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
366 |
+
"model.layers.38.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
367 |
+
"model.layers.38.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
368 |
+
"model.layers.38.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
369 |
+
"model.layers.38.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
370 |
+
"model.layers.38.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
371 |
+
"model.layers.38.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
372 |
+
"model.layers.39.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
373 |
+
"model.layers.39.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
374 |
+
"model.layers.39.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
375 |
+
"model.layers.39.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
376 |
+
"model.layers.39.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
377 |
+
"model.layers.39.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
378 |
+
"model.layers.39.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
379 |
+
"model.layers.39.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
380 |
+
"model.layers.39.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
381 |
+
"model.layers.39.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
382 |
+
"model.layers.39.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
383 |
+
"model.layers.4.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
384 |
+
"model.layers.4.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
385 |
+
"model.layers.4.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
386 |
+
"model.layers.4.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
387 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
388 |
+
"model.layers.4.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
389 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
390 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
391 |
+
"model.layers.4.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
392 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
393 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
394 |
+
"model.layers.40.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
395 |
+
"model.layers.40.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
396 |
+
"model.layers.40.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
397 |
+
"model.layers.40.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
398 |
+
"model.layers.40.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
399 |
+
"model.layers.40.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
400 |
+
"model.layers.40.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
401 |
+
"model.layers.40.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
402 |
+
"model.layers.40.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
403 |
+
"model.layers.40.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
404 |
+
"model.layers.40.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
405 |
+
"model.layers.41.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
406 |
+
"model.layers.41.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
407 |
+
"model.layers.41.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
408 |
+
"model.layers.41.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
409 |
+
"model.layers.41.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
410 |
+
"model.layers.41.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
411 |
+
"model.layers.41.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
412 |
+
"model.layers.41.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
413 |
+
"model.layers.41.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
414 |
+
"model.layers.41.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
415 |
+
"model.layers.41.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
416 |
+
"model.layers.42.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
417 |
+
"model.layers.42.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
418 |
+
"model.layers.42.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
419 |
+
"model.layers.42.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
420 |
+
"model.layers.42.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
421 |
+
"model.layers.42.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
422 |
+
"model.layers.42.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
423 |
+
"model.layers.42.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
424 |
+
"model.layers.42.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
425 |
+
"model.layers.42.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
426 |
+
"model.layers.42.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
427 |
+
"model.layers.43.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
428 |
+
"model.layers.43.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
429 |
+
"model.layers.43.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
430 |
+
"model.layers.43.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
431 |
+
"model.layers.43.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
432 |
+
"model.layers.43.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
433 |
+
"model.layers.43.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
434 |
+
"model.layers.43.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
435 |
+
"model.layers.43.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
436 |
+
"model.layers.43.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
437 |
+
"model.layers.43.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
438 |
+
"model.layers.44.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
439 |
+
"model.layers.44.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
440 |
+
"model.layers.44.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
441 |
+
"model.layers.44.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
442 |
+
"model.layers.44.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
443 |
+
"model.layers.44.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
444 |
+
"model.layers.44.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
445 |
+
"model.layers.44.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
446 |
+
"model.layers.44.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
447 |
+
"model.layers.44.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
448 |
+
"model.layers.44.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
449 |
+
"model.layers.45.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
450 |
+
"model.layers.45.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
451 |
+
"model.layers.45.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
452 |
+
"model.layers.45.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
453 |
+
"model.layers.45.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
454 |
+
"model.layers.45.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
455 |
+
"model.layers.45.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
456 |
+
"model.layers.45.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
457 |
+
"model.layers.45.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
458 |
+
"model.layers.45.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
459 |
+
"model.layers.45.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
460 |
+
"model.layers.46.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
461 |
+
"model.layers.46.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
462 |
+
"model.layers.46.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
463 |
+
"model.layers.46.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
464 |
+
"model.layers.46.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
465 |
+
"model.layers.46.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
466 |
+
"model.layers.46.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
467 |
+
"model.layers.46.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
468 |
+
"model.layers.46.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
469 |
+
"model.layers.46.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
470 |
+
"model.layers.46.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
471 |
+
"model.layers.47.input_layernorm.weight": "model-00013-of-00013.safetensors",
|
472 |
+
"model.layers.47.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
473 |
+
"model.layers.47.mlp.moe_mlp.experts.weight": "model-00013-of-00013.safetensors",
|
474 |
+
"model.layers.47.mlp.moe_mlp.output_experts.weight": "model-00013-of-00013.safetensors",
|
475 |
+
"model.layers.47.post_attention_layernorm.weight": "model-00013-of-00013.safetensors",
|
476 |
+
"model.layers.47.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
477 |
+
"model.layers.47.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
478 |
+
"model.layers.47.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
479 |
+
"model.layers.47.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
480 |
+
"model.layers.47.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
481 |
+
"model.layers.47.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
482 |
+
"model.layers.5.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
483 |
+
"model.layers.5.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
484 |
+
"model.layers.5.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
485 |
+
"model.layers.5.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
486 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
487 |
+
"model.layers.5.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
488 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
489 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
490 |
+
"model.layers.5.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
491 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
492 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
493 |
+
"model.layers.6.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
494 |
+
"model.layers.6.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
495 |
+
"model.layers.6.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
496 |
+
"model.layers.6.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
497 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
498 |
+
"model.layers.6.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
499 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
500 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
501 |
+
"model.layers.6.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
502 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
503 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
504 |
+
"model.layers.7.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
505 |
+
"model.layers.7.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
506 |
+
"model.layers.7.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
507 |
+
"model.layers.7.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
508 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
509 |
+
"model.layers.7.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
510 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
511 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
512 |
+
"model.layers.7.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
513 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
514 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
515 |
+
"model.layers.8.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
516 |
+
"model.layers.8.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
517 |
+
"model.layers.8.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
518 |
+
"model.layers.8.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
519 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
520 |
+
"model.layers.8.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
521 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
522 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
523 |
+
"model.layers.8.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
524 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
525 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
526 |
+
"model.layers.9.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
527 |
+
"model.layers.9.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
528 |
+
"model.layers.9.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
529 |
+
"model.layers.9.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
530 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
531 |
+
"model.layers.9.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
532 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
533 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
534 |
+
"model.layers.9.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
535 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
536 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
537 |
+
"model.norm.weight": "model-00013-of-00013.safetensors"
|
538 |
+
}
|
539 |
+
}
|
modeling_qwen3_shared_moe.py
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2025 Charles O. Goddard, The Qwen team, Alibaba Group 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 |
+
"""PyTorch Qwen3 model with shared expert support."""
|
16 |
+
|
17 |
+
from typing import List, Optional, Union
|
18 |
+
|
19 |
+
import torch
|
20 |
+
from torch import nn
|
21 |
+
import torch.nn.functional as F
|
22 |
+
|
23 |
+
from transformers.modeling_outputs import (
|
24 |
+
MoeCausalLMOutputWithPast,
|
25 |
+
MoeModelOutputWithPast,
|
26 |
+
)
|
27 |
+
from transformers.activations import ACT2FN
|
28 |
+
from transformers.utils import logging
|
29 |
+
from transformers.models.mixtral.modeling_mixtral import (
|
30 |
+
load_balancing_loss_func,
|
31 |
+
)
|
32 |
+
from transformers.models.qwen3_moe.modeling_qwen3_moe import (
|
33 |
+
Qwen3MoeMLP,
|
34 |
+
Qwen3MoeRMSNorm,
|
35 |
+
Qwen3MoeAttention,
|
36 |
+
Qwen3MoeDecoderLayer,
|
37 |
+
Qwen3MoeModel,
|
38 |
+
Qwen3MoeForCausalLM,
|
39 |
+
)
|
40 |
+
from .configuration_qwen3_shared_moe import Qwen3SharedMoeConfig
|
41 |
+
|
42 |
+
import scattermoe
|
43 |
+
|
44 |
+
|
45 |
+
logger = logging.get_logger(__name__)
|
46 |
+
|
47 |
+
|
48 |
+
class Qwen3SharedMoeSparseMoeBlock(nn.Module):
|
49 |
+
def __init__(self, config: Qwen3SharedMoeConfig):
|
50 |
+
super().__init__()
|
51 |
+
self.config = config
|
52 |
+
self.gate = nn.Linear(config.hidden_size, config.num_experts, bias=False)
|
53 |
+
if config.shared_expert_intermediate_size is not None:
|
54 |
+
self.shared_expert = Qwen3MoeMLP(
|
55 |
+
config, intermediate_size=config.shared_expert_intermediate_size
|
56 |
+
)
|
57 |
+
else:
|
58 |
+
self.shared_expert = None
|
59 |
+
self.moe_mlp = scattermoe.mlp.GLUMLP(
|
60 |
+
input_size=self.config.hidden_size,
|
61 |
+
hidden_size=self.config.moe_intermediate_size,
|
62 |
+
num_experts=self.config.num_experts,
|
63 |
+
top_k=self.config.num_experts_per_tok,
|
64 |
+
activation=ACT2FN[config.hidden_act],
|
65 |
+
)
|
66 |
+
|
67 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
68 |
+
# handling of gate/router logits copied from Qwen3MoeSparseMoeBlock
|
69 |
+
batch_size, sequence_length, hidden_dim = hidden_states.shape
|
70 |
+
hidden_states = hidden_states.view(-1, hidden_dim)
|
71 |
+
# router_logits: (batch * sequence_length, n_experts)
|
72 |
+
router_logits = self.gate(hidden_states)
|
73 |
+
|
74 |
+
routing_weights = F.softmax(router_logits, dim=1, dtype=torch.float)
|
75 |
+
routing_weights, selected_experts = torch.topk(
|
76 |
+
routing_weights, self.config.num_experts_per_tok, dim=-1
|
77 |
+
)
|
78 |
+
if self.config.norm_topk_prob: # only diff with mixtral sparse moe block!
|
79 |
+
routing_weights /= routing_weights.sum(dim=-1, keepdim=True)
|
80 |
+
# we cast back to the input dtype
|
81 |
+
routing_weights = routing_weights.to(hidden_states.dtype)
|
82 |
+
|
83 |
+
# modified here to use scattermoe + shared_expert
|
84 |
+
hs_0 = self.moe_mlp(hidden_states, routing_weights, selected_experts)
|
85 |
+
|
86 |
+
if self.shared_expert is not None:
|
87 |
+
shared_res = self.shared_expert(hidden_states)
|
88 |
+
res = hs_0 + shared_res
|
89 |
+
else:
|
90 |
+
res = hs_0
|
91 |
+
res = res.reshape(batch_size, sequence_length, hidden_dim)
|
92 |
+
return res, router_logits
|
93 |
+
|
94 |
+
|
95 |
+
class Qwen3SharedMoeDecoderLayer(Qwen3MoeDecoderLayer, nn.Module):
|
96 |
+
def __init__(self, config: Qwen3SharedMoeConfig, layer_idx: int):
|
97 |
+
super().__init__(config, layer_idx)
|
98 |
+
self.hidden_size = config.hidden_size
|
99 |
+
|
100 |
+
self.self_attn = Qwen3MoeAttention(config, layer_idx)
|
101 |
+
|
102 |
+
if (layer_idx not in config.mlp_only_layers) and (
|
103 |
+
config.num_experts > 0 and (layer_idx + 1) % config.decoder_sparse_step == 0
|
104 |
+
):
|
105 |
+
self.mlp = Qwen3SharedMoeSparseMoeBlock(config)
|
106 |
+
else:
|
107 |
+
self.mlp = Qwen3MoeMLP(config, intermediate_size=config.intermediate_size)
|
108 |
+
|
109 |
+
self.input_layernorm = Qwen3MoeRMSNorm(
|
110 |
+
config.hidden_size, eps=config.rms_norm_eps
|
111 |
+
)
|
112 |
+
self.post_attention_layernorm = Qwen3MoeRMSNorm(
|
113 |
+
config.hidden_size, eps=config.rms_norm_eps
|
114 |
+
)
|
115 |
+
|
116 |
+
|
117 |
+
class Qwen3SharedMoeModel(Qwen3MoeModel):
|
118 |
+
config_class = Qwen3SharedMoeConfig
|
119 |
+
|
120 |
+
def __init__(self, config: Qwen3SharedMoeConfig):
|
121 |
+
super().__init__(config)
|
122 |
+
self.layers = nn.ModuleList(
|
123 |
+
[
|
124 |
+
Qwen3SharedMoeDecoderLayer(config, layer_idx)
|
125 |
+
for layer_idx in range(config.num_hidden_layers)
|
126 |
+
]
|
127 |
+
)
|
128 |
+
|
129 |
+
|
130 |
+
class Qwen3SharedMoeForCausalLM(Qwen3MoeForCausalLM):
|
131 |
+
config_class = Qwen3SharedMoeConfig
|
132 |
+
|
133 |
+
def __init__(self, config):
|
134 |
+
super().__init__(config)
|
135 |
+
self.model = Qwen3SharedMoeModel(config)
|
136 |
+
self.num_experts = config.num_experts
|
137 |
+
|
138 |
+
def forward(
|
139 |
+
self,
|
140 |
+
input_ids: Optional[torch.LongTensor] = None,
|
141 |
+
attention_mask: Optional[torch.Tensor] = None,
|
142 |
+
position_ids: Optional[torch.LongTensor] = None,
|
143 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
144 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
145 |
+
labels: Optional[torch.LongTensor] = None,
|
146 |
+
use_cache: Optional[bool] = None,
|
147 |
+
output_attentions: Optional[bool] = None,
|
148 |
+
output_hidden_states: Optional[bool] = None,
|
149 |
+
output_router_logits: Optional[bool] = None,
|
150 |
+
cache_position: Optional[torch.LongTensor] = None,
|
151 |
+
logits_to_keep: Union[int, torch.Tensor] = 0,
|
152 |
+
**kwargs,
|
153 |
+
) -> MoeCausalLMOutputWithPast:
|
154 |
+
r"""
|
155 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
156 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
157 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
158 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
159 |
+
|
160 |
+
logits_to_keep (`int` or `torch.Tensor`, *optional*):
|
161 |
+
If an `int`, compute logits for the last `logits_to_keep` tokens. If `0`, calculate logits for all
|
162 |
+
`input_ids` (special case). Only last token logits are needed for generation, and calculating them only for that
|
163 |
+
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
|
164 |
+
If a `torch.Tensor`, must be 1D corresponding to the indices to keep in the sequence length dimension.
|
165 |
+
This is useful when using packed tensor format (single dimension for batch and sequence length).
|
166 |
+
|
167 |
+
Returns:
|
168 |
+
|
169 |
+
Example:
|
170 |
+
|
171 |
+
```python
|
172 |
+
>>> from transformers import AutoTokenizer, Qwen3MoeForCausalLM
|
173 |
+
|
174 |
+
>>> model = Qwen3MoeForCausalLM.from_pretrained("Qwen/Qwen3-MoE-15B-A2B")
|
175 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-MoE-15B-A2B")
|
176 |
+
|
177 |
+
>>> prompt = "Hey, are you conscious? Can you talk to me?"
|
178 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
179 |
+
|
180 |
+
>>> # Generate
|
181 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
182 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
183 |
+
"Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
|
184 |
+
```"""
|
185 |
+
|
186 |
+
output_attentions = (
|
187 |
+
output_attentions
|
188 |
+
if output_attentions is not None
|
189 |
+
else self.config.output_attentions
|
190 |
+
)
|
191 |
+
output_router_logits = (
|
192 |
+
output_router_logits
|
193 |
+
if output_router_logits is not None
|
194 |
+
else self.config.output_router_logits
|
195 |
+
)
|
196 |
+
|
197 |
+
output_hidden_states = (
|
198 |
+
output_hidden_states
|
199 |
+
if output_hidden_states is not None
|
200 |
+
else self.config.output_hidden_states
|
201 |
+
)
|
202 |
+
|
203 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
204 |
+
outputs: MoeModelOutputWithPast = self.model(
|
205 |
+
input_ids=input_ids,
|
206 |
+
attention_mask=attention_mask,
|
207 |
+
position_ids=position_ids,
|
208 |
+
past_key_values=past_key_values,
|
209 |
+
inputs_embeds=inputs_embeds,
|
210 |
+
use_cache=use_cache,
|
211 |
+
output_attentions=output_attentions,
|
212 |
+
output_hidden_states=output_hidden_states,
|
213 |
+
output_router_logits=output_router_logits,
|
214 |
+
cache_position=cache_position,
|
215 |
+
**kwargs,
|
216 |
+
)
|
217 |
+
|
218 |
+
hidden_states = outputs.last_hidden_state
|
219 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
220 |
+
slice_indices = (
|
221 |
+
slice(-logits_to_keep, None)
|
222 |
+
if isinstance(logits_to_keep, int)
|
223 |
+
else logits_to_keep
|
224 |
+
)
|
225 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
226 |
+
|
227 |
+
loss = None
|
228 |
+
if labels is not None:
|
229 |
+
loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
|
230 |
+
|
231 |
+
aux_loss = None
|
232 |
+
if output_router_logits:
|
233 |
+
aux_loss = load_balancing_loss_func(
|
234 |
+
outputs.router_logits,
|
235 |
+
self.num_experts,
|
236 |
+
self.num_experts_per_tok,
|
237 |
+
attention_mask,
|
238 |
+
)
|
239 |
+
if labels is not None:
|
240 |
+
loss += self.router_aux_loss_coef * aux_loss.to(
|
241 |
+
loss.device
|
242 |
+
) # make sure to reside in the same device
|
243 |
+
|
244 |
+
return MoeCausalLMOutputWithPast(
|
245 |
+
loss=loss,
|
246 |
+
aux_loss=aux_loss,
|
247 |
+
logits=logits,
|
248 |
+
past_key_values=outputs.past_key_values,
|
249 |
+
hidden_states=outputs.hidden_states,
|
250 |
+
attentions=outputs.attentions,
|
251 |
+
router_logits=outputs.router_logits,
|
252 |
+
)
|
253 |
+
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"151643": {
|
5 |
+
"content": "<|endoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"151644": {
|
13 |
+
"content": "<|im_start|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"151645": {
|
21 |
+
"content": "<|im_end|>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
},
|
28 |
+
"151646": {
|
29 |
+
"content": "<|object_ref_start|>",
|
30 |
+
"lstrip": false,
|
31 |
+
"normalized": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"single_word": false,
|
34 |
+
"special": true
|
35 |
+
},
|
36 |
+
"151647": {
|
37 |
+
"content": "<|object_ref_end|>",
|
38 |
+
"lstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"single_word": false,
|
42 |
+
"special": true
|
43 |
+
},
|
44 |
+
"151648": {
|
45 |
+
"content": "<|box_start|>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false,
|
50 |
+
"special": true
|
51 |
+
},
|
52 |
+
"151649": {
|
53 |
+
"content": "<|box_end|>",
|
54 |
+
"lstrip": false,
|
55 |
+
"normalized": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"single_word": false,
|
58 |
+
"special": true
|
59 |
+
},
|
60 |
+
"151650": {
|
61 |
+
"content": "<|quad_start|>",
|
62 |
+
"lstrip": false,
|
63 |
+
"normalized": false,
|
64 |
+
"rstrip": false,
|
65 |
+
"single_word": false,
|
66 |
+
"special": true
|
67 |
+
},
|
68 |
+
"151651": {
|
69 |
+
"content": "<|quad_end|>",
|
70 |
+
"lstrip": false,
|
71 |
+
"normalized": false,
|
72 |
+
"rstrip": false,
|
73 |
+
"single_word": false,
|
74 |
+
"special": true
|
75 |
+
},
|
76 |
+
"151652": {
|
77 |
+
"content": "<|vision_start|>",
|
78 |
+
"lstrip": false,
|
79 |
+
"normalized": false,
|
80 |
+
"rstrip": false,
|
81 |
+
"single_word": false,
|
82 |
+
"special": true
|
83 |
+
},
|
84 |
+
"151653": {
|
85 |
+
"content": "<|vision_end|>",
|
86 |
+
"lstrip": false,
|
87 |
+
"normalized": false,
|
88 |
+
"rstrip": false,
|
89 |
+
"single_word": false,
|
90 |
+
"special": true
|
91 |
+
},
|
92 |
+
"151654": {
|
93 |
+
"content": "<|vision_pad|>",
|
94 |
+
"lstrip": false,
|
95 |
+
"normalized": false,
|
96 |
+
"rstrip": false,
|
97 |
+
"single_word": false,
|
98 |
+
"special": true
|
99 |
+
},
|
100 |
+
"151655": {
|
101 |
+
"content": "<|image_pad|>",
|
102 |
+
"lstrip": false,
|
103 |
+
"normalized": false,
|
104 |
+
"rstrip": false,
|
105 |
+
"single_word": false,
|
106 |
+
"special": true
|
107 |
+
},
|
108 |
+
"151656": {
|
109 |
+
"content": "<|video_pad|>",
|
110 |
+
"lstrip": false,
|
111 |
+
"normalized": false,
|
112 |
+
"rstrip": false,
|
113 |
+
"single_word": false,
|
114 |
+
"special": true
|
115 |
+
},
|
116 |
+
"151657": {
|
117 |
+
"content": "<tool_call>",
|
118 |
+
"lstrip": false,
|
119 |
+
"normalized": false,
|
120 |
+
"rstrip": false,
|
121 |
+
"single_word": false,
|
122 |
+
"special": false
|
123 |
+
},
|
124 |
+
"151658": {
|
125 |
+
"content": "</tool_call>",
|
126 |
+
"lstrip": false,
|
127 |
+
"normalized": false,
|
128 |
+
"rstrip": false,
|
129 |
+
"single_word": false,
|
130 |
+
"special": false
|
131 |
+
},
|
132 |
+
"151659": {
|
133 |
+
"content": "<|fim_prefix|>",
|
134 |
+
"lstrip": false,
|
135 |
+
"normalized": false,
|
136 |
+
"rstrip": false,
|
137 |
+
"single_word": false,
|
138 |
+
"special": false
|
139 |
+
},
|
140 |
+
"151660": {
|
141 |
+
"content": "<|fim_middle|>",
|
142 |
+
"lstrip": false,
|
143 |
+
"normalized": false,
|
144 |
+
"rstrip": false,
|
145 |
+
"single_word": false,
|
146 |
+
"special": false
|
147 |
+
},
|
148 |
+
"151661": {
|
149 |
+
"content": "<|fim_suffix|>",
|
150 |
+
"lstrip": false,
|
151 |
+
"normalized": false,
|
152 |
+
"rstrip": false,
|
153 |
+
"single_word": false,
|
154 |
+
"special": false
|
155 |
+
},
|
156 |
+
"151662": {
|
157 |
+
"content": "<|fim_pad|>",
|
158 |
+
"lstrip": false,
|
159 |
+
"normalized": false,
|
160 |
+
"rstrip": false,
|
161 |
+
"single_word": false,
|
162 |
+
"special": false
|
163 |
+
},
|
164 |
+
"151663": {
|
165 |
+
"content": "<|repo_name|>",
|
166 |
+
"lstrip": false,
|
167 |
+
"normalized": false,
|
168 |
+
"rstrip": false,
|
169 |
+
"single_word": false,
|
170 |
+
"special": false
|
171 |
+
},
|
172 |
+
"151664": {
|
173 |
+
"content": "<|file_sep|>",
|
174 |
+
"lstrip": false,
|
175 |
+
"normalized": false,
|
176 |
+
"rstrip": false,
|
177 |
+
"single_word": false,
|
178 |
+
"special": false
|
179 |
+
},
|
180 |
+
"151665": {
|
181 |
+
"content": "<tool_response>",
|
182 |
+
"lstrip": false,
|
183 |
+
"normalized": false,
|
184 |
+
"rstrip": false,
|
185 |
+
"single_word": false,
|
186 |
+
"special": false
|
187 |
+
},
|
188 |
+
"151666": {
|
189 |
+
"content": "</tool_response>",
|
190 |
+
"lstrip": false,
|
191 |
+
"normalized": false,
|
192 |
+
"rstrip": false,
|
193 |
+
"single_word": false,
|
194 |
+
"special": false
|
195 |
+
},
|
196 |
+
"151667": {
|
197 |
+
"content": "<think>",
|
198 |
+
"lstrip": false,
|
199 |
+
"normalized": false,
|
200 |
+
"rstrip": false,
|
201 |
+
"single_word": false,
|
202 |
+
"special": false
|
203 |
+
},
|
204 |
+
"151668": {
|
205 |
+
"content": "</think>",
|
206 |
+
"lstrip": false,
|
207 |
+
"normalized": false,
|
208 |
+
"rstrip": false,
|
209 |
+
"single_word": false,
|
210 |
+
"special": false
|
211 |
+
}
|
212 |
+
},
|
213 |
+
"additional_special_tokens": [
|
214 |
+
"<|im_start|>",
|
215 |
+
"<|im_end|>",
|
216 |
+
"<|object_ref_start|>",
|
217 |
+
"<|object_ref_end|>",
|
218 |
+
"<|box_start|>",
|
219 |
+
"<|box_end|>",
|
220 |
+
"<|quad_start|>",
|
221 |
+
"<|quad_end|>",
|
222 |
+
"<|vision_start|>",
|
223 |
+
"<|vision_end|>",
|
224 |
+
"<|vision_pad|>",
|
225 |
+
"<|image_pad|>",
|
226 |
+
"<|video_pad|>"
|
227 |
+
],
|
228 |
+
"bos_token": null,
|
229 |
+
"chat_template": "{% macro render_item_list(item_list, tag_name='required') %}\n {%- if item_list is defined and item_list is iterable and item_list | length > 0 %}\n {%- if tag_name %}{{- '\\n<' ~ tag_name ~ '>' -}}{% endif %}\n {{- '[' }}\n {%- for item in item_list -%}\n {%- if loop.index > 1 %}{{- \", \"}}{% endif -%}\n {%- if item is string -%}\n {{ \"`\" ~ item ~ \"`\" }}\n {%- else -%}\n {{ item }}\n {%- endif -%}\n {%- endfor -%}\n {{- ']' }}\n {%- if tag_name %}{{- '</' ~ tag_name ~ '>' -}}{% endif %}\n {%- endif %}\n{% endmacro %}\n\n{%- if messages[0][\"role\"] == \"system\" %}\n {%- set system_message = messages[0][\"content\"] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set loop_messages = messages %}\n{%- endif %}\n\n{%- if not tools is defined %}\n {%- set tools = [] %}\n{%- endif %}\n\n{%- if system_message is defined %}\n {{- \"<|im_start|>system\\n\" + system_message }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- \"<|im_start|>system\\nYou are Qwen, a helpful AI assistant that can interact with a computer to solve tasks.\" }}\n {%- endif %}\n{%- endif %}\n{%- if tools is iterable and tools | length > 0 %}\n {{- \"\\n\\nYou have access to the following functions:\\n\\n\" }}\n {{- \"<tools>\" }}\n {%- for tool in tools %}\n {%- if tool.function is defined %}\n {%- set tool = tool.function %}\n {%- endif %}\n {{- \"\\n<function>\\n<name>\" ~ tool.name ~ \"</name>\" }}\n {{- '\\n<description>' ~ (tool.description | trim) ~ '</description>' }}\n {{- '\\n<parameters>' }}\n {%- for param_name, param_fields in tool.parameters.properties|items %}\n {{- '\\n<parameter>' }}\n {{- '\\n<name>' ~ param_name ~ '</name>' }}\n {%- if param_fields.type is defined %}\n {{- '\\n<type>' ~ (param_fields.type | string) ~ '</type>' }}\n {%- endif %}\n {%- if param_fields.description is defined %}\n {{- '\\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}\n {%- endif %}\n {{- render_item_list(param_fields.enum, 'enum') }}\n {%- set handled_keys = ['type', 'description', 'enum', 'required'] %}\n {%- for json_key in param_fields.keys() | reject(\"in\", handled_keys) %}\n {%- set normed_json_key = json_key | replace(\"-\", \"_\") | replace(\" \", \"_\") | replace(\"$\", \"\") %}\n {%- if param_fields[json_key] is mapping %}\n {{- '\\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | tojson | safe) ~ '</' ~ normed_json_key ~ '>' }}\n {%- else %}\n {{-'\\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | string) ~ '</' ~ normed_json_key ~ '>' }}\n {%- endif %}\n {%- endfor %}\n {{- render_item_list(param_fields.required, 'required') }}\n {{- '\\n</parameter>' }}\n {%- endfor %}\n {{- render_item_list(tool.parameters.required, 'required') }}\n {{- '\\n</parameters>' }}\n {%- if tool.return is defined %}\n {%- if tool.return is mapping %}\n {{- '\\n<return>' ~ (tool.return | tojson | safe) ~ '</return>' }}\n {%- else %}\n {{- '\\n<return>' ~ (tool.return | string) ~ '</return>' }}\n {%- endif %}\n {%- endif %}\n {{- '\\n</function>' }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n{%- endif %}\n{%- if system_message is defined %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in loop_messages %}\n {%- if message.role == \"assistant\" and message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content is defined and message.content is string and message.content | trim | length > 0 %}\n {{- '\\n' + message.content | trim + '\\n' }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value if args_value is string else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"user\" or message.role == \"system\" or message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user\\n' }}\n {%- endif %}\n {{- '<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>\\n' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
230 |
+
"clean_up_tokenization_spaces": false,
|
231 |
+
"eos_token": "<|im_end|>",
|
232 |
+
"errors": "replace",
|
233 |
+
"model_max_length": 1048576,
|
234 |
+
"pad_token": "<|endoftext|>",
|
235 |
+
"split_special_tokens": false,
|
236 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
237 |
+
"unk_token": null,
|
238 |
+
"add_bos_token": false
|
239 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|