Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- config.json +44 -0
- configuration_qwen3_shared_moe.py +230 -0
- convert_back.py +141 -0
- convert_to_shared.py +44 -0
- generation_config.json +6 -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 +538 -0
- modeling_qwen3_shared_moe.py +261 -0
- tokenizer.json +3 -0
- tokenizer_config.json +239 -0
- vocab.json +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"bos_token_id": 151643,
|
13 |
+
"decoder_sparse_step": 1,
|
14 |
+
"eos_token_id": 151645,
|
15 |
+
"head_dim": 128,
|
16 |
+
"hidden_act": "silu",
|
17 |
+
"hidden_size": 2048,
|
18 |
+
"initializer_range": 0.02,
|
19 |
+
"intermediate_size": 6144,
|
20 |
+
"max_position_embeddings": 262144,
|
21 |
+
"max_window_layers": 48,
|
22 |
+
"mlp_only_layers": [],
|
23 |
+
"model_type": "qwen3_shared_moe",
|
24 |
+
"moe_intermediate_size": 768,
|
25 |
+
"norm_topk_prob": true,
|
26 |
+
"num_attention_heads": 32,
|
27 |
+
"num_experts": 128,
|
28 |
+
"num_experts_per_tok": 8,
|
29 |
+
"num_hidden_layers": 48,
|
30 |
+
"num_key_value_heads": 4,
|
31 |
+
"output_router_logits": false,
|
32 |
+
"rms_norm_eps": 1e-06,
|
33 |
+
"rope_scaling": null,
|
34 |
+
"rope_theta": 10000000,
|
35 |
+
"router_aux_loss_coef": 0.001,
|
36 |
+
"shared_expert_intermediate_size": null,
|
37 |
+
"sliding_window": null,
|
38 |
+
"tie_word_embeddings": false,
|
39 |
+
"torch_dtype": "bfloat16",
|
40 |
+
"transformers_version": "4.52.3",
|
41 |
+
"use_cache": true,
|
42 |
+
"use_sliding_window": false,
|
43 |
+
"vocab_size": 151936
|
44 |
+
}
|
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 |
+
|
convert_back.py
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import accelerate
|
3 |
+
from configuration_qwen3_shared_moe import Qwen3SharedMoeConfig
|
4 |
+
from modeling_qwen3_shared_moe import Qwen3SharedMoeForCausalLM
|
5 |
+
from transformers.models.qwen3_moe.configuration_qwen3_moe import Qwen3MoeConfig
|
6 |
+
from transformers.models.qwen3_moe.modeling_qwen3_moe import Qwen3MoeForCausalLM
|
7 |
+
|
8 |
+
def convert_shared_moe_to_standard_moe(
|
9 |
+
shared_moe_model_path: str,
|
10 |
+
output_model_path: str,
|
11 |
+
):
|
12 |
+
"""
|
13 |
+
Converts a Qwen3SharedMoeForCausalLM model (with no shared expert configured)
|
14 |
+
back to a standard Qwen3MoeForCausalLM model.
|
15 |
+
"""
|
16 |
+
print(f"Loading Qwen3SharedMoeConfig from: {shared_moe_model_path}")
|
17 |
+
cfg_shared_moe = Qwen3SharedMoeConfig.from_pretrained(shared_moe_model_path)
|
18 |
+
|
19 |
+
if cfg_shared_moe.shared_expert_intermediate_size is not None:
|
20 |
+
print(
|
21 |
+
"Warning: The source Qwen3SharedMoeConfig has 'shared_expert_intermediate_size' set. "
|
22 |
+
"This script assumes no shared expert is actually used or its weights will be discarded."
|
23 |
+
)
|
24 |
+
|
25 |
+
print("Creating standard Qwen3MoeConfig...")
|
26 |
+
cfg_standard_moe = Qwen3MoeConfig(
|
27 |
+
vocab_size=cfg_shared_moe.vocab_size,
|
28 |
+
hidden_size=cfg_shared_moe.hidden_size,
|
29 |
+
intermediate_size=cfg_shared_moe.intermediate_size,
|
30 |
+
num_hidden_layers=cfg_shared_moe.num_hidden_layers,
|
31 |
+
num_attention_heads=cfg_shared_moe.num_attention_heads,
|
32 |
+
num_key_value_heads=cfg_shared_moe.num_key_value_heads,
|
33 |
+
hidden_act=cfg_shared_moe.hidden_act,
|
34 |
+
max_position_embeddings=cfg_shared_moe.max_position_embeddings,
|
35 |
+
initializer_range=cfg_shared_moe.initializer_range,
|
36 |
+
rms_norm_eps=cfg_shared_moe.rms_norm_eps,
|
37 |
+
use_cache=cfg_shared_moe.use_cache,
|
38 |
+
tie_word_embeddings=cfg_shared_moe.tie_word_embeddings,
|
39 |
+
rope_theta=cfg_shared_moe.rope_theta,
|
40 |
+
rope_scaling=cfg_shared_moe.rope_scaling,
|
41 |
+
attention_bias=cfg_shared_moe.attention_bias,
|
42 |
+
use_sliding_window=cfg_shared_moe.use_sliding_window,
|
43 |
+
sliding_window=cfg_shared_moe.sliding_window,
|
44 |
+
max_window_layers=cfg_shared_moe.max_window_layers,
|
45 |
+
attention_dropout=cfg_shared_moe.attention_dropout,
|
46 |
+
decoder_sparse_step=cfg_shared_moe.decoder_sparse_step,
|
47 |
+
moe_intermediate_size=cfg_shared_moe.moe_intermediate_size,
|
48 |
+
num_experts_per_tok=cfg_shared_moe.num_experts_per_tok,
|
49 |
+
num_experts=cfg_shared_moe.num_experts,
|
50 |
+
norm_topk_prob=cfg_shared_moe.norm_topk_prob,
|
51 |
+
output_router_logits=cfg_shared_moe.output_router_logits,
|
52 |
+
router_aux_loss_coef=cfg_shared_moe.router_aux_loss_coef,
|
53 |
+
mlp_only_layers=cfg_shared_moe.mlp_only_layers,
|
54 |
+
)
|
55 |
+
|
56 |
+
print(f"Loading Qwen3SharedMoeForCausalLM model from: {shared_moe_model_path}")
|
57 |
+
model_shared_moe = Qwen3SharedMoeForCausalLM.from_pretrained(
|
58 |
+
shared_moe_model_path,
|
59 |
+
torch_dtype=torch.bfloat16,
|
60 |
+
low_cpu_mem_usage=True
|
61 |
+
)
|
62 |
+
state_dict_shared_moe = model_shared_moe.state_dict()
|
63 |
+
|
64 |
+
print("Instantiating standard Qwen3MoeForCausalLM model...")
|
65 |
+
with accelerate.init_empty_weights():
|
66 |
+
model_standard_moe = Qwen3MoeForCausalLM(cfg_standard_moe)
|
67 |
+
|
68 |
+
model_standard_moe = model_standard_moe.to(torch.bfloat16)
|
69 |
+
new_state_dict = {}
|
70 |
+
processed_shared_keys = set()
|
71 |
+
|
72 |
+
print("Converting state dictionary...")
|
73 |
+
for name_shared, param_shared in state_dict_shared_moe.items():
|
74 |
+
if name_shared in processed_shared_keys:
|
75 |
+
continue
|
76 |
+
|
77 |
+
if "shared_expert" in name_shared:
|
78 |
+
print(f" Discarding shared_expert parameter: {name_shared}")
|
79 |
+
processed_shared_keys.add(name_shared)
|
80 |
+
continue
|
81 |
+
|
82 |
+
# Handle scattermoe's GLUMLP weights for MoE layers
|
83 |
+
# scattermoe: layers.X.mlp.moe_mlp.output_experts.weight
|
84 |
+
# standard HF: layers.X.mlp.experts.<i>.down_proj.weight
|
85 |
+
if "mlp.moe_mlp.output_experts.weight" in name_shared:
|
86 |
+
prefix = name_shared.split("mlp.moe_mlp.output_experts.weight")[0]
|
87 |
+
for i in range(cfg_shared_moe.num_experts):
|
88 |
+
target_name = f"{prefix}mlp.experts.{i}.down_proj.weight"
|
89 |
+
new_state_dict[target_name] = param_shared[i, :, :].clone()
|
90 |
+
print(f" Converted: {name_shared}[{i},:,:] -> {target_name}")
|
91 |
+
processed_shared_keys.add(name_shared)
|
92 |
+
# scattermoe: layers.X.mlp.moe_mlp.experts.weight (contains concatenated up_proj and gate_proj)
|
93 |
+
# standard HF: layers.X.mlp.experts.<i>.up_proj.weight and layers.X.mlp.experts.<i>.gate_proj.weight
|
94 |
+
elif "mlp.moe_mlp.experts.weight" in name_shared:
|
95 |
+
prefix = name_shared.split("mlp.moe_mlp.experts.weight")[0]
|
96 |
+
# This is the intermediate size of one part of the GLU (e.g., up_proj output dim)
|
97 |
+
moe_glu_intermediate_size = cfg_shared_moe.moe_intermediate_size
|
98 |
+
for i in range(cfg_shared_moe.num_experts):
|
99 |
+
target_up_proj_name = f"{prefix}mlp.experts.{i}.up_proj.weight"
|
100 |
+
target_gate_proj_name = f"{prefix}mlp.experts.{i}.gate_proj.weight"
|
101 |
+
|
102 |
+
# param_shared shape: [num_experts, 2 * moe_glu_intermediate_size, hidden_size_in]
|
103 |
+
new_state_dict[target_up_proj_name] = param_shared[i, :moe_glu_intermediate_size, :].clone()
|
104 |
+
new_state_dict[target_gate_proj_name] = param_shared[i, moe_glu_intermediate_size:, :].clone()
|
105 |
+
print(f" Converted: {name_shared}[{i},:{moe_glu_intermediate_size},:] -> {target_up_proj_name}")
|
106 |
+
print(f" Converted: {name_shared}[{i},{moe_glu_intermediate_size}:,:] -> {target_gate_proj_name}")
|
107 |
+
processed_shared_keys.add(name_shared)
|
108 |
+
# Direct copy for all other parameters (attention, layernorms, embeddings, non-MoE MLPs, MoE router gate)
|
109 |
+
else:
|
110 |
+
if name_shared not in new_state_dict:
|
111 |
+
if name_shared in model_standard_moe.state_dict():
|
112 |
+
new_state_dict[name_shared] = param_shared.clone()
|
113 |
+
else:
|
114 |
+
print(f" Warning: Parameter {name_shared} from source model not found in target standard model structure. Discarding.")
|
115 |
+
processed_shared_keys.add(name_shared)
|
116 |
+
|
117 |
+
# Sanity checks
|
118 |
+
target_model_keys = set(model_standard_moe.state_dict().keys())
|
119 |
+
converted_keys = set(new_state_dict.keys())
|
120 |
+
|
121 |
+
missing_keys = target_model_keys - converted_keys
|
122 |
+
if missing_keys:
|
123 |
+
print(f"Error: The following keys are expected by the standard model but were not generated: {missing_keys}")
|
124 |
+
|
125 |
+
extra_keys = converted_keys - target_model_keys
|
126 |
+
if extra_keys:
|
127 |
+
print(f"Warning: The following keys were generated but are not expected by the standard model: {extra_keys}")
|
128 |
+
|
129 |
+
print("Loading converted state dictionary into standard model...")
|
130 |
+
model_standard_moe.load_state_dict(new_state_dict, strict=True)
|
131 |
+
|
132 |
+
print(f"Saving standard Qwen3MoeForCausalLM model to: {output_model_path}")
|
133 |
+
model_standard_moe.save_pretrained(output_model_path)
|
134 |
+
cfg_standard_moe.save_pretrained(output_model_path)
|
135 |
+
|
136 |
+
billion_params_shared = sum(p.numel() for p in model_shared_moe.parameters()) / 1_000_000_000
|
137 |
+
billion_params_standard = sum(p.numel() for p in model_standard_moe.parameters()) / 1_000_000_000
|
138 |
+
print(f"Source Qwen3SharedMoe model parameters: {billion_params_shared:.2f}B")
|
139 |
+
print(f"Converted standard Qwen3Moe model parameters: {billion_params_standard:.2f}B")
|
140 |
+
print("Conversion complete.")
|
141 |
+
return model_standard_moe
|
convert_to_shared.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
|
3 |
+
import torch
|
4 |
+
from configuration_qwen3_shared_moe import Qwen3SharedMoeConfig
|
5 |
+
from modeling_qwen3_shared_moe import Qwen3SharedMoeForCausalLM
|
6 |
+
from transformers import Qwen3MoeConfig, Qwen3MoeForCausalLM
|
7 |
+
|
8 |
+
if __name__ == "__main__":
|
9 |
+
source_directory = sys.argv[1]
|
10 |
+
target_directory = sys.argv[2]
|
11 |
+
dtype = torch.bfloat16
|
12 |
+
config = Qwen3MoeConfig.from_pretrained(
|
13 |
+
source_directory, low_cpu_mem_usage=True, torch_dtype=dtype
|
14 |
+
)
|
15 |
+
shared_config = Qwen3SharedMoeConfig.from_dict(config.__dict__)
|
16 |
+
shared_config.shared_expert_intermediate_size = None
|
17 |
+
num_experts = config.num_experts
|
18 |
+
print("Loading original...")
|
19 |
+
model_orig = Qwen3MoeForCausalLM.from_pretrained(
|
20 |
+
source_directory, torch_dtype=dtype, low_cpu_mem_usage=True
|
21 |
+
)
|
22 |
+
print("Initialising ScatterMoE")
|
23 |
+
model = Qwen3SharedMoeForCausalLM(shared_config).to(dtype)
|
24 |
+
state_dict_orig = model_orig.state_dict()
|
25 |
+
for n, p in model.named_parameters():
|
26 |
+
assert p.dtype == torch.bfloat16
|
27 |
+
if n in state_dict_orig:
|
28 |
+
p.data[:] = state_dict_orig.pop(n)
|
29 |
+
else:
|
30 |
+
prefix, suffix = n.split("moe_mlp")
|
31 |
+
for i in range(num_experts):
|
32 |
+
if suffix == ".output_experts.weight":
|
33 |
+
down_proj_param_name = prefix + "experts.%d.down_proj.weight" % i
|
34 |
+
assert state_dict_orig[down_proj_param_name].dtype == torch.bfloat16
|
35 |
+
p.data[i, :, :] = state_dict_orig.pop(down_proj_param_name)
|
36 |
+
else:
|
37 |
+
gate_proj_param_name = prefix + "experts.%d.gate_proj.weight" % i
|
38 |
+
up_proj_param_name = prefix + "experts.%d.up_proj.weight" % i
|
39 |
+
out_dim, in_dim = state_dict_orig[gate_proj_param_name].size()
|
40 |
+
p.data[i, :out_dim, :] = state_dict_orig.pop(up_proj_param_name)
|
41 |
+
p.data[i, out_dim:, :] = state_dict_orig.pop(gate_proj_param_name)
|
42 |
+
assert len(state_dict_orig) == 0
|
43 |
+
print("Saving to file.")
|
44 |
+
model.to(dtype=torch.bfloat16).save_pretrained(target_directory, save_config=True)
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 151643,
|
4 |
+
"eos_token_id": 151645,
|
5 |
+
"transformers_version": "4.52.3"
|
6 |
+
}
|
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:bf3878eb50c788c348f9fd44994fac6766fb04263ca5ac52de60def65e747de2
|
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:207f0a2e738ea32e7dc0550bba58844f14edd3d61f6869c3cada364f61cb94aa
|
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:0f5b73f40ab91082374f4921b98d49b44af46ba3b9f53ec40007e21725e5e9e8
|
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:8c0d28bdec40b23012caa0a6a54dfa11c59b4862d0cf69a6cd67d516d932eb94
|
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:2aa4eb2bbef82feeea6e7e01518ddd5cbcafdc68078544d0433f4547d80b01e4
|
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:d19fc73225af721d8196504715fede88b2c203b975f925e02933577815e1b559
|
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:ead57eb89352a31e73904aca8bb8e3a7a4c77a7f0f6c410eb2f8139165b1f8fb
|
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:9ec65446dc22cdc4f7505b60a868976d19879a65dfebb0d664d8cb3562aaa955
|
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:626079c3db346c052d5ec853ac1f38ace07c7e85a288769cb4bc2c37c9548edd
|
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:b9756cd42a675288cc2c7df622f622469d97d6366d0293f556dfcdf064a15578
|
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:1905c8a5117fc32b53dddf41ee870b980834c11320bd3ebc74b13e79a63e1f71
|
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:ef2c7b0ff571110d1f1fe1730be6ef2604a0a0cbf25c3239f1dbbdcfccb2a431
|
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:2ada579685bfaf4548c49adf54023f5753ebcec6c54dd850e3225874d7737d7d
|
3 |
+
size 1830302400
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 61064245248
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "model-00013-of-00013.safetensors",
|
7 |
+
"model.embed_tokens.weight": "model-00001-of-00013.safetensors",
|
8 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
9 |
+
"model.layers.0.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
10 |
+
"model.layers.0.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
11 |
+
"model.layers.0.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
13 |
+
"model.layers.0.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
14 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
15 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
16 |
+
"model.layers.0.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
17 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
18 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
19 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
20 |
+
"model.layers.1.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
21 |
+
"model.layers.1.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
22 |
+
"model.layers.1.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
23 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
24 |
+
"model.layers.1.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
25 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
26 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
27 |
+
"model.layers.1.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
28 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
29 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
30 |
+
"model.layers.10.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
31 |
+
"model.layers.10.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
32 |
+
"model.layers.10.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
33 |
+
"model.layers.10.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
34 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
35 |
+
"model.layers.10.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
36 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
37 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
38 |
+
"model.layers.10.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
39 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
40 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
41 |
+
"model.layers.11.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
42 |
+
"model.layers.11.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
43 |
+
"model.layers.11.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
44 |
+
"model.layers.11.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
45 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
46 |
+
"model.layers.11.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
47 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
48 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
49 |
+
"model.layers.11.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
50 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
51 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
52 |
+
"model.layers.12.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
53 |
+
"model.layers.12.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
54 |
+
"model.layers.12.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
55 |
+
"model.layers.12.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
56 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
57 |
+
"model.layers.12.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
58 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
59 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
60 |
+
"model.layers.12.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
61 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
62 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
63 |
+
"model.layers.13.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
64 |
+
"model.layers.13.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
65 |
+
"model.layers.13.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
66 |
+
"model.layers.13.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
67 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
68 |
+
"model.layers.13.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
69 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
70 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
71 |
+
"model.layers.13.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
72 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
73 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
74 |
+
"model.layers.14.input_layernorm.weight": "model-00004-of-00013.safetensors",
|
75 |
+
"model.layers.14.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
76 |
+
"model.layers.14.mlp.moe_mlp.experts.weight": "model-00004-of-00013.safetensors",
|
77 |
+
"model.layers.14.mlp.moe_mlp.output_experts.weight": "model-00004-of-00013.safetensors",
|
78 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00004-of-00013.safetensors",
|
79 |
+
"model.layers.14.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
80 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
81 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
82 |
+
"model.layers.14.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
83 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
84 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
85 |
+
"model.layers.15.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
86 |
+
"model.layers.15.mlp.gate.weight": "model-00004-of-00013.safetensors",
|
87 |
+
"model.layers.15.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
88 |
+
"model.layers.15.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
89 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
90 |
+
"model.layers.15.self_attn.k_norm.weight": "model-00004-of-00013.safetensors",
|
91 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00004-of-00013.safetensors",
|
92 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00004-of-00013.safetensors",
|
93 |
+
"model.layers.15.self_attn.q_norm.weight": "model-00004-of-00013.safetensors",
|
94 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00004-of-00013.safetensors",
|
95 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00004-of-00013.safetensors",
|
96 |
+
"model.layers.16.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
97 |
+
"model.layers.16.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
98 |
+
"model.layers.16.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
99 |
+
"model.layers.16.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
100 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
101 |
+
"model.layers.16.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
102 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
103 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
104 |
+
"model.layers.16.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
105 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
106 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
107 |
+
"model.layers.17.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
108 |
+
"model.layers.17.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
109 |
+
"model.layers.17.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
110 |
+
"model.layers.17.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
111 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
112 |
+
"model.layers.17.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
113 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
114 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
115 |
+
"model.layers.17.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
116 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
117 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
118 |
+
"model.layers.18.input_layernorm.weight": "model-00005-of-00013.safetensors",
|
119 |
+
"model.layers.18.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
120 |
+
"model.layers.18.mlp.moe_mlp.experts.weight": "model-00005-of-00013.safetensors",
|
121 |
+
"model.layers.18.mlp.moe_mlp.output_experts.weight": "model-00005-of-00013.safetensors",
|
122 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00005-of-00013.safetensors",
|
123 |
+
"model.layers.18.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
124 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
125 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
126 |
+
"model.layers.18.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
127 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
128 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
129 |
+
"model.layers.19.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
130 |
+
"model.layers.19.mlp.gate.weight": "model-00005-of-00013.safetensors",
|
131 |
+
"model.layers.19.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
132 |
+
"model.layers.19.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
133 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
134 |
+
"model.layers.19.self_attn.k_norm.weight": "model-00005-of-00013.safetensors",
|
135 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00005-of-00013.safetensors",
|
136 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00005-of-00013.safetensors",
|
137 |
+
"model.layers.19.self_attn.q_norm.weight": "model-00005-of-00013.safetensors",
|
138 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00005-of-00013.safetensors",
|
139 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00005-of-00013.safetensors",
|
140 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00013.safetensors",
|
141 |
+
"model.layers.2.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
142 |
+
"model.layers.2.mlp.moe_mlp.experts.weight": "model-00001-of-00013.safetensors",
|
143 |
+
"model.layers.2.mlp.moe_mlp.output_experts.weight": "model-00001-of-00013.safetensors",
|
144 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00013.safetensors",
|
145 |
+
"model.layers.2.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
146 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
147 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
148 |
+
"model.layers.2.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
149 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
150 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
151 |
+
"model.layers.20.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
152 |
+
"model.layers.20.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
153 |
+
"model.layers.20.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
154 |
+
"model.layers.20.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
155 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
156 |
+
"model.layers.20.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
157 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
158 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
159 |
+
"model.layers.20.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
160 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
161 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
162 |
+
"model.layers.21.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
163 |
+
"model.layers.21.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
164 |
+
"model.layers.21.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
165 |
+
"model.layers.21.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
166 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
167 |
+
"model.layers.21.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
168 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
169 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
170 |
+
"model.layers.21.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
171 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
172 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
173 |
+
"model.layers.22.input_layernorm.weight": "model-00006-of-00013.safetensors",
|
174 |
+
"model.layers.22.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
175 |
+
"model.layers.22.mlp.moe_mlp.experts.weight": "model-00006-of-00013.safetensors",
|
176 |
+
"model.layers.22.mlp.moe_mlp.output_experts.weight": "model-00006-of-00013.safetensors",
|
177 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00006-of-00013.safetensors",
|
178 |
+
"model.layers.22.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
179 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
180 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
181 |
+
"model.layers.22.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
182 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
183 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
184 |
+
"model.layers.23.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
185 |
+
"model.layers.23.mlp.gate.weight": "model-00006-of-00013.safetensors",
|
186 |
+
"model.layers.23.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
187 |
+
"model.layers.23.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
188 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
189 |
+
"model.layers.23.self_attn.k_norm.weight": "model-00006-of-00013.safetensors",
|
190 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00006-of-00013.safetensors",
|
191 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00006-of-00013.safetensors",
|
192 |
+
"model.layers.23.self_attn.q_norm.weight": "model-00006-of-00013.safetensors",
|
193 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00006-of-00013.safetensors",
|
194 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00006-of-00013.safetensors",
|
195 |
+
"model.layers.24.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
196 |
+
"model.layers.24.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
197 |
+
"model.layers.24.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
198 |
+
"model.layers.24.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
199 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
200 |
+
"model.layers.24.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
201 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
202 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
203 |
+
"model.layers.24.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
204 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
205 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
206 |
+
"model.layers.25.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
207 |
+
"model.layers.25.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
208 |
+
"model.layers.25.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
209 |
+
"model.layers.25.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
210 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
211 |
+
"model.layers.25.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
212 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
213 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
214 |
+
"model.layers.25.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
215 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
216 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
217 |
+
"model.layers.26.input_layernorm.weight": "model-00007-of-00013.safetensors",
|
218 |
+
"model.layers.26.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
219 |
+
"model.layers.26.mlp.moe_mlp.experts.weight": "model-00007-of-00013.safetensors",
|
220 |
+
"model.layers.26.mlp.moe_mlp.output_experts.weight": "model-00007-of-00013.safetensors",
|
221 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00007-of-00013.safetensors",
|
222 |
+
"model.layers.26.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
223 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
224 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
225 |
+
"model.layers.26.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
226 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
227 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
228 |
+
"model.layers.27.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
229 |
+
"model.layers.27.mlp.gate.weight": "model-00007-of-00013.safetensors",
|
230 |
+
"model.layers.27.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
231 |
+
"model.layers.27.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
232 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
233 |
+
"model.layers.27.self_attn.k_norm.weight": "model-00007-of-00013.safetensors",
|
234 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00007-of-00013.safetensors",
|
235 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00007-of-00013.safetensors",
|
236 |
+
"model.layers.27.self_attn.q_norm.weight": "model-00007-of-00013.safetensors",
|
237 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00007-of-00013.safetensors",
|
238 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00007-of-00013.safetensors",
|
239 |
+
"model.layers.28.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
240 |
+
"model.layers.28.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
241 |
+
"model.layers.28.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
242 |
+
"model.layers.28.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
243 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
244 |
+
"model.layers.28.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
245 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
246 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
247 |
+
"model.layers.28.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
248 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
249 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
250 |
+
"model.layers.29.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
251 |
+
"model.layers.29.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
252 |
+
"model.layers.29.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
253 |
+
"model.layers.29.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
254 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
255 |
+
"model.layers.29.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
256 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
257 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
258 |
+
"model.layers.29.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
259 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
260 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
261 |
+
"model.layers.3.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
262 |
+
"model.layers.3.mlp.gate.weight": "model-00001-of-00013.safetensors",
|
263 |
+
"model.layers.3.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
264 |
+
"model.layers.3.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
265 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
266 |
+
"model.layers.3.self_attn.k_norm.weight": "model-00001-of-00013.safetensors",
|
267 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00013.safetensors",
|
268 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00013.safetensors",
|
269 |
+
"model.layers.3.self_attn.q_norm.weight": "model-00001-of-00013.safetensors",
|
270 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00013.safetensors",
|
271 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00013.safetensors",
|
272 |
+
"model.layers.30.input_layernorm.weight": "model-00008-of-00013.safetensors",
|
273 |
+
"model.layers.30.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
274 |
+
"model.layers.30.mlp.moe_mlp.experts.weight": "model-00008-of-00013.safetensors",
|
275 |
+
"model.layers.30.mlp.moe_mlp.output_experts.weight": "model-00008-of-00013.safetensors",
|
276 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00008-of-00013.safetensors",
|
277 |
+
"model.layers.30.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
278 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
279 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
280 |
+
"model.layers.30.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
281 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
282 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
283 |
+
"model.layers.31.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
284 |
+
"model.layers.31.mlp.gate.weight": "model-00008-of-00013.safetensors",
|
285 |
+
"model.layers.31.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
286 |
+
"model.layers.31.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
287 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
288 |
+
"model.layers.31.self_attn.k_norm.weight": "model-00008-of-00013.safetensors",
|
289 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00008-of-00013.safetensors",
|
290 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00008-of-00013.safetensors",
|
291 |
+
"model.layers.31.self_attn.q_norm.weight": "model-00008-of-00013.safetensors",
|
292 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00008-of-00013.safetensors",
|
293 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00008-of-00013.safetensors",
|
294 |
+
"model.layers.32.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
295 |
+
"model.layers.32.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
296 |
+
"model.layers.32.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
297 |
+
"model.layers.32.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
298 |
+
"model.layers.32.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
299 |
+
"model.layers.32.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
300 |
+
"model.layers.32.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
301 |
+
"model.layers.32.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
302 |
+
"model.layers.32.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
303 |
+
"model.layers.32.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
304 |
+
"model.layers.32.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
305 |
+
"model.layers.33.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
306 |
+
"model.layers.33.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
307 |
+
"model.layers.33.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
308 |
+
"model.layers.33.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
309 |
+
"model.layers.33.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
310 |
+
"model.layers.33.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
311 |
+
"model.layers.33.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
312 |
+
"model.layers.33.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
313 |
+
"model.layers.33.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
314 |
+
"model.layers.33.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
315 |
+
"model.layers.33.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
316 |
+
"model.layers.34.input_layernorm.weight": "model-00009-of-00013.safetensors",
|
317 |
+
"model.layers.34.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
318 |
+
"model.layers.34.mlp.moe_mlp.experts.weight": "model-00009-of-00013.safetensors",
|
319 |
+
"model.layers.34.mlp.moe_mlp.output_experts.weight": "model-00009-of-00013.safetensors",
|
320 |
+
"model.layers.34.post_attention_layernorm.weight": "model-00009-of-00013.safetensors",
|
321 |
+
"model.layers.34.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
322 |
+
"model.layers.34.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
323 |
+
"model.layers.34.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
324 |
+
"model.layers.34.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
325 |
+
"model.layers.34.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
326 |
+
"model.layers.34.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
327 |
+
"model.layers.35.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
328 |
+
"model.layers.35.mlp.gate.weight": "model-00009-of-00013.safetensors",
|
329 |
+
"model.layers.35.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
330 |
+
"model.layers.35.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
331 |
+
"model.layers.35.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
332 |
+
"model.layers.35.self_attn.k_norm.weight": "model-00009-of-00013.safetensors",
|
333 |
+
"model.layers.35.self_attn.k_proj.weight": "model-00009-of-00013.safetensors",
|
334 |
+
"model.layers.35.self_attn.o_proj.weight": "model-00009-of-00013.safetensors",
|
335 |
+
"model.layers.35.self_attn.q_norm.weight": "model-00009-of-00013.safetensors",
|
336 |
+
"model.layers.35.self_attn.q_proj.weight": "model-00009-of-00013.safetensors",
|
337 |
+
"model.layers.35.self_attn.v_proj.weight": "model-00009-of-00013.safetensors",
|
338 |
+
"model.layers.36.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
339 |
+
"model.layers.36.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
340 |
+
"model.layers.36.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
341 |
+
"model.layers.36.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
342 |
+
"model.layers.36.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
343 |
+
"model.layers.36.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
344 |
+
"model.layers.36.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
345 |
+
"model.layers.36.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
346 |
+
"model.layers.36.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
347 |
+
"model.layers.36.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
348 |
+
"model.layers.36.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
349 |
+
"model.layers.37.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
350 |
+
"model.layers.37.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
351 |
+
"model.layers.37.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
352 |
+
"model.layers.37.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
353 |
+
"model.layers.37.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
354 |
+
"model.layers.37.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
355 |
+
"model.layers.37.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
356 |
+
"model.layers.37.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
357 |
+
"model.layers.37.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
358 |
+
"model.layers.37.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
359 |
+
"model.layers.37.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
360 |
+
"model.layers.38.input_layernorm.weight": "model-00010-of-00013.safetensors",
|
361 |
+
"model.layers.38.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
362 |
+
"model.layers.38.mlp.moe_mlp.experts.weight": "model-00010-of-00013.safetensors",
|
363 |
+
"model.layers.38.mlp.moe_mlp.output_experts.weight": "model-00010-of-00013.safetensors",
|
364 |
+
"model.layers.38.post_attention_layernorm.weight": "model-00010-of-00013.safetensors",
|
365 |
+
"model.layers.38.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
366 |
+
"model.layers.38.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
367 |
+
"model.layers.38.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
368 |
+
"model.layers.38.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
369 |
+
"model.layers.38.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
370 |
+
"model.layers.38.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
371 |
+
"model.layers.39.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
372 |
+
"model.layers.39.mlp.gate.weight": "model-00010-of-00013.safetensors",
|
373 |
+
"model.layers.39.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
374 |
+
"model.layers.39.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
375 |
+
"model.layers.39.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
376 |
+
"model.layers.39.self_attn.k_norm.weight": "model-00010-of-00013.safetensors",
|
377 |
+
"model.layers.39.self_attn.k_proj.weight": "model-00010-of-00013.safetensors",
|
378 |
+
"model.layers.39.self_attn.o_proj.weight": "model-00010-of-00013.safetensors",
|
379 |
+
"model.layers.39.self_attn.q_norm.weight": "model-00010-of-00013.safetensors",
|
380 |
+
"model.layers.39.self_attn.q_proj.weight": "model-00010-of-00013.safetensors",
|
381 |
+
"model.layers.39.self_attn.v_proj.weight": "model-00010-of-00013.safetensors",
|
382 |
+
"model.layers.4.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
383 |
+
"model.layers.4.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
384 |
+
"model.layers.4.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
385 |
+
"model.layers.4.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
386 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
387 |
+
"model.layers.4.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
388 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
389 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
390 |
+
"model.layers.4.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
391 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
392 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
393 |
+
"model.layers.40.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
394 |
+
"model.layers.40.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
395 |
+
"model.layers.40.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
396 |
+
"model.layers.40.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
397 |
+
"model.layers.40.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
398 |
+
"model.layers.40.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
399 |
+
"model.layers.40.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
400 |
+
"model.layers.40.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
401 |
+
"model.layers.40.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
402 |
+
"model.layers.40.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
403 |
+
"model.layers.40.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
404 |
+
"model.layers.41.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
405 |
+
"model.layers.41.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
406 |
+
"model.layers.41.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
407 |
+
"model.layers.41.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
408 |
+
"model.layers.41.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
409 |
+
"model.layers.41.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
410 |
+
"model.layers.41.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
411 |
+
"model.layers.41.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
412 |
+
"model.layers.41.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
413 |
+
"model.layers.41.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
414 |
+
"model.layers.41.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
415 |
+
"model.layers.42.input_layernorm.weight": "model-00011-of-00013.safetensors",
|
416 |
+
"model.layers.42.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
417 |
+
"model.layers.42.mlp.moe_mlp.experts.weight": "model-00011-of-00013.safetensors",
|
418 |
+
"model.layers.42.mlp.moe_mlp.output_experts.weight": "model-00011-of-00013.safetensors",
|
419 |
+
"model.layers.42.post_attention_layernorm.weight": "model-00011-of-00013.safetensors",
|
420 |
+
"model.layers.42.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
421 |
+
"model.layers.42.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
422 |
+
"model.layers.42.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
423 |
+
"model.layers.42.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
424 |
+
"model.layers.42.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
425 |
+
"model.layers.42.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
426 |
+
"model.layers.43.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
427 |
+
"model.layers.43.mlp.gate.weight": "model-00011-of-00013.safetensors",
|
428 |
+
"model.layers.43.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
429 |
+
"model.layers.43.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
430 |
+
"model.layers.43.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
431 |
+
"model.layers.43.self_attn.k_norm.weight": "model-00011-of-00013.safetensors",
|
432 |
+
"model.layers.43.self_attn.k_proj.weight": "model-00011-of-00013.safetensors",
|
433 |
+
"model.layers.43.self_attn.o_proj.weight": "model-00011-of-00013.safetensors",
|
434 |
+
"model.layers.43.self_attn.q_norm.weight": "model-00011-of-00013.safetensors",
|
435 |
+
"model.layers.43.self_attn.q_proj.weight": "model-00011-of-00013.safetensors",
|
436 |
+
"model.layers.43.self_attn.v_proj.weight": "model-00011-of-00013.safetensors",
|
437 |
+
"model.layers.44.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
438 |
+
"model.layers.44.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
439 |
+
"model.layers.44.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
440 |
+
"model.layers.44.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
441 |
+
"model.layers.44.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
442 |
+
"model.layers.44.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
443 |
+
"model.layers.44.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
444 |
+
"model.layers.44.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
445 |
+
"model.layers.44.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
446 |
+
"model.layers.44.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
447 |
+
"model.layers.44.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
448 |
+
"model.layers.45.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
449 |
+
"model.layers.45.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
450 |
+
"model.layers.45.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
451 |
+
"model.layers.45.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
452 |
+
"model.layers.45.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
453 |
+
"model.layers.45.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
454 |
+
"model.layers.45.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
455 |
+
"model.layers.45.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
456 |
+
"model.layers.45.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
457 |
+
"model.layers.45.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
458 |
+
"model.layers.45.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
459 |
+
"model.layers.46.input_layernorm.weight": "model-00012-of-00013.safetensors",
|
460 |
+
"model.layers.46.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
461 |
+
"model.layers.46.mlp.moe_mlp.experts.weight": "model-00012-of-00013.safetensors",
|
462 |
+
"model.layers.46.mlp.moe_mlp.output_experts.weight": "model-00012-of-00013.safetensors",
|
463 |
+
"model.layers.46.post_attention_layernorm.weight": "model-00012-of-00013.safetensors",
|
464 |
+
"model.layers.46.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
465 |
+
"model.layers.46.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
466 |
+
"model.layers.46.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
467 |
+
"model.layers.46.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
468 |
+
"model.layers.46.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
469 |
+
"model.layers.46.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
470 |
+
"model.layers.47.input_layernorm.weight": "model-00013-of-00013.safetensors",
|
471 |
+
"model.layers.47.mlp.gate.weight": "model-00012-of-00013.safetensors",
|
472 |
+
"model.layers.47.mlp.moe_mlp.experts.weight": "model-00013-of-00013.safetensors",
|
473 |
+
"model.layers.47.mlp.moe_mlp.output_experts.weight": "model-00013-of-00013.safetensors",
|
474 |
+
"model.layers.47.post_attention_layernorm.weight": "model-00013-of-00013.safetensors",
|
475 |
+
"model.layers.47.self_attn.k_norm.weight": "model-00012-of-00013.safetensors",
|
476 |
+
"model.layers.47.self_attn.k_proj.weight": "model-00012-of-00013.safetensors",
|
477 |
+
"model.layers.47.self_attn.o_proj.weight": "model-00012-of-00013.safetensors",
|
478 |
+
"model.layers.47.self_attn.q_norm.weight": "model-00012-of-00013.safetensors",
|
479 |
+
"model.layers.47.self_attn.q_proj.weight": "model-00012-of-00013.safetensors",
|
480 |
+
"model.layers.47.self_attn.v_proj.weight": "model-00012-of-00013.safetensors",
|
481 |
+
"model.layers.5.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
482 |
+
"model.layers.5.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
483 |
+
"model.layers.5.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
484 |
+
"model.layers.5.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
485 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
486 |
+
"model.layers.5.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
487 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
488 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
489 |
+
"model.layers.5.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
490 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
491 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
492 |
+
"model.layers.6.input_layernorm.weight": "model-00002-of-00013.safetensors",
|
493 |
+
"model.layers.6.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
494 |
+
"model.layers.6.mlp.moe_mlp.experts.weight": "model-00002-of-00013.safetensors",
|
495 |
+
"model.layers.6.mlp.moe_mlp.output_experts.weight": "model-00002-of-00013.safetensors",
|
496 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00002-of-00013.safetensors",
|
497 |
+
"model.layers.6.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
498 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
499 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
500 |
+
"model.layers.6.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
501 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
502 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
503 |
+
"model.layers.7.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
504 |
+
"model.layers.7.mlp.gate.weight": "model-00002-of-00013.safetensors",
|
505 |
+
"model.layers.7.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
506 |
+
"model.layers.7.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
507 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
508 |
+
"model.layers.7.self_attn.k_norm.weight": "model-00002-of-00013.safetensors",
|
509 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00002-of-00013.safetensors",
|
510 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00002-of-00013.safetensors",
|
511 |
+
"model.layers.7.self_attn.q_norm.weight": "model-00002-of-00013.safetensors",
|
512 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00002-of-00013.safetensors",
|
513 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00002-of-00013.safetensors",
|
514 |
+
"model.layers.8.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
515 |
+
"model.layers.8.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
516 |
+
"model.layers.8.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
517 |
+
"model.layers.8.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
518 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
519 |
+
"model.layers.8.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
520 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
521 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
522 |
+
"model.layers.8.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
523 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
524 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
525 |
+
"model.layers.9.input_layernorm.weight": "model-00003-of-00013.safetensors",
|
526 |
+
"model.layers.9.mlp.gate.weight": "model-00003-of-00013.safetensors",
|
527 |
+
"model.layers.9.mlp.moe_mlp.experts.weight": "model-00003-of-00013.safetensors",
|
528 |
+
"model.layers.9.mlp.moe_mlp.output_experts.weight": "model-00003-of-00013.safetensors",
|
529 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00003-of-00013.safetensors",
|
530 |
+
"model.layers.9.self_attn.k_norm.weight": "model-00003-of-00013.safetensors",
|
531 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00003-of-00013.safetensors",
|
532 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00003-of-00013.safetensors",
|
533 |
+
"model.layers.9.self_attn.q_norm.weight": "model-00003-of-00013.safetensors",
|
534 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00003-of-00013.safetensors",
|
535 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00003-of-00013.safetensors",
|
536 |
+
"model.norm.weight": "model-00013-of-00013.safetensors"
|
537 |
+
}
|
538 |
+
}
|
modeling_qwen3_shared_moe.py
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_flash_attention_utils import FlashAttentionKwargs
|
24 |
+
from transformers.modeling_outputs import (
|
25 |
+
MoeCausalLMOutputWithPast,
|
26 |
+
MoeModelOutputWithPast,
|
27 |
+
)
|
28 |
+
from transformers.activations import ACT2FN
|
29 |
+
from transformers.processing_utils import Unpack
|
30 |
+
from transformers.utils import (
|
31 |
+
LossKwargs,
|
32 |
+
logging,
|
33 |
+
)
|
34 |
+
from transformers.models.mixtral.modeling_mixtral import (
|
35 |
+
load_balancing_loss_func,
|
36 |
+
)
|
37 |
+
from transformers.models.qwen3_moe.modeling_qwen3_moe import (
|
38 |
+
Qwen3MoeMLP,
|
39 |
+
Qwen3MoeRMSNorm,
|
40 |
+
Qwen3MoeAttention,
|
41 |
+
Qwen3MoeDecoderLayer,
|
42 |
+
Qwen3MoeModel,
|
43 |
+
Qwen3MoeForCausalLM,
|
44 |
+
)
|
45 |
+
from .configuration_qwen3_shared_moe import Qwen3SharedMoeConfig
|
46 |
+
|
47 |
+
import scattermoe
|
48 |
+
|
49 |
+
|
50 |
+
logger = logging.get_logger(__name__)
|
51 |
+
|
52 |
+
|
53 |
+
class Qwen3SharedMoeSparseMoeBlock(nn.Module):
|
54 |
+
def __init__(self, config: Qwen3SharedMoeConfig):
|
55 |
+
super().__init__()
|
56 |
+
self.config = config
|
57 |
+
self.gate = nn.Linear(config.hidden_size, config.num_experts, bias=False)
|
58 |
+
if config.shared_expert_intermediate_size is not None:
|
59 |
+
self.shared_expert = Qwen3MoeMLP(
|
60 |
+
config, intermediate_size=config.shared_expert_intermediate_size
|
61 |
+
)
|
62 |
+
else:
|
63 |
+
self.shared_expert = None
|
64 |
+
self.moe_mlp = scattermoe.mlp.GLUMLP(
|
65 |
+
input_size=self.config.hidden_size,
|
66 |
+
hidden_size=self.config.moe_intermediate_size,
|
67 |
+
num_experts=self.config.num_experts,
|
68 |
+
top_k=self.config.num_experts_per_tok,
|
69 |
+
activation=ACT2FN[config.hidden_act],
|
70 |
+
)
|
71 |
+
|
72 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
73 |
+
# handling of gate/router logits copied from Qwen3MoeSparseMoeBlock
|
74 |
+
batch_size, sequence_length, hidden_dim = hidden_states.shape
|
75 |
+
hidden_states = hidden_states.view(-1, hidden_dim)
|
76 |
+
# router_logits: (batch * sequence_length, n_experts)
|
77 |
+
router_logits = self.gate(hidden_states)
|
78 |
+
|
79 |
+
routing_weights = F.softmax(router_logits, dim=1, dtype=torch.float)
|
80 |
+
routing_weights, selected_experts = torch.topk(
|
81 |
+
routing_weights, self.config.num_experts_per_tok, dim=-1
|
82 |
+
)
|
83 |
+
if self.config.norm_topk_prob: # only diff with mixtral sparse moe block!
|
84 |
+
routing_weights /= routing_weights.sum(dim=-1, keepdim=True)
|
85 |
+
# we cast back to the input dtype
|
86 |
+
routing_weights = routing_weights.to(hidden_states.dtype)
|
87 |
+
|
88 |
+
# modified here to use scattermoe + shared_expert
|
89 |
+
hs_0 = self.moe_mlp(hidden_states, routing_weights, selected_experts)
|
90 |
+
|
91 |
+
if self.shared_expert is not None:
|
92 |
+
shared_res = self.shared_expert(hidden_states)
|
93 |
+
res = hs_0 + shared_res
|
94 |
+
else:
|
95 |
+
res = hs_0
|
96 |
+
res = res.reshape(batch_size, sequence_length, hidden_dim)
|
97 |
+
return res, router_logits
|
98 |
+
|
99 |
+
|
100 |
+
class Qwen3SharedMoeDecoderLayer(Qwen3MoeDecoderLayer, nn.Module):
|
101 |
+
def __init__(self, config: Qwen3SharedMoeConfig, layer_idx: int):
|
102 |
+
super().__init__(config, layer_idx)
|
103 |
+
self.hidden_size = config.hidden_size
|
104 |
+
|
105 |
+
self.self_attn = Qwen3MoeAttention(config, layer_idx)
|
106 |
+
|
107 |
+
if (layer_idx not in config.mlp_only_layers) and (
|
108 |
+
config.num_experts > 0 and (layer_idx + 1) % config.decoder_sparse_step == 0
|
109 |
+
):
|
110 |
+
self.mlp = Qwen3SharedMoeSparseMoeBlock(config)
|
111 |
+
else:
|
112 |
+
self.mlp = Qwen3MoeMLP(config, intermediate_size=config.intermediate_size)
|
113 |
+
|
114 |
+
self.input_layernorm = Qwen3MoeRMSNorm(
|
115 |
+
config.hidden_size, eps=config.rms_norm_eps
|
116 |
+
)
|
117 |
+
self.post_attention_layernorm = Qwen3MoeRMSNorm(
|
118 |
+
config.hidden_size, eps=config.rms_norm_eps
|
119 |
+
)
|
120 |
+
|
121 |
+
|
122 |
+
class Qwen3SharedMoeModel(Qwen3MoeModel):
|
123 |
+
config_class = Qwen3SharedMoeConfig
|
124 |
+
|
125 |
+
def __init__(self, config: Qwen3SharedMoeConfig):
|
126 |
+
super().__init__(config)
|
127 |
+
self.layers = nn.ModuleList(
|
128 |
+
[
|
129 |
+
Qwen3SharedMoeDecoderLayer(config, layer_idx)
|
130 |
+
for layer_idx in range(config.num_hidden_layers)
|
131 |
+
]
|
132 |
+
)
|
133 |
+
|
134 |
+
|
135 |
+
class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs): ...
|
136 |
+
|
137 |
+
|
138 |
+
class Qwen3SharedMoeForCausalLM(Qwen3MoeForCausalLM):
|
139 |
+
config_class = Qwen3SharedMoeConfig
|
140 |
+
|
141 |
+
def __init__(self, config):
|
142 |
+
super().__init__(config)
|
143 |
+
self.model = Qwen3SharedMoeModel(config)
|
144 |
+
self.num_experts = config.num_experts
|
145 |
+
|
146 |
+
def forward(
|
147 |
+
self,
|
148 |
+
input_ids: Optional[torch.LongTensor] = None,
|
149 |
+
attention_mask: Optional[torch.Tensor] = None,
|
150 |
+
position_ids: Optional[torch.LongTensor] = None,
|
151 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
152 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
153 |
+
labels: Optional[torch.LongTensor] = None,
|
154 |
+
use_cache: Optional[bool] = None,
|
155 |
+
output_attentions: Optional[bool] = None,
|
156 |
+
output_hidden_states: Optional[bool] = None,
|
157 |
+
output_router_logits: Optional[bool] = None,
|
158 |
+
cache_position: Optional[torch.LongTensor] = None,
|
159 |
+
logits_to_keep: Union[int, torch.Tensor] = 0,
|
160 |
+
**kwargs: Unpack[KwargsForCausalLM],
|
161 |
+
) -> MoeCausalLMOutputWithPast:
|
162 |
+
r"""
|
163 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
164 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
165 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
166 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
167 |
+
|
168 |
+
logits_to_keep (`int` or `torch.Tensor`, *optional*):
|
169 |
+
If an `int`, compute logits for the last `logits_to_keep` tokens. If `0`, calculate logits for all
|
170 |
+
`input_ids` (special case). Only last token logits are needed for generation, and calculating them only for that
|
171 |
+
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
|
172 |
+
If a `torch.Tensor`, must be 1D corresponding to the indices to keep in the sequence length dimension.
|
173 |
+
This is useful when using packed tensor format (single dimension for batch and sequence length).
|
174 |
+
|
175 |
+
Returns:
|
176 |
+
|
177 |
+
Example:
|
178 |
+
|
179 |
+
```python
|
180 |
+
>>> from transformers import AutoTokenizer, Qwen3MoeForCausalLM
|
181 |
+
|
182 |
+
>>> model = Qwen3MoeForCausalLM.from_pretrained("Qwen/Qwen3-MoE-15B-A2B")
|
183 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-MoE-15B-A2B")
|
184 |
+
|
185 |
+
>>> prompt = "Hey, are you conscious? Can you talk to me?"
|
186 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
187 |
+
|
188 |
+
>>> # Generate
|
189 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
190 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
191 |
+
"Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
|
192 |
+
```"""
|
193 |
+
|
194 |
+
output_attentions = (
|
195 |
+
output_attentions
|
196 |
+
if output_attentions is not None
|
197 |
+
else self.config.output_attentions
|
198 |
+
)
|
199 |
+
output_router_logits = (
|
200 |
+
output_router_logits
|
201 |
+
if output_router_logits is not None
|
202 |
+
else self.config.output_router_logits
|
203 |
+
)
|
204 |
+
|
205 |
+
output_hidden_states = (
|
206 |
+
output_hidden_states
|
207 |
+
if output_hidden_states is not None
|
208 |
+
else self.config.output_hidden_states
|
209 |
+
)
|
210 |
+
|
211 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
212 |
+
outputs: MoeModelOutputWithPast = self.model(
|
213 |
+
input_ids=input_ids,
|
214 |
+
attention_mask=attention_mask,
|
215 |
+
position_ids=position_ids,
|
216 |
+
past_key_values=past_key_values,
|
217 |
+
inputs_embeds=inputs_embeds,
|
218 |
+
use_cache=use_cache,
|
219 |
+
output_attentions=output_attentions,
|
220 |
+
output_hidden_states=output_hidden_states,
|
221 |
+
output_router_logits=output_router_logits,
|
222 |
+
cache_position=cache_position,
|
223 |
+
**kwargs,
|
224 |
+
)
|
225 |
+
|
226 |
+
hidden_states = outputs.last_hidden_state
|
227 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
228 |
+
slice_indices = (
|
229 |
+
slice(-logits_to_keep, None)
|
230 |
+
if isinstance(logits_to_keep, int)
|
231 |
+
else logits_to_keep
|
232 |
+
)
|
233 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
234 |
+
|
235 |
+
loss = None
|
236 |
+
if labels is not None:
|
237 |
+
loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
|
238 |
+
|
239 |
+
aux_loss = None
|
240 |
+
if output_router_logits:
|
241 |
+
aux_loss = load_balancing_loss_func(
|
242 |
+
outputs.router_logits,
|
243 |
+
self.num_experts,
|
244 |
+
self.num_experts_per_tok,
|
245 |
+
attention_mask,
|
246 |
+
)
|
247 |
+
if labels is not None:
|
248 |
+
loss += self.router_aux_loss_coef * aux_loss.to(
|
249 |
+
loss.device
|
250 |
+
) # make sure to reside in the same device
|
251 |
+
|
252 |
+
return MoeCausalLMOutputWithPast(
|
253 |
+
loss=loss,
|
254 |
+
aux_loss=aux_loss,
|
255 |
+
logits=logits,
|
256 |
+
past_key_values=outputs.past_key_values,
|
257 |
+
hidden_states=outputs.hidden_states,
|
258 |
+
attentions=outputs.attentions,
|
259 |
+
router_logits=outputs.router_logits,
|
260 |
+
)
|
261 |
+
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
|
3 |
+
size 11422654
|
tokenizer_config.json
ADDED
@@ -0,0 +1,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": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}",
|
230 |
+
"clean_up_tokenization_spaces": false,
|
231 |
+
"eos_token": "<|im_end|>",
|
232 |
+
"errors": "replace",
|
233 |
+
"model_max_length": 262144,
|
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
|
|