dev7halo commited on
Commit
14742ae
·
verified ·
1 Parent(s): 4e1c3c7

Upload KORMoMoeForCausalLM

Browse files
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags: []
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+ This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "KORMoMoeForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_kormo_moe.KORMoMoeConfig",
9
+ "AutoModelForCausalLM": "modeling_kormo_moe.KORMoMoeForCausalLM"
10
+ },
11
+ "bos_token_id": 125030,
12
+ "decoder_sparse_step": 1,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 125040,
15
+ "head_dim": 128,
16
+ "hidden_act": "silu",
17
+ "hidden_size": 4096,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 16384,
20
+ "mask_type": null,
21
+ "max_position_embeddings": 131072,
22
+ "mlp_bias": false,
23
+ "model_type": "kormo_moe",
24
+ "moe_intermediate_size": 16384,
25
+ "norm_topk_prob": true,
26
+ "num_attention_heads": 32,
27
+ "num_experts": 2,
28
+ "num_experts_per_tok": 2,
29
+ "num_hidden_layers": 40,
30
+ "num_key_value_heads": 8,
31
+ "pad_token_id": 125032,
32
+ "pretrain_tp": 1,
33
+ "pretraining_tp": 1,
34
+ "rms_norm_eps": 1e-05,
35
+ "rope_scaling": null,
36
+ "rope_theta": 8000000.0,
37
+ "shared_expert_intermediate_size": null,
38
+ "tie_word_embeddings": false,
39
+ "tie_word_embeddins": false,
40
+ "transformers_version": "4.57.0",
41
+ "use_cache": true,
42
+ "vocab_size": 125184
43
+ }
configuration_kormo_moe.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # <저장된_모델_경로>/configuration_kormo_moe.py
2
+
3
+ from transformers import PretrainedConfig
4
+ from transformers.modeling_rope_utils import rope_config_validation
5
+
6
+
7
+ class KORMoMoeConfig(PretrainedConfig):
8
+ model_type = "kormo_moe"
9
+ keys_to_ignore_at_inference = ["past_key_values"]
10
+
11
+ def __init__(
12
+ self,
13
+ vocab_size=112576,
14
+ hidden_size=6144,
15
+ intermediate_size=21504,
16
+ num_hidden_layers=48,
17
+ num_attention_heads=40,
18
+ num_key_value_heads=8,
19
+ hidden_act="silu",
20
+ max_position_embeddings=131072,
21
+ initializer_range=0.02,
22
+ rms_norm_eps=1e-05,
23
+ use_cache=True,
24
+ pad_token_id=None,
25
+ bos_token_id=0,
26
+ eos_token_id=1,
27
+ pretraining_tp=1,
28
+ tie_word_embeddings=False,
29
+ rope_theta=500000.0,
30
+ attention_bias=False,
31
+ attention_dropout=0.0,
32
+ rope_scaling=None,
33
+ mlp_bias=False,
34
+ head_dim=128,
35
+ # MoE specific
36
+ num_experts=2,
37
+ num_experts_per_tok=2,
38
+ moe_intermediate_size=None,
39
+ shared_expert_intermediate_size=None,
40
+ norm_topk_prob=True,
41
+ decoder_sparse_step=1,
42
+ **kwargs,
43
+ ):
44
+ self.vocab_size = vocab_size
45
+ self.max_position_embeddings = max_position_embeddings
46
+ self.hidden_size = hidden_size
47
+ self.intermediate_size = intermediate_size
48
+ self.num_hidden_layers = num_hidden_layers
49
+ self.num_attention_heads = num_attention_heads
50
+
51
+ if num_key_value_heads is None:
52
+ num_key_value_heads = num_attention_heads
53
+
54
+ self.num_key_value_heads = num_key_value_heads
55
+ self.hidden_act = hidden_act
56
+ self.initializer_range = initializer_range
57
+ self.rms_norm_eps = rms_norm_eps
58
+ self.pretraining_tp = pretraining_tp
59
+ self.use_cache = use_cache
60
+ self.rope_theta = rope_theta
61
+ self.rope_scaling = rope_scaling
62
+ self.attention_bias = attention_bias
63
+ self.attention_dropout = attention_dropout
64
+ self.mlp_bias = mlp_bias
65
+ self.head_dim = head_dim if head_dim is not None else self.hidden_size // self.num_attention_heads
66
+ self.mask_type = None
67
+
68
+ # MoE specific
69
+ self.num_experts = num_experts
70
+ self.num_experts_per_tok = num_experts_per_tok
71
+ self.moe_intermediate_size = moe_intermediate_size if moe_intermediate_size is not None else intermediate_size
72
+ self.shared_expert_intermediate_size = shared_expert_intermediate_size
73
+ self.norm_topk_prob = norm_topk_prob
74
+ self.decoder_sparse_step = decoder_sparse_step
75
+
76
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
77
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
78
+ rope_config_validation(self)
79
+
80
+ super().__init__(
81
+ pad_token_id=pad_token_id,
82
+ bos_token_id=bos_token_id,
83
+ eos_token_id=eos_token_id,
84
+ tie_word_embeddings=tie_word_embeddings,
85
+ **kwargs,
86
+ )
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 125030,
4
+ "eos_token_id": 125040,
5
+ "pad_token_id": 125032,
6
+ "transformers_version": "4.57.0"
7
+ }
model-00001-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c1dfa9cefb050062dba0d9a2dada46857381a60c7ca3f3acfdf60e6f009d139
3
+ size 4934753320
model-00002-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91f3d80afe8bc8aabb757f98e27055b44edf75729182932cb7cd3a4bedc283ca
3
+ size 4983021920
model-00003-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b16a41b26b9f43f3d75bf093ce58877a9704b028aa03e732fe3628de7b0dea8f
3
+ size 4932690560
model-00004-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f7021347a7d01814ed0dfad2802cbae0ff7f08631c3744654677991952349a9
3
+ size 4932707184
model-00005-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e44ed78f1682fb3ef95b784aeebe7faae8a670c2b6b8c1d04f074a51695dbe4c
3
+ size 4983005368
model-00006-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9acc30f653240e4445f17dd01f2bbd032a204628a7cd3932360f7e92e7a38c5
3
+ size 4932707184
model-00007-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b56a5a079335c2573b0e74e5e14b4f8997c71f7a051171dc7ffaa03a5ca3a7fa
3
+ size 4983005368
model-00008-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6aa028f48047eb405328ee1fba2f346c6e2511c060788424fd0484089eb55446
3
+ size 2938203792
model.safetensors.index.json ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 18810015744,
4
+ "total_size": 37620031488
5
+ },
6
+ "weight_map": {
7
+ "lm_head.weight": "model-00008-of-00008.safetensors",
8
+ "model.embed_tokens.weight": "model-00001-of-00008.safetensors",
9
+ "model.layers.0.mlp.experts.0.down_proj.weight": "model-00001-of-00008.safetensors",
10
+ "model.layers.0.mlp.experts.0.gate_proj.weight": "model-00001-of-00008.safetensors",
11
+ "model.layers.0.mlp.experts.0.up_proj.weight": "model-00001-of-00008.safetensors",
12
+ "model.layers.0.mlp.experts.1.down_proj.weight": "model-00001-of-00008.safetensors",
13
+ "model.layers.0.mlp.experts.1.gate_proj.weight": "model-00001-of-00008.safetensors",
14
+ "model.layers.0.mlp.experts.1.up_proj.weight": "model-00001-of-00008.safetensors",
15
+ "model.layers.0.mlp.gate.linear.weight": "model-00001-of-00008.safetensors",
16
+ "model.layers.0.pre_attention_layernorm.weight": "model-00001-of-00008.safetensors",
17
+ "model.layers.0.pre_mlp_layernorm.weight": "model-00001-of-00008.safetensors",
18
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
19
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
20
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
21
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
22
+ "model.layers.1.mlp.experts.0.down_proj.weight": "model-00001-of-00008.safetensors",
23
+ "model.layers.1.mlp.experts.0.gate_proj.weight": "model-00001-of-00008.safetensors",
24
+ "model.layers.1.mlp.experts.0.up_proj.weight": "model-00001-of-00008.safetensors",
25
+ "model.layers.1.mlp.experts.1.down_proj.weight": "model-00001-of-00008.safetensors",
26
+ "model.layers.1.mlp.experts.1.gate_proj.weight": "model-00001-of-00008.safetensors",
27
+ "model.layers.1.mlp.experts.1.up_proj.weight": "model-00001-of-00008.safetensors",
28
+ "model.layers.1.mlp.gate.linear.weight": "model-00001-of-00008.safetensors",
29
+ "model.layers.1.pre_attention_layernorm.weight": "model-00001-of-00008.safetensors",
30
+ "model.layers.1.pre_mlp_layernorm.weight": "model-00001-of-00008.safetensors",
31
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
32
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
33
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
34
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
35
+ "model.layers.10.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
36
+ "model.layers.10.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
37
+ "model.layers.10.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
38
+ "model.layers.10.mlp.experts.1.down_proj.weight": "model-00003-of-00008.safetensors",
39
+ "model.layers.10.mlp.experts.1.gate_proj.weight": "model-00003-of-00008.safetensors",
40
+ "model.layers.10.mlp.experts.1.up_proj.weight": "model-00003-of-00008.safetensors",
41
+ "model.layers.10.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
42
+ "model.layers.10.pre_attention_layernorm.weight": "model-00003-of-00008.safetensors",
43
+ "model.layers.10.pre_mlp_layernorm.weight": "model-00003-of-00008.safetensors",
44
+ "model.layers.10.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
45
+ "model.layers.10.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
46
+ "model.layers.10.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
47
+ "model.layers.10.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
48
+ "model.layers.11.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
49
+ "model.layers.11.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
50
+ "model.layers.11.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
51
+ "model.layers.11.mlp.experts.1.down_proj.weight": "model-00003-of-00008.safetensors",
52
+ "model.layers.11.mlp.experts.1.gate_proj.weight": "model-00003-of-00008.safetensors",
53
+ "model.layers.11.mlp.experts.1.up_proj.weight": "model-00003-of-00008.safetensors",
54
+ "model.layers.11.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
55
+ "model.layers.11.pre_attention_layernorm.weight": "model-00003-of-00008.safetensors",
56
+ "model.layers.11.pre_mlp_layernorm.weight": "model-00003-of-00008.safetensors",
57
+ "model.layers.11.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
58
+ "model.layers.11.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
59
+ "model.layers.11.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
60
+ "model.layers.11.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
61
+ "model.layers.12.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
62
+ "model.layers.12.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
63
+ "model.layers.12.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
64
+ "model.layers.12.mlp.experts.1.down_proj.weight": "model-00003-of-00008.safetensors",
65
+ "model.layers.12.mlp.experts.1.gate_proj.weight": "model-00003-of-00008.safetensors",
66
+ "model.layers.12.mlp.experts.1.up_proj.weight": "model-00003-of-00008.safetensors",
67
+ "model.layers.12.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
68
+ "model.layers.12.pre_attention_layernorm.weight": "model-00003-of-00008.safetensors",
69
+ "model.layers.12.pre_mlp_layernorm.weight": "model-00003-of-00008.safetensors",
70
+ "model.layers.12.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
71
+ "model.layers.12.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
72
+ "model.layers.12.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
73
+ "model.layers.12.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
74
+ "model.layers.13.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
75
+ "model.layers.13.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
76
+ "model.layers.13.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
77
+ "model.layers.13.mlp.experts.1.down_proj.weight": "model-00003-of-00008.safetensors",
78
+ "model.layers.13.mlp.experts.1.gate_proj.weight": "model-00003-of-00008.safetensors",
79
+ "model.layers.13.mlp.experts.1.up_proj.weight": "model-00003-of-00008.safetensors",
80
+ "model.layers.13.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
81
+ "model.layers.13.pre_attention_layernorm.weight": "model-00003-of-00008.safetensors",
82
+ "model.layers.13.pre_mlp_layernorm.weight": "model-00003-of-00008.safetensors",
83
+ "model.layers.13.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
84
+ "model.layers.13.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
85
+ "model.layers.13.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
86
+ "model.layers.13.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
87
+ "model.layers.14.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
88
+ "model.layers.14.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
89
+ "model.layers.14.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
90
+ "model.layers.14.mlp.experts.1.down_proj.weight": "model-00003-of-00008.safetensors",
91
+ "model.layers.14.mlp.experts.1.gate_proj.weight": "model-00003-of-00008.safetensors",
92
+ "model.layers.14.mlp.experts.1.up_proj.weight": "model-00003-of-00008.safetensors",
93
+ "model.layers.14.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
94
+ "model.layers.14.pre_attention_layernorm.weight": "model-00003-of-00008.safetensors",
95
+ "model.layers.14.pre_mlp_layernorm.weight": "model-00003-of-00008.safetensors",
96
+ "model.layers.14.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
97
+ "model.layers.14.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
98
+ "model.layers.14.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
99
+ "model.layers.14.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
100
+ "model.layers.15.mlp.experts.0.down_proj.weight": "model-00003-of-00008.safetensors",
101
+ "model.layers.15.mlp.experts.0.gate_proj.weight": "model-00003-of-00008.safetensors",
102
+ "model.layers.15.mlp.experts.0.up_proj.weight": "model-00003-of-00008.safetensors",
103
+ "model.layers.15.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
104
+ "model.layers.15.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
105
+ "model.layers.15.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
106
+ "model.layers.15.mlp.gate.linear.weight": "model-00003-of-00008.safetensors",
107
+ "model.layers.15.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
108
+ "model.layers.15.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
109
+ "model.layers.15.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
110
+ "model.layers.15.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
111
+ "model.layers.15.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
112
+ "model.layers.15.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
113
+ "model.layers.16.mlp.experts.0.down_proj.weight": "model-00004-of-00008.safetensors",
114
+ "model.layers.16.mlp.experts.0.gate_proj.weight": "model-00004-of-00008.safetensors",
115
+ "model.layers.16.mlp.experts.0.up_proj.weight": "model-00004-of-00008.safetensors",
116
+ "model.layers.16.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
117
+ "model.layers.16.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
118
+ "model.layers.16.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
119
+ "model.layers.16.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
120
+ "model.layers.16.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
121
+ "model.layers.16.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
122
+ "model.layers.16.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
123
+ "model.layers.16.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
124
+ "model.layers.16.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
125
+ "model.layers.16.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
126
+ "model.layers.17.mlp.experts.0.down_proj.weight": "model-00004-of-00008.safetensors",
127
+ "model.layers.17.mlp.experts.0.gate_proj.weight": "model-00004-of-00008.safetensors",
128
+ "model.layers.17.mlp.experts.0.up_proj.weight": "model-00004-of-00008.safetensors",
129
+ "model.layers.17.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
130
+ "model.layers.17.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
131
+ "model.layers.17.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
132
+ "model.layers.17.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
133
+ "model.layers.17.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
134
+ "model.layers.17.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
135
+ "model.layers.17.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
136
+ "model.layers.17.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
137
+ "model.layers.17.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
138
+ "model.layers.17.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
139
+ "model.layers.18.mlp.experts.0.down_proj.weight": "model-00004-of-00008.safetensors",
140
+ "model.layers.18.mlp.experts.0.gate_proj.weight": "model-00004-of-00008.safetensors",
141
+ "model.layers.18.mlp.experts.0.up_proj.weight": "model-00004-of-00008.safetensors",
142
+ "model.layers.18.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
143
+ "model.layers.18.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
144
+ "model.layers.18.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
145
+ "model.layers.18.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
146
+ "model.layers.18.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
147
+ "model.layers.18.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
148
+ "model.layers.18.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
149
+ "model.layers.18.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
150
+ "model.layers.18.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
151
+ "model.layers.18.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
152
+ "model.layers.19.mlp.experts.0.down_proj.weight": "model-00004-of-00008.safetensors",
153
+ "model.layers.19.mlp.experts.0.gate_proj.weight": "model-00004-of-00008.safetensors",
154
+ "model.layers.19.mlp.experts.0.up_proj.weight": "model-00004-of-00008.safetensors",
155
+ "model.layers.19.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
156
+ "model.layers.19.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
157
+ "model.layers.19.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
158
+ "model.layers.19.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
159
+ "model.layers.19.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
160
+ "model.layers.19.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
161
+ "model.layers.19.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
162
+ "model.layers.19.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
163
+ "model.layers.19.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
164
+ "model.layers.19.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
165
+ "model.layers.2.mlp.experts.0.down_proj.weight": "model-00001-of-00008.safetensors",
166
+ "model.layers.2.mlp.experts.0.gate_proj.weight": "model-00001-of-00008.safetensors",
167
+ "model.layers.2.mlp.experts.0.up_proj.weight": "model-00001-of-00008.safetensors",
168
+ "model.layers.2.mlp.experts.1.down_proj.weight": "model-00001-of-00008.safetensors",
169
+ "model.layers.2.mlp.experts.1.gate_proj.weight": "model-00001-of-00008.safetensors",
170
+ "model.layers.2.mlp.experts.1.up_proj.weight": "model-00001-of-00008.safetensors",
171
+ "model.layers.2.mlp.gate.linear.weight": "model-00001-of-00008.safetensors",
172
+ "model.layers.2.pre_attention_layernorm.weight": "model-00001-of-00008.safetensors",
173
+ "model.layers.2.pre_mlp_layernorm.weight": "model-00001-of-00008.safetensors",
174
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
175
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
176
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
177
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
178
+ "model.layers.20.mlp.experts.0.down_proj.weight": "model-00004-of-00008.safetensors",
179
+ "model.layers.20.mlp.experts.0.gate_proj.weight": "model-00004-of-00008.safetensors",
180
+ "model.layers.20.mlp.experts.0.up_proj.weight": "model-00004-of-00008.safetensors",
181
+ "model.layers.20.mlp.experts.1.down_proj.weight": "model-00004-of-00008.safetensors",
182
+ "model.layers.20.mlp.experts.1.gate_proj.weight": "model-00004-of-00008.safetensors",
183
+ "model.layers.20.mlp.experts.1.up_proj.weight": "model-00004-of-00008.safetensors",
184
+ "model.layers.20.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
185
+ "model.layers.20.pre_attention_layernorm.weight": "model-00004-of-00008.safetensors",
186
+ "model.layers.20.pre_mlp_layernorm.weight": "model-00004-of-00008.safetensors",
187
+ "model.layers.20.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
188
+ "model.layers.20.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
189
+ "model.layers.20.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
190
+ "model.layers.20.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
191
+ "model.layers.21.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
192
+ "model.layers.21.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
193
+ "model.layers.21.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
194
+ "model.layers.21.mlp.experts.1.down_proj.weight": "model-00005-of-00008.safetensors",
195
+ "model.layers.21.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
196
+ "model.layers.21.mlp.experts.1.up_proj.weight": "model-00005-of-00008.safetensors",
197
+ "model.layers.21.mlp.gate.linear.weight": "model-00004-of-00008.safetensors",
198
+ "model.layers.21.pre_attention_layernorm.weight": "model-00005-of-00008.safetensors",
199
+ "model.layers.21.pre_mlp_layernorm.weight": "model-00005-of-00008.safetensors",
200
+ "model.layers.21.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
201
+ "model.layers.21.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
202
+ "model.layers.21.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
203
+ "model.layers.21.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
204
+ "model.layers.22.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
205
+ "model.layers.22.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
206
+ "model.layers.22.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
207
+ "model.layers.22.mlp.experts.1.down_proj.weight": "model-00005-of-00008.safetensors",
208
+ "model.layers.22.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
209
+ "model.layers.22.mlp.experts.1.up_proj.weight": "model-00005-of-00008.safetensors",
210
+ "model.layers.22.mlp.gate.linear.weight": "model-00005-of-00008.safetensors",
211
+ "model.layers.22.pre_attention_layernorm.weight": "model-00005-of-00008.safetensors",
212
+ "model.layers.22.pre_mlp_layernorm.weight": "model-00005-of-00008.safetensors",
213
+ "model.layers.22.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
214
+ "model.layers.22.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
215
+ "model.layers.22.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
216
+ "model.layers.22.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
217
+ "model.layers.23.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
218
+ "model.layers.23.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
219
+ "model.layers.23.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
220
+ "model.layers.23.mlp.experts.1.down_proj.weight": "model-00005-of-00008.safetensors",
221
+ "model.layers.23.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
222
+ "model.layers.23.mlp.experts.1.up_proj.weight": "model-00005-of-00008.safetensors",
223
+ "model.layers.23.mlp.gate.linear.weight": "model-00005-of-00008.safetensors",
224
+ "model.layers.23.pre_attention_layernorm.weight": "model-00005-of-00008.safetensors",
225
+ "model.layers.23.pre_mlp_layernorm.weight": "model-00005-of-00008.safetensors",
226
+ "model.layers.23.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
227
+ "model.layers.23.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
228
+ "model.layers.23.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
229
+ "model.layers.23.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
230
+ "model.layers.24.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
231
+ "model.layers.24.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
232
+ "model.layers.24.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
233
+ "model.layers.24.mlp.experts.1.down_proj.weight": "model-00005-of-00008.safetensors",
234
+ "model.layers.24.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
235
+ "model.layers.24.mlp.experts.1.up_proj.weight": "model-00005-of-00008.safetensors",
236
+ "model.layers.24.mlp.gate.linear.weight": "model-00005-of-00008.safetensors",
237
+ "model.layers.24.pre_attention_layernorm.weight": "model-00005-of-00008.safetensors",
238
+ "model.layers.24.pre_mlp_layernorm.weight": "model-00005-of-00008.safetensors",
239
+ "model.layers.24.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
240
+ "model.layers.24.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
241
+ "model.layers.24.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
242
+ "model.layers.24.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
243
+ "model.layers.25.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
244
+ "model.layers.25.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
245
+ "model.layers.25.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
246
+ "model.layers.25.mlp.experts.1.down_proj.weight": "model-00005-of-00008.safetensors",
247
+ "model.layers.25.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
248
+ "model.layers.25.mlp.experts.1.up_proj.weight": "model-00005-of-00008.safetensors",
249
+ "model.layers.25.mlp.gate.linear.weight": "model-00005-of-00008.safetensors",
250
+ "model.layers.25.pre_attention_layernorm.weight": "model-00005-of-00008.safetensors",
251
+ "model.layers.25.pre_mlp_layernorm.weight": "model-00005-of-00008.safetensors",
252
+ "model.layers.25.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
253
+ "model.layers.25.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
254
+ "model.layers.25.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
255
+ "model.layers.25.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
256
+ "model.layers.26.mlp.experts.0.down_proj.weight": "model-00005-of-00008.safetensors",
257
+ "model.layers.26.mlp.experts.0.gate_proj.weight": "model-00005-of-00008.safetensors",
258
+ "model.layers.26.mlp.experts.0.up_proj.weight": "model-00005-of-00008.safetensors",
259
+ "model.layers.26.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
260
+ "model.layers.26.mlp.experts.1.gate_proj.weight": "model-00005-of-00008.safetensors",
261
+ "model.layers.26.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
262
+ "model.layers.26.mlp.gate.linear.weight": "model-00005-of-00008.safetensors",
263
+ "model.layers.26.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
264
+ "model.layers.26.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
265
+ "model.layers.26.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
266
+ "model.layers.26.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
267
+ "model.layers.26.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
268
+ "model.layers.26.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
269
+ "model.layers.27.mlp.experts.0.down_proj.weight": "model-00006-of-00008.safetensors",
270
+ "model.layers.27.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
271
+ "model.layers.27.mlp.experts.0.up_proj.weight": "model-00006-of-00008.safetensors",
272
+ "model.layers.27.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
273
+ "model.layers.27.mlp.experts.1.gate_proj.weight": "model-00006-of-00008.safetensors",
274
+ "model.layers.27.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
275
+ "model.layers.27.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
276
+ "model.layers.27.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
277
+ "model.layers.27.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
278
+ "model.layers.27.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
279
+ "model.layers.27.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
280
+ "model.layers.27.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
281
+ "model.layers.27.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
282
+ "model.layers.28.mlp.experts.0.down_proj.weight": "model-00006-of-00008.safetensors",
283
+ "model.layers.28.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
284
+ "model.layers.28.mlp.experts.0.up_proj.weight": "model-00006-of-00008.safetensors",
285
+ "model.layers.28.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
286
+ "model.layers.28.mlp.experts.1.gate_proj.weight": "model-00006-of-00008.safetensors",
287
+ "model.layers.28.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
288
+ "model.layers.28.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
289
+ "model.layers.28.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
290
+ "model.layers.28.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
291
+ "model.layers.28.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
292
+ "model.layers.28.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
293
+ "model.layers.28.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
294
+ "model.layers.28.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
295
+ "model.layers.29.mlp.experts.0.down_proj.weight": "model-00006-of-00008.safetensors",
296
+ "model.layers.29.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
297
+ "model.layers.29.mlp.experts.0.up_proj.weight": "model-00006-of-00008.safetensors",
298
+ "model.layers.29.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
299
+ "model.layers.29.mlp.experts.1.gate_proj.weight": "model-00006-of-00008.safetensors",
300
+ "model.layers.29.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
301
+ "model.layers.29.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
302
+ "model.layers.29.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
303
+ "model.layers.29.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
304
+ "model.layers.29.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
305
+ "model.layers.29.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
306
+ "model.layers.29.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
307
+ "model.layers.29.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
308
+ "model.layers.3.mlp.experts.0.down_proj.weight": "model-00001-of-00008.safetensors",
309
+ "model.layers.3.mlp.experts.0.gate_proj.weight": "model-00001-of-00008.safetensors",
310
+ "model.layers.3.mlp.experts.0.up_proj.weight": "model-00001-of-00008.safetensors",
311
+ "model.layers.3.mlp.experts.1.down_proj.weight": "model-00001-of-00008.safetensors",
312
+ "model.layers.3.mlp.experts.1.gate_proj.weight": "model-00001-of-00008.safetensors",
313
+ "model.layers.3.mlp.experts.1.up_proj.weight": "model-00001-of-00008.safetensors",
314
+ "model.layers.3.mlp.gate.linear.weight": "model-00001-of-00008.safetensors",
315
+ "model.layers.3.pre_attention_layernorm.weight": "model-00001-of-00008.safetensors",
316
+ "model.layers.3.pre_mlp_layernorm.weight": "model-00001-of-00008.safetensors",
317
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
318
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
319
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
320
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
321
+ "model.layers.30.mlp.experts.0.down_proj.weight": "model-00006-of-00008.safetensors",
322
+ "model.layers.30.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
323
+ "model.layers.30.mlp.experts.0.up_proj.weight": "model-00006-of-00008.safetensors",
324
+ "model.layers.30.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
325
+ "model.layers.30.mlp.experts.1.gate_proj.weight": "model-00006-of-00008.safetensors",
326
+ "model.layers.30.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
327
+ "model.layers.30.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
328
+ "model.layers.30.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
329
+ "model.layers.30.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
330
+ "model.layers.30.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
331
+ "model.layers.30.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
332
+ "model.layers.30.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
333
+ "model.layers.30.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
334
+ "model.layers.31.mlp.experts.0.down_proj.weight": "model-00006-of-00008.safetensors",
335
+ "model.layers.31.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
336
+ "model.layers.31.mlp.experts.0.up_proj.weight": "model-00006-of-00008.safetensors",
337
+ "model.layers.31.mlp.experts.1.down_proj.weight": "model-00006-of-00008.safetensors",
338
+ "model.layers.31.mlp.experts.1.gate_proj.weight": "model-00006-of-00008.safetensors",
339
+ "model.layers.31.mlp.experts.1.up_proj.weight": "model-00006-of-00008.safetensors",
340
+ "model.layers.31.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
341
+ "model.layers.31.pre_attention_layernorm.weight": "model-00006-of-00008.safetensors",
342
+ "model.layers.31.pre_mlp_layernorm.weight": "model-00006-of-00008.safetensors",
343
+ "model.layers.31.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
344
+ "model.layers.31.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
345
+ "model.layers.31.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
346
+ "model.layers.31.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
347
+ "model.layers.32.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
348
+ "model.layers.32.mlp.experts.0.gate_proj.weight": "model-00006-of-00008.safetensors",
349
+ "model.layers.32.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
350
+ "model.layers.32.mlp.experts.1.down_proj.weight": "model-00007-of-00008.safetensors",
351
+ "model.layers.32.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
352
+ "model.layers.32.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
353
+ "model.layers.32.mlp.gate.linear.weight": "model-00006-of-00008.safetensors",
354
+ "model.layers.32.pre_attention_layernorm.weight": "model-00007-of-00008.safetensors",
355
+ "model.layers.32.pre_mlp_layernorm.weight": "model-00007-of-00008.safetensors",
356
+ "model.layers.32.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
357
+ "model.layers.32.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
358
+ "model.layers.32.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
359
+ "model.layers.32.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
360
+ "model.layers.33.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
361
+ "model.layers.33.mlp.experts.0.gate_proj.weight": "model-00007-of-00008.safetensors",
362
+ "model.layers.33.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
363
+ "model.layers.33.mlp.experts.1.down_proj.weight": "model-00007-of-00008.safetensors",
364
+ "model.layers.33.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
365
+ "model.layers.33.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
366
+ "model.layers.33.mlp.gate.linear.weight": "model-00007-of-00008.safetensors",
367
+ "model.layers.33.pre_attention_layernorm.weight": "model-00007-of-00008.safetensors",
368
+ "model.layers.33.pre_mlp_layernorm.weight": "model-00007-of-00008.safetensors",
369
+ "model.layers.33.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
370
+ "model.layers.33.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
371
+ "model.layers.33.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
372
+ "model.layers.33.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
373
+ "model.layers.34.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
374
+ "model.layers.34.mlp.experts.0.gate_proj.weight": "model-00007-of-00008.safetensors",
375
+ "model.layers.34.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
376
+ "model.layers.34.mlp.experts.1.down_proj.weight": "model-00007-of-00008.safetensors",
377
+ "model.layers.34.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
378
+ "model.layers.34.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
379
+ "model.layers.34.mlp.gate.linear.weight": "model-00007-of-00008.safetensors",
380
+ "model.layers.34.pre_attention_layernorm.weight": "model-00007-of-00008.safetensors",
381
+ "model.layers.34.pre_mlp_layernorm.weight": "model-00007-of-00008.safetensors",
382
+ "model.layers.34.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
383
+ "model.layers.34.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
384
+ "model.layers.34.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
385
+ "model.layers.34.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
386
+ "model.layers.35.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
387
+ "model.layers.35.mlp.experts.0.gate_proj.weight": "model-00007-of-00008.safetensors",
388
+ "model.layers.35.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
389
+ "model.layers.35.mlp.experts.1.down_proj.weight": "model-00007-of-00008.safetensors",
390
+ "model.layers.35.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
391
+ "model.layers.35.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
392
+ "model.layers.35.mlp.gate.linear.weight": "model-00007-of-00008.safetensors",
393
+ "model.layers.35.pre_attention_layernorm.weight": "model-00007-of-00008.safetensors",
394
+ "model.layers.35.pre_mlp_layernorm.weight": "model-00007-of-00008.safetensors",
395
+ "model.layers.35.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
396
+ "model.layers.35.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
397
+ "model.layers.35.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
398
+ "model.layers.35.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
399
+ "model.layers.36.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
400
+ "model.layers.36.mlp.experts.0.gate_proj.weight": "model-00007-of-00008.safetensors",
401
+ "model.layers.36.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
402
+ "model.layers.36.mlp.experts.1.down_proj.weight": "model-00007-of-00008.safetensors",
403
+ "model.layers.36.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
404
+ "model.layers.36.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
405
+ "model.layers.36.mlp.gate.linear.weight": "model-00007-of-00008.safetensors",
406
+ "model.layers.36.pre_attention_layernorm.weight": "model-00007-of-00008.safetensors",
407
+ "model.layers.36.pre_mlp_layernorm.weight": "model-00007-of-00008.safetensors",
408
+ "model.layers.36.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
409
+ "model.layers.36.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
410
+ "model.layers.36.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
411
+ "model.layers.36.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
412
+ "model.layers.37.mlp.experts.0.down_proj.weight": "model-00007-of-00008.safetensors",
413
+ "model.layers.37.mlp.experts.0.gate_proj.weight": "model-00007-of-00008.safetensors",
414
+ "model.layers.37.mlp.experts.0.up_proj.weight": "model-00007-of-00008.safetensors",
415
+ "model.layers.37.mlp.experts.1.down_proj.weight": "model-00008-of-00008.safetensors",
416
+ "model.layers.37.mlp.experts.1.gate_proj.weight": "model-00007-of-00008.safetensors",
417
+ "model.layers.37.mlp.experts.1.up_proj.weight": "model-00007-of-00008.safetensors",
418
+ "model.layers.37.mlp.gate.linear.weight": "model-00007-of-00008.safetensors",
419
+ "model.layers.37.pre_attention_layernorm.weight": "model-00008-of-00008.safetensors",
420
+ "model.layers.37.pre_mlp_layernorm.weight": "model-00008-of-00008.safetensors",
421
+ "model.layers.37.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
422
+ "model.layers.37.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
423
+ "model.layers.37.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
424
+ "model.layers.37.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
425
+ "model.layers.38.mlp.experts.0.down_proj.weight": "model-00008-of-00008.safetensors",
426
+ "model.layers.38.mlp.experts.0.gate_proj.weight": "model-00008-of-00008.safetensors",
427
+ "model.layers.38.mlp.experts.0.up_proj.weight": "model-00008-of-00008.safetensors",
428
+ "model.layers.38.mlp.experts.1.down_proj.weight": "model-00008-of-00008.safetensors",
429
+ "model.layers.38.mlp.experts.1.gate_proj.weight": "model-00008-of-00008.safetensors",
430
+ "model.layers.38.mlp.experts.1.up_proj.weight": "model-00008-of-00008.safetensors",
431
+ "model.layers.38.mlp.gate.linear.weight": "model-00008-of-00008.safetensors",
432
+ "model.layers.38.pre_attention_layernorm.weight": "model-00008-of-00008.safetensors",
433
+ "model.layers.38.pre_mlp_layernorm.weight": "model-00008-of-00008.safetensors",
434
+ "model.layers.38.self_attn.k_proj.weight": "model-00008-of-00008.safetensors",
435
+ "model.layers.38.self_attn.o_proj.weight": "model-00008-of-00008.safetensors",
436
+ "model.layers.38.self_attn.q_proj.weight": "model-00008-of-00008.safetensors",
437
+ "model.layers.38.self_attn.v_proj.weight": "model-00008-of-00008.safetensors",
438
+ "model.layers.39.mlp.experts.0.down_proj.weight": "model-00008-of-00008.safetensors",
439
+ "model.layers.39.mlp.experts.0.gate_proj.weight": "model-00008-of-00008.safetensors",
440
+ "model.layers.39.mlp.experts.0.up_proj.weight": "model-00008-of-00008.safetensors",
441
+ "model.layers.39.mlp.experts.1.down_proj.weight": "model-00008-of-00008.safetensors",
442
+ "model.layers.39.mlp.experts.1.gate_proj.weight": "model-00008-of-00008.safetensors",
443
+ "model.layers.39.mlp.experts.1.up_proj.weight": "model-00008-of-00008.safetensors",
444
+ "model.layers.39.mlp.gate.linear.weight": "model-00008-of-00008.safetensors",
445
+ "model.layers.39.pre_attention_layernorm.weight": "model-00008-of-00008.safetensors",
446
+ "model.layers.39.pre_mlp_layernorm.weight": "model-00008-of-00008.safetensors",
447
+ "model.layers.39.self_attn.k_proj.weight": "model-00008-of-00008.safetensors",
448
+ "model.layers.39.self_attn.o_proj.weight": "model-00008-of-00008.safetensors",
449
+ "model.layers.39.self_attn.q_proj.weight": "model-00008-of-00008.safetensors",
450
+ "model.layers.39.self_attn.v_proj.weight": "model-00008-of-00008.safetensors",
451
+ "model.layers.4.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
452
+ "model.layers.4.mlp.experts.0.gate_proj.weight": "model-00001-of-00008.safetensors",
453
+ "model.layers.4.mlp.experts.0.up_proj.weight": "model-00001-of-00008.safetensors",
454
+ "model.layers.4.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
455
+ "model.layers.4.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
456
+ "model.layers.4.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
457
+ "model.layers.4.mlp.gate.linear.weight": "model-00001-of-00008.safetensors",
458
+ "model.layers.4.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
459
+ "model.layers.4.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
460
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
461
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
462
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
463
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
464
+ "model.layers.5.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
465
+ "model.layers.5.mlp.experts.0.gate_proj.weight": "model-00002-of-00008.safetensors",
466
+ "model.layers.5.mlp.experts.0.up_proj.weight": "model-00002-of-00008.safetensors",
467
+ "model.layers.5.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
468
+ "model.layers.5.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
469
+ "model.layers.5.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
470
+ "model.layers.5.mlp.gate.linear.weight": "model-00002-of-00008.safetensors",
471
+ "model.layers.5.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
472
+ "model.layers.5.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
473
+ "model.layers.5.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
474
+ "model.layers.5.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
475
+ "model.layers.5.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
476
+ "model.layers.5.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
477
+ "model.layers.6.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
478
+ "model.layers.6.mlp.experts.0.gate_proj.weight": "model-00002-of-00008.safetensors",
479
+ "model.layers.6.mlp.experts.0.up_proj.weight": "model-00002-of-00008.safetensors",
480
+ "model.layers.6.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
481
+ "model.layers.6.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
482
+ "model.layers.6.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
483
+ "model.layers.6.mlp.gate.linear.weight": "model-00002-of-00008.safetensors",
484
+ "model.layers.6.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
485
+ "model.layers.6.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
486
+ "model.layers.6.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
487
+ "model.layers.6.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
488
+ "model.layers.6.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
489
+ "model.layers.6.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
490
+ "model.layers.7.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
491
+ "model.layers.7.mlp.experts.0.gate_proj.weight": "model-00002-of-00008.safetensors",
492
+ "model.layers.7.mlp.experts.0.up_proj.weight": "model-00002-of-00008.safetensors",
493
+ "model.layers.7.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
494
+ "model.layers.7.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
495
+ "model.layers.7.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
496
+ "model.layers.7.mlp.gate.linear.weight": "model-00002-of-00008.safetensors",
497
+ "model.layers.7.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
498
+ "model.layers.7.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
499
+ "model.layers.7.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
500
+ "model.layers.7.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
501
+ "model.layers.7.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
502
+ "model.layers.7.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
503
+ "model.layers.8.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
504
+ "model.layers.8.mlp.experts.0.gate_proj.weight": "model-00002-of-00008.safetensors",
505
+ "model.layers.8.mlp.experts.0.up_proj.weight": "model-00002-of-00008.safetensors",
506
+ "model.layers.8.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
507
+ "model.layers.8.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
508
+ "model.layers.8.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
509
+ "model.layers.8.mlp.gate.linear.weight": "model-00002-of-00008.safetensors",
510
+ "model.layers.8.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
511
+ "model.layers.8.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
512
+ "model.layers.8.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
513
+ "model.layers.8.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
514
+ "model.layers.8.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
515
+ "model.layers.8.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
516
+ "model.layers.9.mlp.experts.0.down_proj.weight": "model-00002-of-00008.safetensors",
517
+ "model.layers.9.mlp.experts.0.gate_proj.weight": "model-00002-of-00008.safetensors",
518
+ "model.layers.9.mlp.experts.0.up_proj.weight": "model-00002-of-00008.safetensors",
519
+ "model.layers.9.mlp.experts.1.down_proj.weight": "model-00002-of-00008.safetensors",
520
+ "model.layers.9.mlp.experts.1.gate_proj.weight": "model-00002-of-00008.safetensors",
521
+ "model.layers.9.mlp.experts.1.up_proj.weight": "model-00002-of-00008.safetensors",
522
+ "model.layers.9.mlp.gate.linear.weight": "model-00002-of-00008.safetensors",
523
+ "model.layers.9.pre_attention_layernorm.weight": "model-00002-of-00008.safetensors",
524
+ "model.layers.9.pre_mlp_layernorm.weight": "model-00002-of-00008.safetensors",
525
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
526
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
527
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
528
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
529
+ "model.norm.weight": "model-00008-of-00008.safetensors"
530
+ }
531
+ }
modeling_kormo_moe.py ADDED
@@ -0,0 +1,574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable, List, Optional, Tuple, Union, Dict
2
+ import torch
3
+ from torch import nn
4
+ import torch.nn.functional as F
5
+
6
+ from transformers.activations import ACT2FN
7
+ from transformers.cache_utils import Cache, DynamicCache
8
+ from transformers.generation import GenerationMixin
9
+ from transformers.integrations import use_kernel_forward_from_hub
10
+ from transformers.masking_utils import create_causal_mask
11
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
12
+ from transformers.modeling_layers import GradientCheckpointingLayer
13
+ from transformers.modeling_outputs import (
14
+ BaseModelOutputWithPast,
15
+ CausalLMOutputWithPast,
16
+ )
17
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
18
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
19
+ from transformers.processing_utils import Unpack
20
+ from transformers.utils import can_return_tuple, logging
21
+ from .configuration_kormo_moe import KORMoMoeConfig
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+
26
+ @use_kernel_forward_from_hub("RMSNorm")
27
+ class RMSNorm(nn.Module):
28
+ """KORMoRMSNorm is equivalent to T5LayerNorm"""
29
+ def __init__(self, hidden_size: int, eps: float = 1e-6):
30
+ super().__init__()
31
+ self.weight = nn.Parameter(torch.ones(hidden_size))
32
+ self.variance_epsilon = eps
33
+
34
+ def forward(self, hidden_states):
35
+ input_dtype = hidden_states.dtype
36
+ hidden_states = hidden_states.to(torch.float32)
37
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
38
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
39
+ return (self.weight * hidden_states).to(input_dtype)
40
+
41
+ def extra_repr(self):
42
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
43
+
44
+
45
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
46
+ """
47
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
48
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
49
+ """
50
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
51
+ if n_rep == 1:
52
+ return hidden_states
53
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
54
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
55
+
56
+
57
+ def eager_attention_forward(
58
+ module: nn.Module,
59
+ query: torch.Tensor,
60
+ key: torch.Tensor,
61
+ value: torch.Tensor,
62
+ attention_mask: Optional[torch.Tensor],
63
+ scaling: float,
64
+ dropout: float = 0.0,
65
+ **kwargs,
66
+ ):
67
+ key_states = repeat_kv(key, module.num_key_value_groups)
68
+ value_states = repeat_kv(value, module.num_key_value_groups)
69
+
70
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
71
+ if attention_mask is not None:
72
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
73
+ attn_weights = attn_weights + causal_mask
74
+
75
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
76
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
77
+ attn_output = torch.matmul(attn_weights, value_states)
78
+ attn_output = attn_output.transpose(1, 2).contiguous()
79
+
80
+ return attn_output, attn_weights
81
+
82
+
83
+ def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
84
+ cos = cos.unsqueeze(unsqueeze_dim)
85
+ sin = sin.unsqueeze(unsqueeze_dim)
86
+ q_embed = (q * cos) + (rotate_half(q) * sin)
87
+ k_embed = (k * cos) + (rotate_half(k) * sin)
88
+ return q_embed.to(q.dtype), k_embed.to(k.dtype)
89
+
90
+
91
+ def rotate_half(x):
92
+ """Rotates half the hidden dims of the input."""
93
+ x1 = x[..., : x.shape[-1] // 2]
94
+ x2 = x[..., x.shape[-1] // 2 :]
95
+ return torch.cat((-x2, x1), dim=-1)
96
+
97
+
98
+ class Attention(nn.Module):
99
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
100
+
101
+ def __init__(self, config: KORMoMoeConfig, layer_idx: int):
102
+ super().__init__()
103
+ self.config = config
104
+ self.layer_idx = layer_idx
105
+ self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
106
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
107
+ self.scaling = self.head_dim**-0.5
108
+ self.attention_dropout = config.attention_dropout
109
+ self.is_causal = True
110
+
111
+ self.q_proj = nn.Linear(config.hidden_size, config.num_attention_heads * self.head_dim, bias=False)
112
+ self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=False)
113
+ self.v_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=False)
114
+ self.o_proj = nn.Linear(config.num_attention_heads * self.head_dim, config.hidden_size, bias=False)
115
+
116
+ def forward(
117
+ self,
118
+ hidden_states: torch.Tensor,
119
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
120
+ attention_mask: Optional[torch.Tensor],
121
+ past_key_value: Optional[Cache] = None,
122
+ cache_position: Optional[torch.LongTensor] = None,
123
+ **kwargs,
124
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor], Optional[tuple[torch.Tensor]]]:
125
+ input_shape = hidden_states.shape[:-1]
126
+ hidden_shape = (*input_shape, -1, self.head_dim)
127
+
128
+ query_states = self.q_proj(hidden_states).view(hidden_shape).transpose(1, 2)
129
+ key_states = self.k_proj(hidden_states).view(hidden_shape).transpose(1, 2)
130
+ value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
131
+
132
+ cos, sin = position_embeddings
133
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
134
+
135
+ if past_key_value is not None:
136
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
137
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
138
+
139
+ attention_interface: Callable = eager_attention_forward
140
+ if self.config._attn_implementation != "eager":
141
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
142
+
143
+ attn_output, attn_weights = attention_interface(
144
+ self,
145
+ query_states,
146
+ key_states,
147
+ value_states,
148
+ attention_mask,
149
+ dropout=0.0 if not self.training else self.attention_dropout,
150
+ scaling=self.scaling,
151
+ **kwargs,
152
+ )
153
+
154
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
155
+ attn_output = self.o_proj(attn_output)
156
+
157
+ return attn_output, attn_weights
158
+
159
+
160
+ @use_kernel_forward_from_hub("MLP")
161
+ class MLP(nn.Module):
162
+ """Basic MLP for experts"""
163
+ def __init__(self, config, intermediate_size=None):
164
+ super().__init__()
165
+ self.config = config
166
+ self.hidden_size = config.hidden_size
167
+ self.intermediate_size = intermediate_size if intermediate_size is not None else config.intermediate_size
168
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
169
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
170
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
171
+ self.act_fn = ACT2FN[config.hidden_act]
172
+
173
+ def forward(self, x):
174
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
175
+
176
+
177
+ class MoEGate(nn.Module):
178
+ """MoE Gating mechanism"""
179
+ def __init__(self, config: KORMoMoeConfig):
180
+ super().__init__()
181
+ self.config = config
182
+ self.top_k = config.num_experts_per_tok
183
+ self.n_routed_experts = config.num_experts
184
+ self.norm_topk_prob = config.norm_topk_prob
185
+
186
+ self.linear = nn.Linear(config.hidden_size, config.num_experts, bias=False)
187
+
188
+ def forward(self, hidden_states: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
189
+ # hidden_states: [batch_size, seq_len, hidden_size]
190
+ batch_size, seq_len, hidden_dim = hidden_states.shape
191
+ hidden_states = hidden_states.view(-1, hidden_dim)
192
+
193
+ # Compute router logits
194
+ router_logits = self.linear(hidden_states) # [batch_size * seq_len, num_experts]
195
+
196
+ # Get routing weights
197
+ routing_weights = F.softmax(router_logits, dim=-1, dtype=torch.float)
198
+ routing_weights, selected_experts = torch.topk(routing_weights, self.top_k, dim=-1)
199
+
200
+ # Normalize routing weights if needed
201
+ if self.norm_topk_prob:
202
+ routing_weights = routing_weights / routing_weights.sum(dim=-1, keepdim=True)
203
+
204
+ routing_weights = routing_weights.to(hidden_states.dtype)
205
+
206
+ return routing_weights, selected_experts
207
+
208
+
209
+ class KORMoSparseMoeBlock(nn.Module):
210
+ """KORMo Sparse MoE Block"""
211
+ def __init__(self, config: KORMoMoeConfig):
212
+ super().__init__()
213
+ self.hidden_size = config.hidden_size
214
+ self.num_experts = config.num_experts
215
+ self.top_k = config.num_experts_per_tok
216
+
217
+ self.gate = MoEGate(config)
218
+ self.experts = nn.ModuleList([
219
+ MLP(config, intermediate_size=config.moe_intermediate_size)
220
+ for _ in range(self.num_experts)
221
+ ])
222
+
223
+ # Shared expert (선택사항)
224
+ self.shared_expert = None
225
+ self.shared_expert_gate = None
226
+ if config.shared_expert_intermediate_size is not None:
227
+ self.shared_expert = MLP(config, intermediate_size=config.shared_expert_intermediate_size)
228
+ self.shared_expert_gate = nn.Linear(config.hidden_size, 1, bias=False)
229
+
230
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
231
+ batch_size, seq_len, hidden_dim = hidden_states.shape
232
+ hidden_states_flat = hidden_states.view(-1, hidden_dim)
233
+
234
+ routing_weights, selected_experts = self.gate(hidden_states)
235
+ final_hidden_states = torch.zeros_like(hidden_states_flat)
236
+
237
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
238
+
239
+ for expert_idx in range(self.num_experts):
240
+ expert_layer = self.experts[expert_idx]
241
+ idx, top_x = torch.where(expert_mask[expert_idx])
242
+
243
+ if top_x.shape[0] == 0:
244
+ continue
245
+
246
+ top_x_list = top_x.tolist()
247
+ idx_list = idx.tolist()
248
+
249
+ current_state = hidden_states_flat[None, top_x_list].reshape(-1, hidden_dim)
250
+ current_hidden_states = expert_layer(current_state) * routing_weights[top_x_list, idx_list, None]
251
+
252
+ final_hidden_states.index_add_(0, top_x, current_hidden_states.to(hidden_states.dtype))
253
+
254
+ final_hidden_states = final_hidden_states.reshape(batch_size, seq_len, hidden_dim)
255
+
256
+ # Shared expert 추가
257
+ if self.shared_expert is not None:
258
+ hidden_states_flat = hidden_states.view(-1, hidden_dim)
259
+ shared_output = self.shared_expert(hidden_states_flat)
260
+ shared_gate = torch.sigmoid(self.shared_expert_gate(hidden_states_flat))
261
+ final_hidden_states = final_hidden_states + (shared_gate * shared_output).reshape(batch_size, seq_len, hidden_dim)
262
+
263
+ return final_hidden_states
264
+
265
+
266
+ class DecoderLayer(GradientCheckpointingLayer):
267
+ def __init__(self, config: KORMoMoeConfig, layer_idx: int):
268
+ super().__init__()
269
+ self.hidden_size = config.hidden_size
270
+ self.self_attn = Attention(config=config, layer_idx=layer_idx)
271
+ self.mlp = KORMoSparseMoeBlock(config)
272
+ self.pre_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
273
+ self.pre_mlp_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
274
+
275
+ def forward(
276
+ self,
277
+ hidden_states: torch.Tensor,
278
+ attention_mask: Optional[torch.Tensor] = None,
279
+ position_ids: Optional[torch.LongTensor] = None,
280
+ past_key_value: Optional[Cache] = None,
281
+ output_attentions: Optional[bool] = False,
282
+ use_cache: Optional[bool] = False,
283
+ cache_position: Optional[torch.LongTensor] = None,
284
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
285
+ **kwargs: Unpack[FlashAttentionKwargs],
286
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
287
+ residual = hidden_states
288
+ hidden_states = self.pre_attention_layernorm(hidden_states)
289
+
290
+ # Self Attention
291
+ hidden_states, self_attn_weights = self.self_attn(
292
+ hidden_states=hidden_states,
293
+ attention_mask=attention_mask,
294
+ position_ids=position_ids,
295
+ past_key_value=past_key_value,
296
+ output_attentions=output_attentions,
297
+ use_cache=use_cache,
298
+ cache_position=cache_position,
299
+ position_embeddings=position_embeddings,
300
+ **kwargs,
301
+ )
302
+ hidden_states = residual + hidden_states
303
+
304
+ # MoE layer
305
+ residual = hidden_states
306
+ hidden_states = self.pre_mlp_layernorm(hidden_states)
307
+ hidden_states = self.mlp(hidden_states)
308
+ hidden_states = residual + hidden_states
309
+
310
+ outputs = (hidden_states,)
311
+ if output_attentions:
312
+ outputs += (self_attn_weights,)
313
+
314
+ return outputs
315
+
316
+
317
+ class RotaryEmbedding(nn.Module):
318
+ def __init__(self, config: KORMoMoeConfig, device=None):
319
+ super().__init__()
320
+ # BC: "rope_type" was originally "type"
321
+ if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
322
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
323
+ else:
324
+ self.rope_type = "default"
325
+ self.max_seq_len_cached = config.max_position_embeddings
326
+ self.original_max_seq_len = config.max_position_embeddings
327
+
328
+ self.config = config
329
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
330
+
331
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
332
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
333
+ self.original_inv_freq = self.inv_freq
334
+
335
+ @torch.no_grad()
336
+ @dynamic_rope_update
337
+ def forward(self, x, position_ids):
338
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
339
+ position_ids_expanded = position_ids[:, None, :].float()
340
+
341
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
342
+ with torch.autocast(device_type=device_type, enabled=False):
343
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
344
+ emb = torch.cat((freqs, freqs), dim=-1)
345
+ cos = emb.cos() * self.attention_scaling
346
+ sin = emb.sin() * self.attention_scaling
347
+ return cos, sin
348
+
349
+
350
+ class KORMoMoePreTrainedModel(PreTrainedModel):
351
+ config_class = KORMoMoeConfig
352
+ base_model_prefix = "model"
353
+ supports_gradient_checkpointing = True
354
+ _no_split_modules = ["DecoderLayer"]
355
+ _skip_keys_device_placement = ["past_key_values"]
356
+ _supports_flash_attn_3 = True
357
+ _supports_flash_attn_2 = True
358
+ _supports_sdpa = True
359
+ _supports_flex_attn = True
360
+ _supports_cache_class = True
361
+ _supports_quantized_cache = True
362
+ _supports_static_cache = True
363
+ _supports_attention_backend = True
364
+
365
+ def _init_weights(self, module):
366
+ std = self.config.initializer_range
367
+ if isinstance(module, nn.Linear):
368
+ module.weight.data.normal_(mean=0.0, std=std)
369
+ if module.bias is not None:
370
+ module.bias.data.zero_()
371
+ elif isinstance(module, nn.Embedding):
372
+ module.weight.data.normal_(mean=0.0, std=std)
373
+ if module.padding_idx is not None:
374
+ module.weight.data[module.padding_idx].zero_()
375
+ elif isinstance(module, RMSNorm):
376
+ module.weight.data.fill_(1.0)
377
+
378
+
379
+ class KORMoMoeModel(KORMoMoePreTrainedModel):
380
+ def __init__(self, config: KORMoMoeConfig):
381
+ super().__init__(config)
382
+ self.padding_idx = config.pad_token_id
383
+ self.vocab_size = config.vocab_size
384
+
385
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
386
+ self.layers = nn.ModuleList(
387
+ [DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
388
+ )
389
+ self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
390
+ self.rotary_emb = RotaryEmbedding(config=config)
391
+ self.gradient_checkpointing = False
392
+
393
+ self.post_init()
394
+
395
+ def get_input_embeddings(self):
396
+ return self.embed_tokens
397
+
398
+ def set_input_embeddings(self, value):
399
+ self.embed_tokens = value
400
+
401
+ @can_return_tuple
402
+ def forward(
403
+ self,
404
+ input_ids: torch.LongTensor = None,
405
+ attention_mask: Optional[torch.Tensor] = None,
406
+ position_ids: Optional[torch.LongTensor] = None,
407
+ past_key_values: Optional[Cache] = None,
408
+ inputs_embeds: Optional[torch.FloatTensor] = None,
409
+ use_cache: Optional[bool] = None,
410
+ output_attentions: Optional[bool] = None,
411
+ output_hidden_states: Optional[bool] = None,
412
+ cache_position: Optional[torch.LongTensor] = None,
413
+ **flash_attn_kwargs: Unpack[FlashAttentionKwargs],
414
+ ) -> BaseModelOutputWithPast:
415
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
416
+ output_hidden_states = (
417
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
418
+ )
419
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
420
+
421
+ if (input_ids is None) ^ (inputs_embeds is not None):
422
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
423
+
424
+ if self.gradient_checkpointing and self.training and use_cache:
425
+ logger.warning_once(
426
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
427
+ )
428
+ use_cache = False
429
+
430
+ if not isinstance(past_key_values, (type(None), Cache)):
431
+ raise ValueError("The `past_key_values` should be either a `Cache` object or `None`.")
432
+
433
+ if inputs_embeds is None:
434
+ inputs_embeds = self.embed_tokens(input_ids)
435
+
436
+ if use_cache and past_key_values is None:
437
+ past_key_values = DynamicCache()
438
+
439
+ if cache_position is None:
440
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
441
+ cache_position = torch.arange(
442
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
443
+ )
444
+
445
+ if position_ids is None:
446
+ position_ids = cache_position.unsqueeze(0)
447
+
448
+ causal_mask = create_causal_mask(
449
+ config=self.config,
450
+ input_embeds=inputs_embeds,
451
+ attention_mask=attention_mask,
452
+ cache_position=cache_position,
453
+ past_key_values=past_key_values,
454
+ position_ids=position_ids,
455
+ )
456
+
457
+ hidden_states = inputs_embeds
458
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
459
+
460
+ all_hidden_states = () if output_hidden_states else None
461
+ all_self_attns = () if output_attentions else None
462
+
463
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
464
+ if output_hidden_states:
465
+ all_hidden_states += (hidden_states,)
466
+
467
+ layer_outputs = decoder_layer(
468
+ hidden_states,
469
+ attention_mask=causal_mask,
470
+ position_ids=position_ids,
471
+ past_key_value=past_key_values,
472
+ output_attentions=output_attentions,
473
+ use_cache=use_cache,
474
+ cache_position=cache_position,
475
+ position_embeddings=position_embeddings,
476
+ **flash_attn_kwargs,
477
+ )
478
+
479
+ hidden_states = layer_outputs[0]
480
+
481
+ if output_attentions:
482
+ all_self_attns += (layer_outputs[1],)
483
+
484
+ hidden_states = self.norm(hidden_states)
485
+
486
+ if output_hidden_states:
487
+ all_hidden_states += (hidden_states,)
488
+
489
+ return BaseModelOutputWithPast(
490
+ last_hidden_state=hidden_states,
491
+ past_key_values=past_key_values if use_cache else None,
492
+ hidden_states=all_hidden_states,
493
+ attentions=all_self_attns,
494
+ )
495
+
496
+
497
+ class KORMoMoeForCausalLM(KORMoMoePreTrainedModel, GenerationMixin):
498
+ _tied_weights_keys = ["lm_head.weight"]
499
+
500
+ def __init__(self, config):
501
+ super().__init__(config)
502
+ self.model = KORMoMoeModel(config)
503
+ self.vocab_size = config.vocab_size
504
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
505
+ self.post_init()
506
+
507
+ def get_input_embeddings(self):
508
+ return self.model.embed_tokens
509
+
510
+ def set_input_embeddings(self, value):
511
+ self.model.embed_tokens = value
512
+
513
+ def get_output_embeddings(self):
514
+ return self.lm_head
515
+
516
+ def set_output_embeddings(self, new_embeddings):
517
+ self.lm_head = new_embeddings
518
+
519
+ def set_decoder(self, decoder):
520
+ self.model = decoder
521
+
522
+ def get_decoder(self):
523
+ return self.model
524
+
525
+ @can_return_tuple
526
+ def forward(
527
+ self,
528
+ input_ids: torch.LongTensor = None,
529
+ attention_mask: Optional[torch.Tensor] = None,
530
+ position_ids: Optional[torch.LongTensor] = None,
531
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
532
+ inputs_embeds: Optional[torch.FloatTensor] = None,
533
+ labels: Optional[torch.LongTensor] = None,
534
+ use_cache: Optional[bool] = None,
535
+ output_attentions: Optional[bool] = None,
536
+ output_hidden_states: Optional[bool] = None,
537
+ cache_position: Optional[torch.LongTensor] = None,
538
+ logits_to_keep: int = 0,
539
+ **kwargs,
540
+ ) -> CausalLMOutputWithPast:
541
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
542
+ output_hidden_states = (
543
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
544
+ )
545
+
546
+ outputs: BaseModelOutputWithPast = self.model(
547
+ input_ids=input_ids,
548
+ attention_mask=attention_mask,
549
+ position_ids=position_ids,
550
+ past_key_values=past_key_values,
551
+ inputs_embeds=inputs_embeds,
552
+ use_cache=use_cache,
553
+ output_attentions=output_attentions,
554
+ output_hidden_states=output_hidden_states,
555
+ cache_position=cache_position,
556
+ **kwargs,
557
+ )
558
+
559
+ hidden_states = outputs.last_hidden_state
560
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
561
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
562
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
563
+
564
+ loss = None
565
+ if labels is not None:
566
+ loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
567
+
568
+ return CausalLMOutputWithPast(
569
+ loss=loss,
570
+ logits=logits,
571
+ past_key_values=outputs.past_key_values,
572
+ hidden_states=outputs.hidden_states,
573
+ attentions=outputs.attentions,
574
+ )