model-hub mattshumer commited on
Commit
d20449b
·
0 Parent(s):

Duplicate from mattshumer/mistral-8x7b-chat

Browse files

Co-authored-by: Matt Shumer <mattshumer@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pytorch_model-00001-of-00019.bin filter=lfs diff=lfs merge=lfs -text
2
+ pytorch_model-00002-of-00019.bin filter=lfs diff=lfs merge=lfs -text
3
+ pytorch_model-00003-of-00019.bin filter=lfs diff=lfs merge=lfs -text
4
+ pytorch_model-00004-of-00019.bin filter=lfs diff=lfs merge=lfs -text
5
+ pytorch_model-00005-of-00019.bin filter=lfs diff=lfs merge=lfs -text
6
+ pytorch_model-00006-of-00019.bin filter=lfs diff=lfs merge=lfs -text
7
+ pytorch_model-00007-of-00019.bin filter=lfs diff=lfs merge=lfs -text
8
+ pytorch_model-00008-of-00019.bin filter=lfs diff=lfs merge=lfs -text
9
+ pytorch_model-00009-of-00019.bin filter=lfs diff=lfs merge=lfs -text
10
+ pytorch_model-00010-of-00019.bin filter=lfs diff=lfs merge=lfs -text
11
+ pytorch_model-00011-of-00019.bin filter=lfs diff=lfs merge=lfs -text
12
+ pytorch_model-00012-of-00019.bin filter=lfs diff=lfs merge=lfs -text
13
+ pytorch_model-00013-of-00019.bin filter=lfs diff=lfs merge=lfs -text
14
+ pytorch_model-00014-of-00019.bin filter=lfs diff=lfs merge=lfs -text
15
+ pytorch_model-00015-of-00019.bin filter=lfs diff=lfs merge=lfs -text
16
+ pytorch_model-00016-of-00019.bin filter=lfs diff=lfs merge=lfs -text
17
+ pytorch_model-00017-of-00019.bin filter=lfs diff=lfs merge=lfs -text
18
+ pytorch_model-00018-of-00019.bin filter=lfs diff=lfs merge=lfs -text
19
+ pytorch_model-00019-of-00019.bin filter=lfs diff=lfs merge=lfs -text
Mistral-8x7b-chat_model_card.md ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ ---
4
+
5
+
6
+
7
+
8
+
9
+
10
+ # Model Card for Mistral-8x7b-chat
11
+
12
+ <!-- Provide a quick summary of what the model is/does. [Optional] -->
13
+ A very capable chat model built on top of the new Mistral MoE model, trained on the SlimOrca dataset for 1 epoch, using QLoRA.
14
+
15
+
16
+
17
+
18
+ # Table of Contents
19
+
20
+ - [Model Card for Mistral-8x7b-chat](#model-card-for--model_id-)
21
+ - [Table of Contents](#table-of-contents)
22
+ - [Table of Contents](#table-of-contents-1)
23
+ - [Model Details](#model-details)
24
+ - [Model Description](#model-description)
25
+ - [Uses](#uses)
26
+ - [Direct Use](#direct-use)
27
+ - [Downstream Use [Optional]](#downstream-use-optional)
28
+ - [Out-of-Scope Use](#out-of-scope-use)
29
+ - [Bias, Risks, and Limitations](#bias-risks-and-limitations)
30
+ - [Recommendations](#recommendations)
31
+ - [Training Details](#training-details)
32
+ - [Training Data](#training-data)
33
+ - [Training Procedure](#training-procedure)
34
+ - [Preprocessing](#preprocessing)
35
+ - [Speeds, Sizes, Times](#speeds-sizes-times)
36
+ - [Evaluation](#evaluation)
37
+ - [Testing Data, Factors & Metrics](#testing-data-factors--metrics)
38
+ - [Testing Data](#testing-data)
39
+ - [Factors](#factors)
40
+ - [Metrics](#metrics)
41
+ - [Results](#results)
42
+ - [Model Examination](#model-examination)
43
+ - [Environmental Impact](#environmental-impact)
44
+ - [Technical Specifications [optional]](#technical-specifications-optional)
45
+ - [Model Architecture and Objective](#model-architecture-and-objective)
46
+ - [Compute Infrastructure](#compute-infrastructure)
47
+ - [Hardware](#hardware)
48
+ - [Software](#software)
49
+ - [Citation](#citation)
50
+ - [Glossary [optional]](#glossary-optional)
51
+ - [More Information [optional]](#more-information-optional)
52
+ - [Model Card Authors [optional]](#model-card-authors-optional)
53
+ - [Model Card Contact](#model-card-contact)
54
+ - [How to Get Started with the Model](#how-to-get-started-with-the-model)
55
+
56
+
57
+ # Model Details
58
+
59
+ ## Model Description
60
+
61
+ <!-- Provide a longer summary of what this model is/does. -->
62
+ A very capable chat model built on top of the new Mistral MoE model, trained on the SlimOrca dataset for 1 epoch, using QLoRA.
63
+
64
+ - **Developed by:** More information needed
65
+ - **Shared by [Optional]:** More information needed
66
+ - **Model type:** Language model
67
+ - **Language(s) (NLP):** More information needed
68
+ - **License:** More information needed
69
+ - **Parent Model:** More information needed
70
+ - **Resources for more information:** More information needed
71
+
72
+
73
+
74
+ # Uses
75
+
76
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
77
+
78
+ ## Direct Use
79
+
80
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
81
+ <!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
82
+
83
+
84
+
85
+
86
+ ## Downstream Use [Optional]
87
+
88
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
89
+ <!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
90
+
91
+
92
+
93
+
94
+ ## Out-of-Scope Use
95
+
96
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
97
+ <!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
98
+
99
+
100
+
101
+
102
+ # Bias, Risks, and Limitations
103
+
104
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
105
+
106
+ Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
107
+
108
+
109
+ ## Recommendations
110
+
111
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
112
+
113
+
114
+
115
+
116
+
117
+ # Training Details
118
+
119
+ ## Training Data
120
+
121
+ <!-- This should link to a Data 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. -->
122
+
123
+ More information on training data needed
124
+
125
+
126
+ ## Training Procedure
127
+
128
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
129
+
130
+ ### Preprocessing
131
+
132
+ More information needed
133
+
134
+ ### Speeds, Sizes, Times
135
+
136
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
137
+
138
+ More information needed
139
+
140
+ # Evaluation
141
+
142
+ <!-- This section describes the evaluation protocols and provides the results. -->
143
+
144
+ ## Testing Data, Factors & Metrics
145
+
146
+ ### Testing Data
147
+
148
+ <!-- This should link to a Data Card if possible. -->
149
+
150
+ More information needed
151
+
152
+
153
+ ### Factors
154
+
155
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
156
+
157
+ More information needed
158
+
159
+ ### Metrics
160
+
161
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
162
+
163
+ More information needed
164
+
165
+ ## Results
166
+
167
+ More information needed
168
+
169
+ # Model Examination
170
+
171
+ More information needed
172
+
173
+ # Environmental Impact
174
+
175
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
176
+
177
+ 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).
178
+
179
+ - **Hardware Type:** More information needed
180
+ - **Hours used:** More information needed
181
+ - **Cloud Provider:** More information needed
182
+ - **Compute Region:** More information needed
183
+ - **Carbon Emitted:** More information needed
184
+
185
+ # Technical Specifications [optional]
186
+
187
+ ## Model Architecture and Objective
188
+
189
+ More information needed
190
+
191
+ ## Compute Infrastructure
192
+
193
+ More information needed
194
+
195
+ ### Hardware
196
+
197
+ More information needed
198
+
199
+ ### Software
200
+
201
+ More information needed
202
+
203
+ # Citation
204
+
205
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
206
+
207
+ **BibTeX:**
208
+
209
+ More information needed
210
+
211
+ **APA:**
212
+
213
+ More information needed
214
+
215
+ # Glossary [optional]
216
+
217
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
218
+
219
+ More information needed
220
+
221
+ # More Information [optional]
222
+
223
+ More information needed
224
+
225
+ # Model Card Authors [optional]
226
+
227
+ <!-- This section provides another layer of transparency and accountability. Whose views is this model card representing? How many voices were included in its construction? Etc. -->
228
+
229
+ M, a, t, t, , S, h, u, m, e, r
230
+
231
+ # Model Card Contact
232
+
233
+ More information needed
234
+
235
+ # How to Get Started with the Model
236
+
237
+ Use the code below to get started with the model.
238
+
239
+ <details>
240
+ <summary> Click to expand </summary>
241
+
242
+ More information needed
243
+
244
+ </details>
README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A very capable chat model built on top of the new Mistral MoE model, trained on the SlimOrca dataset for 1 epoch, using QLoRA.
2
+
3
+ Inference:
4
+ ```py
5
+ import torch
6
+ from transformers import AutoModelForCausalLM, AutoTokenizer
7
+
8
+ model = AutoModelForCausalLM.from_pretrained("mattshumer/mistral-8x7b-chat", low_cpu_mem_usage=True, device_map="auto", trust_remote_code=True)
9
+ tok = AutoTokenizer.from_pretrained("mattshumer/mistral-8x7b-chat")
10
+ x = tok.encode(PROMPT_GOES_HERE, return_tensors="pt").cuda()
11
+ x = model.generate(x, max_new_tokens=512).cpu()
12
+ print(tok.batch_decode(x))
13
+ ```
14
+
15
+ Prompt Template:
16
+ ```
17
+ <|im_start|>system
18
+ You are an AI assistant.<|im_end|>
19
+ <|im_start|>user
20
+ Hi, how are you?<|im_end|>
21
+ <|im_start|>assistant
22
+ I'm doing well, thanks for asking!<|im_end|>
23
+ <|im_start|>user
24
+ Write me a poem about AI.<|im_end|>
25
+ ```
26
+
27
+ Trained w/ Axolotl on 6x H100s for nine hours.
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<|im_end|>": 32000
3
+ }
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "DiscoResearch/mixtral-7b-8expert",
3
+ "architectures": [
4
+ "MixtralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "DiscoResearch/mixtral-7b-8expert--configuration_moe_mistral.MixtralConfig",
9
+ "AutoModelForCausalLM": "DiscoResearch/mixtral-7b-8expert--modeling_moe_mistral.MixtralForCausalLM"
10
+ },
11
+ "bos_token_id": 1,
12
+ "eos_token_id": 32000,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 4096,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 14336,
17
+ "max_position_embeddings": 32768,
18
+ "model_type": "mistral",
19
+ "num_attention_heads": 32,
20
+ "num_experts": 8,
21
+ "num_experts_per_token": 2,
22
+ "num_hidden_layers": 32,
23
+ "num_key_value_heads": 8,
24
+ "rms_norm_eps": 1e-05,
25
+ "rope_theta": 1000000.0,
26
+ "tie_word_embeddings": false,
27
+ "torch_dtype": "bfloat16",
28
+ "transformers_version": "4.36.0.dev0",
29
+ "use_cache": false,
30
+ "vocab_size": 32001
31
+ }
configuration_moe_mistral.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023 Mistral AI 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
+ """ Mistral model configuration"""
16
+
17
+ from transformers.configuration_utils import PretrainedConfig
18
+ from transformers.utils import logging
19
+
20
+
21
+ logger = logging.get_logger(__name__)
22
+
23
+ MISTRAL_PRETRAINED_CONFIG_ARCHIVE_MAP = {
24
+ "mistralai/Mistral-7B-v0.1": "https://huggingface.co/mistralai/Mistral-7B-v0.1/resolve/main/config.json",
25
+ "mistralai/Mistral-7B-Instruct-v0.1": "https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1/resolve/main/config.json",
26
+ }
27
+
28
+
29
+ class MixtralConfig(PretrainedConfig):
30
+ r"""
31
+ This is the configuration class to store the configuration of a [`MistralModel`]. It is used to instantiate an
32
+ Mistral model according to the specified arguments, defining the model architecture. Instantiating a configuration
33
+ with the defaults will yield a similar configuration to that of the Mistral-7B-v0.1 or Mistral-7B-Instruct-v0.1.
34
+ [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
35
+ [mistralai/Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
36
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
37
+ documentation from [`PretrainedConfig`] for more information.
38
+ Args:
39
+ vocab_size (`int`, *optional*, defaults to 32000):
40
+ Vocabulary size of the Mistral model. Defines the number of different tokens that can be represented by the
41
+ `inputs_ids` passed when calling [`MistralModel`]
42
+ hidden_size (`int`, *optional*, defaults to 4096):
43
+ Dimension of the hidden representations.
44
+ intermediate_size (`int`, *optional*, defaults to 14336):
45
+ Dimension of the MLP representations.
46
+ num_hidden_layers (`int`, *optional*, defaults to 32):
47
+ Number of hidden layers in the Transformer encoder.
48
+ num_attention_heads (`int`, *optional*, defaults to 32):
49
+ Number of attention heads for each attention layer in the Transformer encoder.
50
+ num_key_value_heads (`int`, *optional*, defaults to 8):
51
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
52
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
53
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
54
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
55
+ by meanpooling all the original heads within that group. For more details checkout [this
56
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `8`.
57
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
58
+ The non-linear activation function (function or string) in the decoder.
59
+ max_position_embeddings (`int`, *optional*, defaults to `4096*32`):
60
+ The maximum sequence length that this model might ever be used with. Mistral's sliding window attention
61
+ allows sequence of up to 4096*32 tokens.
62
+ initializer_range (`float`, *optional*, defaults to 0.02):
63
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
64
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
65
+ The epsilon used by the rms normalization layers.
66
+ use_cache (`bool`, *optional*, defaults to `True`):
67
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
68
+ relevant if `config.is_decoder=True`.
69
+ pad_token_id (`int`, *optional*):
70
+ The id of the padding token.
71
+ bos_token_id (`int`, *optional*, defaults to 1):
72
+ The id of the "beginning-of-sequence" token.
73
+ eos_token_id (`int`, *optional*, defaults to 2):
74
+ The id of the "end-of-sequence" token.
75
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
76
+ Whether the model's input and output word embeddings should be tied.
77
+ rope_theta (`float`, *optional*, defaults to 10000.0):
78
+ The base period of the RoPE embeddings.
79
+ sliding_window (`int`, *optional*, defaults to 4096):
80
+ Sliding window attention window size. If not specified, will default to `4096`.
81
+ attention_dropout (`float`, *optional*, defaults to 0.0):
82
+ The dropout ratio for the attention probabilities.
83
+
84
+ ```python
85
+ >>> from transformers import MistralModel, MistralConfig
86
+ >>> # Initializing a Mistral 7B style configuration
87
+ >>> configuration = MistralConfig()
88
+ >>> # Initializing a model from the Mistral 7B style configuration
89
+ >>> model = MistralModel(configuration)
90
+ >>> # Accessing the model configuration
91
+ >>> configuration = model.config
92
+ ```"""
93
+
94
+ model_type = "mistral"
95
+ keys_to_ignore_at_inference = ["past_key_values"]
96
+
97
+ def __init__(
98
+ self,
99
+ vocab_size=32000,
100
+ hidden_size=4096,
101
+ intermediate_size=14336,
102
+ num_hidden_layers=32,
103
+ num_attention_heads=32,
104
+ num_key_value_heads=8,
105
+ hidden_act="silu",
106
+ max_position_embeddings=4096 * 32,
107
+ initializer_range=0.02,
108
+ rms_norm_eps=1e-6,
109
+ use_cache=True,
110
+ pad_token_id=None,
111
+ bos_token_id=1,
112
+ eos_token_id=2,
113
+ tie_word_embeddings=False,
114
+ rope_theta=10000.0,
115
+ attention_dropout=0.0,
116
+ num_experts_per_token=2,
117
+ num_experts=8,
118
+ **kwargs,
119
+ ):
120
+ self.vocab_size = vocab_size
121
+ self.max_position_embeddings = max_position_embeddings
122
+ self.hidden_size = hidden_size
123
+ self.intermediate_size = intermediate_size
124
+ self.num_hidden_layers = num_hidden_layers
125
+ self.num_attention_heads = num_attention_heads
126
+
127
+ # for backward compatibility
128
+ if num_key_value_heads is None:
129
+ num_key_value_heads = num_attention_heads
130
+
131
+ self.num_key_value_heads = num_key_value_heads
132
+ self.hidden_act = hidden_act
133
+ self.initializer_range = initializer_range
134
+ self.rms_norm_eps = rms_norm_eps
135
+ self.use_cache = use_cache
136
+ self.rope_theta = rope_theta
137
+ self.attention_dropout = attention_dropout
138
+ self.num_experts = num_experts
139
+ self.num_experts_per_token = num_experts_per_token
140
+
141
+ super().__init__(
142
+ pad_token_id=pad_token_id,
143
+ bos_token_id=bos_token_id,
144
+ eos_token_id=eos_token_id,
145
+ tie_word_embeddings=tie_word_embeddings,
146
+ **kwargs,
147
+ )
convert_mistral_moe_weights_to_hf.py ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 Mistral AI and The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ import argparse
15
+ import gc
16
+ import json
17
+ import os
18
+ import shutil
19
+ import warnings
20
+
21
+ import torch
22
+
23
+ from transformers import (
24
+ LlamaTokenizer
25
+ )
26
+
27
+ from .modeling_moe_mistral import MixtralForCausalLM
28
+ from .configuration_moe_mistral import MixtralConfig
29
+
30
+ try:
31
+ from transformers import LlamaTokenizerFast
32
+
33
+ tokenizer_class = LlamaTokenizerFast
34
+ except ImportError as e:
35
+ warnings.warn(e)
36
+ warnings.warn(
37
+ "The converted tokenizer will be the `slow` tokenizer. To use the fast, update your `tokenizers` library and re-run the tokenizer conversion"
38
+ )
39
+ tokenizer_class = LlamaTokenizer
40
+
41
+ """
42
+ Sample usage:
43
+ ```
44
+ python src/transformers/models/mistral/convert_mistral_weights_to_hf.py \
45
+ --input_dir /path/to/downloaded/mistral/weights --model_size 7B --output_dir /output/path
46
+ ```
47
+ Thereafter, models can be loaded via:
48
+ ```py
49
+ from transformers import MistralForCausalLM, LlamaTokenizer
50
+ model = MistralForCausalLM.from_pretrained("/output/path")
51
+ tokenizer = LlamaTokenizer.from_pretrained("/output/path")
52
+ ```
53
+ Important note: you need to be able to host the whole model in RAM to execute this script (even if the biggest versions
54
+ come in several checkpoints they each contain a part of each weight of the model, so we need to load them all in RAM).
55
+ """
56
+
57
+ NUM_SHARDS = {"7B": 1}
58
+
59
+
60
+ def compute_intermediate_size(n, ffn_dim_multiplier=1, multiple_of=256):
61
+ return multiple_of * ((int(ffn_dim_multiplier * int(8 * n / 3)) + multiple_of - 1) // multiple_of)
62
+
63
+
64
+ def read_json(path):
65
+ with open(path, "r") as f:
66
+ return json.load(f)
67
+
68
+
69
+ def write_json(text, path):
70
+ with open(path, "w") as f:
71
+ json.dump(text, f)
72
+
73
+
74
+ def write_model(model_path, input_base_path, model_size, tokenizer_path=None, safe_serialization=True):
75
+ # for backward compatibility, before you needed the repo to be called `my_repo/model_size`
76
+ if not os.path.isfile(os.path.join(input_base_path, "params.json")):
77
+ input_base_path = os.path.join(input_base_path, model_size)
78
+
79
+ os.makedirs(model_path, exist_ok=True)
80
+ tmp_model_path = os.path.join(model_path, "tmp")
81
+ os.makedirs(tmp_model_path, exist_ok=True)
82
+
83
+ params = read_json(os.path.join(input_base_path, "params.json"))
84
+ num_shards = NUM_SHARDS[model_size]
85
+
86
+ n_layers = params["n_layers"]
87
+ n_heads = params["n_heads"]
88
+ n_heads_per_shard = n_heads // num_shards
89
+ dim = params["dim"]
90
+ dims_per_head = dim // n_heads
91
+ base = params.get("rope_theta", 100000.0)
92
+ inv_freq = 1.0 / (base ** (torch.arange(0, dims_per_head, 2).float() / dims_per_head))
93
+ max_position_embeddings = 4096 * 8
94
+ num_experts_per_token = params["moe"]["num_experts_per_tok"]
95
+ num_experts = params["moe"]["num_experts"]
96
+
97
+
98
+ if tokenizer_path is not None:
99
+ tokenizer = tokenizer_class(tokenizer_path)
100
+ tokenizer.save_pretrained(model_path)
101
+ vocab_size = tokenizer.vocab_size if tokenizer_path is not None else 32000
102
+
103
+ if "n_kv_heads" in params:
104
+ num_key_value_heads = params["n_kv_heads"] # for GQA / MQA
105
+ num_local_key_value_heads = num_key_value_heads // num_shards
106
+ key_value_dim = dims_per_head * num_local_key_value_heads
107
+ else: # compatibility with other checkpoints
108
+ num_key_value_heads = n_heads
109
+ num_local_key_value_heads = n_heads_per_shard
110
+ key_value_dim = dim
111
+
112
+ # permute for sliced rotary
113
+ def permute(w, n_heads=n_heads, dim1=dim, dim2=dim):
114
+ return w.view(n_heads, dim1 // n_heads // 2, 2, dim2).transpose(1, 2).reshape(dim1, dim2)
115
+
116
+
117
+ print(f"Fetching all parameters from the checkpoint at {input_base_path}.")
118
+ # Load weights
119
+ loaded = [
120
+ torch.load(os.path.join(input_base_path, f"consolidated.{i:02d}.pth"), map_location="cpu")
121
+ for i in range(num_shards)
122
+ ]
123
+ param_count = 0
124
+ index_dict = {"weight_map": {}}
125
+ for layer_i in range(n_layers):
126
+ filename = f"pytorch_model-{layer_i + 1}-of-{n_layers + 1}.bin"
127
+
128
+ # Sharded
129
+ # Note that attention.w{q,k,v,o}, feed_fordward.w[1,2,3], attention_norm.weight and ffn_norm.weight share
130
+ # the same storage object, saving attention_norm and ffn_norm will save other weights too, which is
131
+ # redundant as other weights will be stitched from multiple shards. To avoid that, they are cloned.
132
+
133
+ state_dict = {
134
+ f"model.layers.{layer_i}.input_layernorm.weight": loaded[0][
135
+ f"layers.{layer_i}.attention_norm.weight"
136
+ ].clone(),
137
+ f"model.layers.{layer_i}.post_attention_layernorm.weight": loaded[0][
138
+ f"layers.{layer_i}.ffn_norm.weight"
139
+ ].clone(),
140
+ }
141
+ state_dict[f"model.layers.{layer_i}.self_attn.q_proj.weight"] = permute(
142
+ torch.cat(
143
+ [
144
+ loaded[i][f"layers.{layer_i}.attention.wq.weight"].view(n_heads_per_shard, dims_per_head, dim)
145
+ for i in range(num_shards)
146
+ ],
147
+ dim=0,
148
+ ).reshape(dim, dim)
149
+ )
150
+ state_dict[f"model.layers.{layer_i}.self_attn.k_proj.weight"] = permute(
151
+ torch.cat(
152
+ [
153
+ loaded[i][f"layers.{layer_i}.attention.wk.weight"].view(
154
+ num_local_key_value_heads, dims_per_head, dim
155
+ )
156
+ for i in range(num_shards)
157
+ ],
158
+ dim=0,
159
+ ).reshape(key_value_dim, dim),
160
+ num_key_value_heads,
161
+ key_value_dim,
162
+ dim,
163
+ )
164
+ state_dict[f"model.layers.{layer_i}.self_attn.v_proj.weight"] = torch.cat(
165
+ [
166
+ loaded[i][f"layers.{layer_i}.attention.wv.weight"].view(num_local_key_value_heads, dims_per_head, dim)
167
+ for i in range(num_shards)
168
+ ],
169
+ dim=0,
170
+ ).reshape(key_value_dim, dim)
171
+
172
+ state_dict[f"model.layers.{layer_i}.self_attn.o_proj.weight"] = torch.cat(
173
+ [loaded[i][f"layers.{layer_i}.attention.wo.weight"] for i in range(num_shards)], dim=1
174
+ )
175
+
176
+ for expert in range(num_experts):
177
+ state_dict[f"model.layers.{layer_i}.mlp.experts.{expert}.w1.weight"] = loaded[0][f"layers.{layer_i}.feed_forward.experts.{expert}.w1.weight"]
178
+ state_dict[f"model.layers.{layer_i}.mlp.experts.{expert}.w2.weight"] = loaded[0][f"layers.{layer_i}.feed_forward.experts.{expert}.w2.weight"]
179
+ state_dict[f"model.layers.{layer_i}.mlp.experts.{expert}.w3.weight"] = loaded[0][f"layers.{layer_i}.feed_forward.experts.{expert}.w3.weight"]
180
+
181
+ state_dict[f"model.layers.{layer_i}.mlp.gate.weight"] = loaded[0][f"layers.{layer_i}.feed_forward.gate.weight"]
182
+
183
+ state_dict[f"model.layers.{layer_i}.self_attn.rotary_emb.inv_freq"] = inv_freq
184
+ for k, v in state_dict.items():
185
+ index_dict["weight_map"][k] = filename
186
+ param_count += v.numel()
187
+ torch.save(state_dict, os.path.join(tmp_model_path, filename))
188
+
189
+ filename = f"pytorch_model-{n_layers + 1}-of-{n_layers + 1}.bin"
190
+ state_dict = {
191
+ "model.norm.weight": loaded[0]["norm.weight"],
192
+ "model.embed_tokens.weight": torch.cat([loaded[i]["tok_embeddings.weight"] for i in range(num_shards)], dim=1),
193
+ "lm_head.weight": torch.cat([loaded[i]["output.weight"] for i in range(num_shards)], dim=0),
194
+ }
195
+
196
+ for k, v in state_dict.items():
197
+ index_dict["weight_map"][k] = filename
198
+ param_count += v.numel()
199
+ print(param_count)
200
+ torch.save(state_dict, os.path.join(tmp_model_path, filename))
201
+
202
+ index_dict["metadata"] = {"total_size": param_count * 2}
203
+ write_json(index_dict, os.path.join(tmp_model_path, "pytorch_model.bin.index.json"))
204
+ config = MixtralConfig(
205
+ hidden_size=dim,
206
+ intermediate_size=params["hidden_dim"],
207
+ num_attention_heads=params["n_heads"],
208
+ num_hidden_layers=params["n_layers"],
209
+ rms_norm_eps=params["norm_eps"],
210
+ num_key_value_heads=num_key_value_heads,
211
+ vocab_size=vocab_size,
212
+ rope_theta=base,
213
+ max_position_embeddings=max_position_embeddings,
214
+ num_experts=num_experts,
215
+ num_experts_per_token=num_experts_per_token
216
+ )
217
+ config.save_pretrained(tmp_model_path)
218
+
219
+ del state_dict
220
+ del loaded
221
+ gc.collect()
222
+
223
+ print("Loading the checkpoint in a Mistral model.")
224
+ model = MixtralForCausalLM.from_pretrained(tmp_model_path, torch_dtype=torch.float16, low_cpu_mem_usage=True)
225
+ # Avoid saving this as part of the config.
226
+ del model.config._name_or_path
227
+ model.config.torch_dtype = torch.float16
228
+ print("Saving in the Transformers format.")
229
+ model.save_pretrained(model_path, safe_serialization=safe_serialization)
230
+ shutil.rmtree(tmp_model_path)
231
+
232
+
233
+ def write_tokenizer(tokenizer_path, input_tokenizer_path):
234
+ # Initialize the tokenizer based on the `spm` model
235
+ print(f"Saving a {tokenizer_class.__name__} to {tokenizer_path}.")
236
+ tokenizer = tokenizer_class(input_tokenizer_path)
237
+ tokenizer.save_pretrained(tokenizer_path)
238
+
239
+
240
+ def main():
241
+ parser = argparse.ArgumentParser()
242
+ parser.add_argument(
243
+ "--input_dir",
244
+ help="Location of Mistral weights, which contains tokenizer.model and model folders",
245
+ )
246
+ parser.add_argument(
247
+ "--model_size",
248
+ choices=["7B", "tokenizer_only"],
249
+ help="'f' models correspond to the finetuned versions, and are specific to the Mistral2 official release. For more details on Mistral2, checkout the original repo: https://huggingface.co/meta-mistral",
250
+ )
251
+ parser.add_argument(
252
+ "--output_dir",
253
+ help="Location to write HF model and tokenizer",
254
+ )
255
+ parser.add_argument("--safe_serialization", type=bool, help="Whether or not to save using `safetensors`.")
256
+ args = parser.parse_args()
257
+ spm_path = os.path.join(args.input_dir, "tokenizer.model")
258
+ if args.model_size != "tokenizer_only":
259
+ write_model(
260
+ model_path=args.output_dir,
261
+ input_base_path=args.input_dir,
262
+ model_size=args.model_size,
263
+ safe_serialization=args.safe_serialization,
264
+ tokenizer_path=spm_path,
265
+ )
266
+ else:
267
+ write_tokenizer(args.output_dir, spm_path)
268
+
269
+
270
+ if __name__ == "__main__":
271
+ main()
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.36.0.dev0"
6
+ }
modeling_moe_mistral.py ADDED
@@ -0,0 +1,1294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023 Mistral AI and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
5
+ # and OPT implementations in this library. It has been modified from its
6
+ # original forms to accommodate minor architectural differences compared
7
+ # to GPT-NeoX and OPT used by the Meta AI team that trained the model.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ """ PyTorch Mistral model."""
21
+ import inspect
22
+ import math
23
+ import warnings
24
+ from typing import List, Optional, Tuple, Union
25
+
26
+ import torch
27
+ import torch.nn.functional as F
28
+ import torch.utils.checkpoint
29
+ from torch import nn
30
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
31
+
32
+ from transformers.activations import ACT2FN
33
+ from transformers.cache_utils import Cache, DynamicCache
34
+ from transformers.modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
35
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
36
+ from transformers.modeling_utils import PreTrainedModel
37
+ from transformers.utils import (
38
+ add_start_docstrings,
39
+ add_start_docstrings_to_model_forward,
40
+ is_flash_attn_2_available,
41
+ is_flash_attn_greater_or_equal_2_10,
42
+ logging,
43
+ replace_return_docstrings,
44
+ )
45
+ from .configuration_moe_mistral import MixtralConfig
46
+
47
+
48
+
49
+ if is_flash_attn_2_available():
50
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
51
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
52
+
53
+ _flash_supports_window_size = "window_size" in list(inspect.signature(flash_attn_func).parameters)
54
+
55
+
56
+ logger = logging.get_logger(__name__)
57
+
58
+ _CONFIG_FOR_DOC = "MixtralConfig"
59
+
60
+
61
+ # Copied from transformers.models.llama.modeling_llama._get_unpad_data
62
+ def _get_unpad_data(attention_mask):
63
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
64
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
65
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
66
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
67
+ return (
68
+ indices,
69
+ cu_seqlens,
70
+ max_seqlen_in_batch,
71
+ )
72
+
73
+
74
+ # Copied from transformers.models.llama.modeling_llama.LlamaRMSNorm with Llama->Mistral
75
+ class MistralRMSNorm(nn.Module):
76
+ def __init__(self, hidden_size, eps=1e-6):
77
+ """
78
+ MistralRMSNorm is equivalent to T5LayerNorm
79
+ """
80
+ super().__init__()
81
+ self.weight = nn.Parameter(torch.ones(hidden_size))
82
+ self.variance_epsilon = eps
83
+
84
+ def forward(self, hidden_states):
85
+ input_dtype = hidden_states.dtype
86
+ hidden_states = hidden_states.to(torch.float32)
87
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
88
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
89
+ return self.weight * hidden_states.to(input_dtype)
90
+
91
+
92
+ # Copied from transformers.models.llama.modeling_llama.LlamaRotaryEmbedding with Llama->Mistral
93
+ class MistralRotaryEmbedding(nn.Module):
94
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
95
+ super().__init__()
96
+
97
+ self.dim = dim
98
+ self.max_position_embeddings = max_position_embeddings
99
+ self.base = base
100
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
101
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
102
+
103
+ # Build here to make `torch.jit.trace` work.
104
+ self._set_cos_sin_cache(
105
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
106
+ )
107
+
108
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
109
+ self.max_seq_len_cached = seq_len
110
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
111
+
112
+ freqs = torch.outer(t, self.inv_freq)
113
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
114
+ emb = torch.cat((freqs, freqs), dim=-1)
115
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
116
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
117
+
118
+ def forward(self, x, seq_len=None):
119
+ # x: [bs, num_attention_heads, seq_len, head_size]
120
+ if seq_len > self.max_seq_len_cached:
121
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
122
+
123
+ return (
124
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
125
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
126
+ )
127
+
128
+
129
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
130
+ def rotate_half(x):
131
+ """Rotates half the hidden dims of the input."""
132
+ x1 = x[..., : x.shape[-1] // 2]
133
+ x2 = x[..., x.shape[-1] // 2 :]
134
+ return torch.cat((-x2, x1), dim=-1)
135
+
136
+
137
+ # Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
138
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
139
+ """Applies Rotary Position Embedding to the query and key tensors.
140
+ Args:
141
+ q (`torch.Tensor`): The query tensor.
142
+ k (`torch.Tensor`): The key tensor.
143
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
144
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
145
+ position_ids (`torch.Tensor`):
146
+ The position indices of the tokens corresponding to the query and key tensors. For example, this can be
147
+ used to pass offsetted position ids when working with a KV-cache.
148
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
149
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
150
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
151
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
152
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
153
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
154
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
155
+ Returns:
156
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
157
+ """
158
+ cos = cos[position_ids].unsqueeze(unsqueeze_dim)
159
+ sin = sin[position_ids].unsqueeze(unsqueeze_dim)
160
+ q_embed = (q * cos) + (rotate_half(q) * sin)
161
+ k_embed = (k * cos) + (rotate_half(k) * sin)
162
+ return q_embed, k_embed
163
+
164
+
165
+ class FeedForward(nn.Module):
166
+ def __init__(
167
+ self,
168
+ config
169
+ ):
170
+ """
171
+ Initialize the FeedForward module.
172
+ Args:
173
+ dim (int): Input dimension.
174
+ hidden_dim (int): Hidden dimension of the feedforward layer.
175
+ multiple_of (int): Value to ensure hidden dimension is a multiple of this value.
176
+ ffn_dim_multiplier (float, optional): Custom multiplier for hidden dimension. Defaults to None.
177
+ Attributes:
178
+ w1 (ColumnParallelLinear): Linear transformation for the first layer.
179
+ w2 (RowParallelLinear): Linear transformation for the second layer.
180
+ w3 (ColumnParallelLinear): Linear transformation for the third layer.
181
+ """
182
+ super().__init__()
183
+
184
+ self.w1 = nn.Linear(
185
+ config.hidden_size, config.intermediate_size, bias=False
186
+ )
187
+ self.w2 = nn.Linear(
188
+ config.intermediate_size, config.hidden_size, bias=False
189
+ )
190
+ self.w3 = nn.Linear(
191
+ config.hidden_size, config.intermediate_size, bias=False
192
+ )
193
+
194
+ def forward(self, x):
195
+ return self.w2(F.silu(self.w1(x)) * self.w3(x))
196
+
197
+
198
+ class MoE(nn.Module):
199
+ def __init__(
200
+ self,
201
+ config,
202
+ ):
203
+ super().__init__()
204
+ self.config = config
205
+ num_experts = config.num_experts
206
+ self.experts = nn.ModuleList([FeedForward(config) for i in range(num_experts)])
207
+ self.gate = nn.Linear(config.hidden_size, num_experts, bias=False)
208
+ self.num_experts_per_token = config.num_experts_per_token
209
+
210
+ def forward(self, x):
211
+ orig_shape = x.shape
212
+ x = x.view(-1, x.shape[-1])
213
+
214
+ scores = self.gate(x)
215
+ expert_weights, expert_indices = torch.topk(scores, self.num_experts_per_token, dim=-1)
216
+ expert_weights = expert_weights.softmax(dim=-1)
217
+ flat_expert_indices = expert_indices.view(-1)
218
+
219
+ x = x.repeat_interleave(self.num_experts_per_token, dim=0)
220
+ y = torch.empty_like(x)
221
+ for i, expert in enumerate(self.experts):
222
+ y[flat_expert_indices == i] = expert(x[flat_expert_indices == i])
223
+ y = (y.view(*expert_weights.shape, -1) * expert_weights.unsqueeze(-1)).sum(dim=1)
224
+ return y.view(*orig_shape)
225
+
226
+
227
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv
228
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
229
+ """
230
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
231
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
232
+ """
233
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
234
+ if n_rep == 1:
235
+ return hidden_states
236
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
237
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
238
+
239
+
240
+ class MistralAttention(nn.Module):
241
+ """
242
+ Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
243
+ and "Generating Long Sequences with Sparse Transformers".
244
+ """
245
+
246
+ def __init__(self, config: MixtralConfig, layer_idx: Optional[int] = None):
247
+ super().__init__()
248
+ self.config = config
249
+ self.layer_idx = layer_idx
250
+ if layer_idx is None:
251
+ logger.warning_once(
252
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
253
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
254
+ "when creating this class."
255
+ )
256
+
257
+ self.hidden_size = config.hidden_size
258
+ self.num_heads = config.num_attention_heads
259
+ self.head_dim = self.hidden_size // self.num_heads
260
+ self.num_key_value_heads = config.num_key_value_heads
261
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
262
+ self.max_position_embeddings = config.max_position_embeddings
263
+ self.rope_theta = config.rope_theta
264
+ self.is_causal = True
265
+ self.attention_dropout = config.attention_dropout
266
+
267
+ if (self.head_dim * self.num_heads) != self.hidden_size:
268
+ raise ValueError(
269
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
270
+ f" and `num_heads`: {self.num_heads})."
271
+ )
272
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
273
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
274
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
275
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
276
+
277
+ self.rotary_emb = MistralRotaryEmbedding(
278
+ self.head_dim,
279
+ max_position_embeddings=self.max_position_embeddings,
280
+ base=self.rope_theta,
281
+ )
282
+
283
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
284
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
285
+
286
+ def forward(
287
+ self,
288
+ hidden_states: torch.Tensor,
289
+ attention_mask: Optional[torch.Tensor] = None,
290
+ position_ids: Optional[torch.LongTensor] = None,
291
+ past_key_value: Optional[Cache] = None,
292
+ output_attentions: bool = False,
293
+ use_cache: bool = False,
294
+ **kwargs,
295
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
296
+ if "padding_mask" in kwargs:
297
+ warnings.warn(
298
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
299
+ )
300
+ bsz, q_len, _ = hidden_states.size()
301
+
302
+ query_states = self.q_proj(hidden_states)
303
+ key_states = self.k_proj(hidden_states)
304
+ value_states = self.v_proj(hidden_states)
305
+
306
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
307
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
308
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
309
+
310
+ kv_seq_len = key_states.shape[-2]
311
+ if past_key_value is not None:
312
+ if self.layer_idx is None:
313
+ raise ValueError(
314
+ f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
315
+ "for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
316
+ "with a layer index."
317
+ )
318
+ kv_seq_len += past_key_value.get_seq_length(self.layer_idx)
319
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
320
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
321
+
322
+ if past_key_value is not None:
323
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
324
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
325
+
326
+ # repeat k/v heads if n_kv_heads < n_heads
327
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
328
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
329
+
330
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
331
+
332
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
333
+ raise ValueError(
334
+ f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
335
+ f" {attn_weights.size()}"
336
+ )
337
+
338
+ if attention_mask is not None:
339
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
340
+ raise ValueError(
341
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
342
+ )
343
+
344
+ attn_weights = attn_weights + attention_mask
345
+
346
+ # upcast attention to fp32
347
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
348
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
349
+ attn_output = torch.matmul(attn_weights, value_states)
350
+
351
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
352
+ raise ValueError(
353
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
354
+ f" {attn_output.size()}"
355
+ )
356
+
357
+ attn_output = attn_output.transpose(1, 2).contiguous()
358
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
359
+
360
+ attn_output = self.o_proj(attn_output)
361
+
362
+ if not output_attentions:
363
+ attn_weights = None
364
+
365
+ return attn_output, attn_weights, past_key_value
366
+
367
+
368
+ class MistralFlashAttention2(MistralAttention):
369
+ """
370
+ Mistral flash attention module. This module inherits from `MistralAttention` as the weights of the module stays
371
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
372
+ flash attention and deal with padding tokens in case the input contains any of them.
373
+ """
374
+
375
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2.__init__
376
+ def __init__(self, *args, **kwargs):
377
+ super().__init__(*args, **kwargs)
378
+
379
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
380
+ # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
381
+ # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
382
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
383
+
384
+ def forward(
385
+ self,
386
+ hidden_states: torch.Tensor,
387
+ attention_mask: Optional[torch.Tensor] = None,
388
+ position_ids: Optional[torch.LongTensor] = None,
389
+ past_key_value: Optional[Cache] = None,
390
+ output_attentions: bool = False,
391
+ use_cache: bool = False,
392
+ **kwargs,
393
+ ):
394
+ if "padding_mask" in kwargs:
395
+ warnings.warn(
396
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
397
+ )
398
+
399
+ # overwrite attention_mask with padding_mask
400
+ attention_mask = kwargs.pop("padding_mask")
401
+ bsz, q_len, _ = hidden_states.size()
402
+
403
+ query_states = self.q_proj(hidden_states)
404
+ key_states = self.k_proj(hidden_states)
405
+ value_states = self.v_proj(hidden_states)
406
+
407
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
408
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
409
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
410
+
411
+ kv_seq_len = key_states.shape[-2]
412
+ if past_key_value is not None:
413
+ kv_seq_len += past_key_value.get_seq_length(self.layer_idx)
414
+
415
+ # Because the input can be padded, the absolute sequence length depends on the max position id.
416
+ rotary_seq_len = max(kv_seq_len, position_ids[:, -1].max().item()) + 1
417
+ cos, sin = self.rotary_emb(value_states, seq_len=rotary_seq_len)
418
+
419
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
420
+
421
+ use_sliding_windows = (
422
+ _flash_supports_window_size
423
+ and getattr(self.config, "sliding_window", None) is not None
424
+ and kv_seq_len > self.config.sliding_window
425
+ )
426
+
427
+ if not _flash_supports_window_size:
428
+ logger.warning_once(
429
+ "The current flash attention version does not support sliding window attention, for a more memory efficient implementation"
430
+ " make sure to upgrade flash-attn library."
431
+ )
432
+
433
+ if past_key_value is not None:
434
+ # Activate slicing cache only if the config has a value `sliding_windows` attribute
435
+ if getattr(self.config, "sliding_window", None) is not None and kv_seq_len > self.config.sliding_window:
436
+ slicing_tokens = 1 - self.config.sliding_window
437
+
438
+ past_key = past_key_value[0]
439
+ past_value = past_key_value[1]
440
+
441
+ past_key = past_key[:, :, slicing_tokens:, :].contiguous()
442
+ past_value = past_value[:, :, slicing_tokens:, :].contiguous()
443
+
444
+ if past_key.shape[-2] != self.config.sliding_window - 1:
445
+ raise ValueError(
446
+ f"past key must have a shape of (`batch_size, num_heads, self.config.sliding_window-1, head_dim`), got"
447
+ f" {past_key.shape}"
448
+ )
449
+
450
+ past_key_value = (past_key, past_value)
451
+
452
+ if attention_mask is not None:
453
+ attention_mask = attention_mask[:, slicing_tokens:]
454
+ attention_mask = torch.cat([attention_mask, torch.ones_like(attention_mask[:, -1:])], dim=-1)
455
+
456
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
457
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
458
+
459
+ # repeat k/v heads if n_kv_heads < n_heads
460
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
461
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
462
+ dropout_rate = 0.0 if not self.training else self.attention_dropout
463
+
464
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
465
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
466
+ # cast them back in float16 just to be sure everything works as expected.
467
+ input_dtype = query_states.dtype
468
+ if input_dtype == torch.float32:
469
+ # Handle the case where the model is quantized
470
+ if hasattr(self.config, "_pre_quantization_dtype"):
471
+ target_dtype = self.config._pre_quantization_dtype
472
+ else:
473
+ target_dtype = self.q_proj.weight.dtype
474
+
475
+ logger.warning_once(
476
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
477
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
478
+ f" {target_dtype}."
479
+ )
480
+
481
+ query_states = query_states.to(target_dtype)
482
+ key_states = key_states.to(target_dtype)
483
+ value_states = value_states.to(target_dtype)
484
+
485
+ # Reashape to the expected shape for Flash Attention
486
+ query_states = query_states.transpose(1, 2)
487
+ key_states = key_states.transpose(1, 2)
488
+ value_states = value_states.transpose(1, 2)
489
+
490
+ attn_output = self._flash_attention_forward(
491
+ query_states,
492
+ key_states,
493
+ value_states,
494
+ attention_mask,
495
+ q_len,
496
+ dropout=dropout_rate,
497
+ use_sliding_windows=use_sliding_windows,
498
+ )
499
+
500
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
501
+ attn_output = self.o_proj(attn_output)
502
+
503
+ if not output_attentions:
504
+ attn_weights = None
505
+
506
+ return attn_output, attn_weights, past_key_value
507
+
508
+ def _flash_attention_forward(
509
+ self,
510
+ query_states,
511
+ key_states,
512
+ value_states,
513
+ attention_mask,
514
+ query_length,
515
+ dropout=0.0,
516
+ softmax_scale=None,
517
+ use_sliding_windows=False,
518
+ ):
519
+ """
520
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
521
+ first unpad the input, then computes the attention scores and pad the final attention scores.
522
+ Args:
523
+ query_states (`torch.Tensor`):
524
+ Input query states to be passed to Flash Attention API
525
+ key_states (`torch.Tensor`):
526
+ Input key states to be passed to Flash Attention API
527
+ value_states (`torch.Tensor`):
528
+ Input value states to be passed to Flash Attention API
529
+ attention_mask (`torch.Tensor`):
530
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
531
+ position of padding tokens and 1 for the position of non-padding tokens.
532
+ dropout (`int`, *optional*):
533
+ Attention dropout
534
+ softmax_scale (`float`, *optional*):
535
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
536
+ use_sliding_windows (`bool`, *optional*):
537
+ Whether to activate sliding window attention.
538
+ """
539
+ if not self._flash_attn_uses_top_left_mask:
540
+ causal = self.is_causal
541
+ else:
542
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
543
+ causal = self.is_causal and query_length != 1
544
+
545
+ # Contains at least one padding token in the sequence
546
+ if attention_mask is not None:
547
+ batch_size = query_states.shape[0]
548
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
549
+ query_states, key_states, value_states, attention_mask, query_length
550
+ )
551
+
552
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
553
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
554
+
555
+ if not use_sliding_windows:
556
+ attn_output_unpad = flash_attn_varlen_func(
557
+ query_states,
558
+ key_states,
559
+ value_states,
560
+ cu_seqlens_q=cu_seqlens_q,
561
+ cu_seqlens_k=cu_seqlens_k,
562
+ max_seqlen_q=max_seqlen_in_batch_q,
563
+ max_seqlen_k=max_seqlen_in_batch_k,
564
+ dropout_p=dropout,
565
+ softmax_scale=softmax_scale,
566
+ causal=causal,
567
+ )
568
+ else:
569
+ attn_output_unpad = flash_attn_varlen_func(
570
+ query_states,
571
+ key_states,
572
+ value_states,
573
+ cu_seqlens_q=cu_seqlens_q,
574
+ cu_seqlens_k=cu_seqlens_k,
575
+ max_seqlen_q=max_seqlen_in_batch_q,
576
+ max_seqlen_k=max_seqlen_in_batch_k,
577
+ dropout_p=dropout,
578
+ softmax_scale=softmax_scale,
579
+ causal=causal,
580
+ window_size=(self.config.sliding_window, self.config.sliding_window),
581
+ )
582
+
583
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
584
+ else:
585
+ if not use_sliding_windows:
586
+ attn_output = flash_attn_func(
587
+ query_states,
588
+ key_states,
589
+ value_states,
590
+ dropout,
591
+ softmax_scale=softmax_scale,
592
+ causal=causal,
593
+ )
594
+ else:
595
+ attn_output = flash_attn_func(
596
+ query_states,
597
+ key_states,
598
+ value_states,
599
+ dropout,
600
+ softmax_scale=softmax_scale,
601
+ causal=causal,
602
+ window_size=(self.config.sliding_window, self.config.sliding_window),
603
+ )
604
+
605
+ return attn_output
606
+
607
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
608
+ batch_size, kv_seq_len, num_heads, head_dim = key_layer.shape
609
+
610
+ # On the first iteration we need to properly re-create the padding mask
611
+ # by slicing it on the proper place
612
+ if kv_seq_len != attention_mask.shape[-1]:
613
+ attention_mask_num_tokens = attention_mask.shape[-1]
614
+ attention_mask = attention_mask[:, attention_mask_num_tokens - kv_seq_len :]
615
+
616
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
617
+
618
+ key_layer = index_first_axis(key_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
619
+ value_layer = index_first_axis(value_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
620
+
621
+ if query_length == kv_seq_len:
622
+ query_layer = index_first_axis(
623
+ query_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k
624
+ )
625
+ cu_seqlens_q = cu_seqlens_k
626
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
627
+ indices_q = indices_k
628
+ elif query_length == 1:
629
+ max_seqlen_in_batch_q = 1
630
+ cu_seqlens_q = torch.arange(
631
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
632
+ ) # There is a memcpy here, that is very bad.
633
+ indices_q = cu_seqlens_q[:-1]
634
+ query_layer = query_layer.squeeze(1)
635
+ else:
636
+ # The -q_len: slice assumes left padding.
637
+ attention_mask = attention_mask[:, -query_length:]
638
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
639
+
640
+ return (
641
+ query_layer,
642
+ key_layer,
643
+ value_layer,
644
+ indices_q,
645
+ (cu_seqlens_q, cu_seqlens_k),
646
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
647
+ )
648
+
649
+
650
+ class MistralDecoderLayer(nn.Module):
651
+ def __init__(self, config: MixtralConfig, layer_idx: int):
652
+ super().__init__()
653
+ self.hidden_size = config.hidden_size
654
+ self.self_attn = (
655
+ MistralAttention(config=config, layer_idx=layer_idx)
656
+ if not getattr(config, "_flash_attn_2_enabled", False)
657
+ else MistralFlashAttention2(config, layer_idx=layer_idx)
658
+ )
659
+ self.mlp = MoE(config)
660
+ self.input_layernorm = MistralRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
661
+ self.post_attention_layernorm = MistralRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
662
+
663
+ def forward(
664
+ self,
665
+ hidden_states: torch.Tensor,
666
+ attention_mask: Optional[torch.Tensor] = None,
667
+ position_ids: Optional[torch.LongTensor] = None,
668
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
669
+ output_attentions: Optional[bool] = False,
670
+ use_cache: Optional[bool] = False,
671
+ **kwargs,
672
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
673
+ if "padding_mask" in kwargs:
674
+ warnings.warn(
675
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
676
+ )
677
+ """
678
+ Args:
679
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
680
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
681
+ `(batch, sequence_length)` where padding elements are indicated by 0.
682
+ output_attentions (`bool`, *optional*):
683
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
684
+ returned tensors for more detail.
685
+ use_cache (`bool`, *optional*):
686
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
687
+ (see `past_key_values`).
688
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
689
+ """
690
+
691
+ residual = hidden_states
692
+
693
+ hidden_states = self.input_layernorm(hidden_states)
694
+
695
+ # Self Attention
696
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
697
+ hidden_states=hidden_states,
698
+ attention_mask=attention_mask,
699
+ position_ids=position_ids,
700
+ past_key_value=past_key_value,
701
+ output_attentions=output_attentions,
702
+ use_cache=use_cache,
703
+ )
704
+ hidden_states = residual + hidden_states
705
+
706
+ # Fully Connected
707
+ residual = hidden_states
708
+ hidden_states = self.post_attention_layernorm(hidden_states)
709
+ hidden_states = self.mlp(hidden_states)
710
+ hidden_states = residual + hidden_states
711
+
712
+ outputs = (hidden_states,)
713
+
714
+ if output_attentions:
715
+ outputs += (self_attn_weights,)
716
+
717
+ if use_cache:
718
+ outputs += (present_key_value,)
719
+
720
+ return outputs
721
+
722
+
723
+ MISTRAL_START_DOCSTRING = r"""
724
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
725
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
726
+ etc.)
727
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
728
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
729
+ and behavior.
730
+ Parameters:
731
+ config ([`MixtralConfig`]):
732
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
733
+ load the weights associated with the model, only the configuration. Check out the
734
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
735
+ """
736
+
737
+
738
+ @add_start_docstrings(
739
+ "The bare Mistral Model outputting raw hidden-states without any specific head on top.",
740
+ MISTRAL_START_DOCSTRING,
741
+ )
742
+ class MistralPreTrainedModel(PreTrainedModel):
743
+ config_class = MixtralConfig
744
+ base_model_prefix = "model"
745
+ supports_gradient_checkpointing = True
746
+ _no_split_modules = ["MistralDecoderLayer"]
747
+ _skip_keys_device_placement = "past_key_values"
748
+ _supports_flash_attn_2 = True
749
+ _supports_cache_class = True
750
+
751
+ def _init_weights(self, module):
752
+ std = self.config.initializer_range
753
+ if isinstance(module, nn.Linear):
754
+ module.weight.data.normal_(mean=0.0, std=std)
755
+ if module.bias is not None:
756
+ module.bias.data.zero_()
757
+ elif isinstance(module, nn.Embedding):
758
+ module.weight.data.normal_(mean=0.0, std=std)
759
+ if module.padding_idx is not None:
760
+ module.weight.data[module.padding_idx].zero_()
761
+
762
+
763
+ MISTRAL_INPUTS_DOCSTRING = r"""
764
+ Args:
765
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
766
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
767
+ it.
768
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
769
+ [`PreTrainedTokenizer.__call__`] for details.
770
+ [What are input IDs?](../glossary#input-ids)
771
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
772
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
773
+ - 1 for tokens that are **not masked**,
774
+ - 0 for tokens that are **masked**.
775
+ [What are attention masks?](../glossary#attention-mask)
776
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
777
+ [`PreTrainedTokenizer.__call__`] for details.
778
+ If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
779
+ `past_key_values`).
780
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
781
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
782
+ information on the default strategy.
783
+ - 1 indicates the head is **not masked**,
784
+ - 0 indicates the head is **masked**.
785
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
786
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
787
+ config.n_positions - 1]`.
788
+ [What are position IDs?](../glossary#position-ids)
789
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
790
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
791
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
792
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
793
+ Two formats are allowed:
794
+ - a [`~cache_utils.Cache`] instance;
795
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
796
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
797
+ cache format.
798
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
799
+ legacy cache format will be returned.
800
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
801
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
802
+ of shape `(batch_size, sequence_length)`.
803
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
804
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
805
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
806
+ model's internal embedding lookup matrix.
807
+ use_cache (`bool`, *optional*):
808
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
809
+ `past_key_values`).
810
+ output_attentions (`bool`, *optional*):
811
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
812
+ tensors for more detail.
813
+ output_hidden_states (`bool`, *optional*):
814
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
815
+ more detail.
816
+ return_dict (`bool`, *optional*):
817
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
818
+ """
819
+
820
+
821
+ @add_start_docstrings(
822
+ "The bare Mistral Model outputting raw hidden-states without any specific head on top.",
823
+ MISTRAL_START_DOCSTRING,
824
+ )
825
+ class MistralModel(MistralPreTrainedModel):
826
+ """
827
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MistralDecoderLayer`]
828
+ Args:
829
+ config: MixtralConfig
830
+ """
831
+
832
+ def __init__(self, config: MixtralConfig):
833
+ super().__init__(config)
834
+ self.padding_idx = config.pad_token_id
835
+ self.vocab_size = config.vocab_size
836
+
837
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
838
+ self.layers = nn.ModuleList(
839
+ [MistralDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
840
+ )
841
+ self.norm = MistralRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
842
+
843
+ self.gradient_checkpointing = False
844
+ # Initialize weights and apply final processing
845
+ self.post_init()
846
+
847
+ def get_input_embeddings(self):
848
+ return self.embed_tokens
849
+
850
+ def set_input_embeddings(self, value):
851
+ self.embed_tokens = value
852
+
853
+ @add_start_docstrings_to_model_forward(MISTRAL_INPUTS_DOCSTRING)
854
+ def forward(
855
+ self,
856
+ input_ids: torch.LongTensor = None,
857
+ attention_mask: Optional[torch.Tensor] = None,
858
+ position_ids: Optional[torch.LongTensor] = None,
859
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
860
+ inputs_embeds: Optional[torch.FloatTensor] = None,
861
+ use_cache: Optional[bool] = None,
862
+ output_attentions: Optional[bool] = None,
863
+ output_hidden_states: Optional[bool] = None,
864
+ return_dict: Optional[bool] = None,
865
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
866
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
867
+ output_hidden_states = (
868
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
869
+ )
870
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
871
+
872
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
873
+
874
+ # retrieve input_ids and inputs_embeds
875
+ if input_ids is not None and inputs_embeds is not None:
876
+ raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
877
+ elif input_ids is not None:
878
+ batch_size, seq_length = input_ids.shape
879
+ elif inputs_embeds is not None:
880
+ batch_size, seq_length, _ = inputs_embeds.shape
881
+ else:
882
+ raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
883
+
884
+ seq_length_with_past = seq_length
885
+ past_key_values_length = 0
886
+
887
+ if use_cache:
888
+ use_legacy_cache = not isinstance(past_key_values, Cache)
889
+ if use_legacy_cache:
890
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
891
+ past_key_values_length = past_key_values.get_seq_length()
892
+ seq_length_with_past = seq_length_with_past + past_key_values_length
893
+
894
+ if position_ids is None:
895
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
896
+ position_ids = torch.arange(
897
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
898
+ )
899
+ position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
900
+ else:
901
+ position_ids = position_ids.view(-1, seq_length).long()
902
+
903
+ if inputs_embeds is None:
904
+ inputs_embeds = self.embed_tokens(input_ids)
905
+
906
+ if (
907
+ attention_mask is not None
908
+ and hasattr(self.config, "_flash_attn_2_enabled")
909
+ and self.config._flash_attn_2_enabled
910
+ and use_cache
911
+ ):
912
+ is_padding_right = attention_mask[:, -1].sum().item() != batch_size
913
+ if is_padding_right:
914
+ raise ValueError(
915
+ "You are attempting to perform batched generation with padding_side='right'"
916
+ " this may lead to unexpected behaviour for Flash Attention version of Mistral. Make sure to "
917
+ " call `tokenizer.padding_side = 'left'` before tokenizing the input. "
918
+ )
919
+
920
+ if getattr(self.config, "_flash_attn_2_enabled", False):
921
+ # 2d mask is passed through the layers
922
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
923
+ else:
924
+ # 4d mask is passed through the layers
925
+ attention_mask = _prepare_4d_causal_attention_mask(
926
+ attention_mask,
927
+ (batch_size, seq_length),
928
+ inputs_embeds,
929
+ past_key_values_length
930
+ )
931
+
932
+ hidden_states = inputs_embeds
933
+
934
+ if self.gradient_checkpointing and self.training:
935
+ if use_cache:
936
+ logger.warning_once(
937
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
938
+ )
939
+ use_cache = False
940
+
941
+ # decoder layers
942
+ all_hidden_states = () if output_hidden_states else None
943
+ all_self_attns = () if output_attentions else None
944
+ next_decoder_cache = None
945
+
946
+ for decoder_layer in self.layers:
947
+ if output_hidden_states:
948
+ all_hidden_states += (hidden_states,)
949
+
950
+ if self.gradient_checkpointing and self.training:
951
+ layer_outputs = self._gradient_checkpointing_func(
952
+ decoder_layer.__call__,
953
+ hidden_states,
954
+ attention_mask,
955
+ position_ids,
956
+ past_key_values,
957
+ output_attentions,
958
+ use_cache,
959
+ )
960
+ else:
961
+ layer_outputs = decoder_layer(
962
+ hidden_states,
963
+ attention_mask=attention_mask,
964
+ position_ids=position_ids,
965
+ past_key_value=past_key_values,
966
+ output_attentions=output_attentions,
967
+ use_cache=use_cache,
968
+ )
969
+
970
+ hidden_states = layer_outputs[0]
971
+
972
+ if use_cache:
973
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
974
+
975
+ if output_attentions:
976
+ all_self_attns += (layer_outputs[1],)
977
+
978
+ hidden_states = self.norm(hidden_states)
979
+
980
+ # add hidden states from the last decoder layer
981
+ if output_hidden_states:
982
+ all_hidden_states += (hidden_states,)
983
+
984
+ next_cache = None
985
+ if use_cache:
986
+ next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
987
+
988
+ if not return_dict:
989
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
990
+ return BaseModelOutputWithPast(
991
+ last_hidden_state=hidden_states,
992
+ past_key_values=next_cache,
993
+ hidden_states=all_hidden_states,
994
+ attentions=all_self_attns,
995
+ )
996
+
997
+
998
+ class MixtralForCausalLM(MistralPreTrainedModel):
999
+ _tied_weights_keys = ["lm_head.weight"]
1000
+
1001
+ def __init__(self, config):
1002
+ super().__init__(config)
1003
+ self.model = MistralModel(config)
1004
+ self.vocab_size = config.vocab_size
1005
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1006
+
1007
+ # Initialize weights and apply final processing
1008
+ self.post_init()
1009
+
1010
+ def get_input_embeddings(self):
1011
+ return self.model.embed_tokens
1012
+
1013
+ def set_input_embeddings(self, value):
1014
+ self.model.embed_tokens = value
1015
+
1016
+ def get_output_embeddings(self):
1017
+ return self.lm_head
1018
+
1019
+ def set_output_embeddings(self, new_embeddings):
1020
+ self.lm_head = new_embeddings
1021
+
1022
+ def set_decoder(self, decoder):
1023
+ self.model = decoder
1024
+
1025
+ def get_decoder(self):
1026
+ return self.model
1027
+
1028
+ def _init_weights(self, module):
1029
+ return
1030
+
1031
+ @add_start_docstrings_to_model_forward(MISTRAL_INPUTS_DOCSTRING)
1032
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1033
+ def forward(
1034
+ self,
1035
+ input_ids: torch.LongTensor = None,
1036
+ attention_mask: Optional[torch.Tensor] = None,
1037
+ position_ids: Optional[torch.LongTensor] = None,
1038
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1039
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1040
+ labels: Optional[torch.LongTensor] = None,
1041
+ use_cache: Optional[bool] = None,
1042
+ output_attentions: Optional[bool] = None,
1043
+ output_hidden_states: Optional[bool] = None,
1044
+ return_dict: Optional[bool] = None,
1045
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1046
+ r"""
1047
+ Args:
1048
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1049
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1050
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1051
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1052
+ Returns:
1053
+ Example:
1054
+ ```python
1055
+ >>> from transformers import AutoTokenizer, MistralForCausalLM
1056
+ >>> model = MistralForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
1057
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
1058
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1059
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1060
+ >>> # Generate
1061
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1062
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1063
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1064
+ ```"""
1065
+
1066
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1067
+ output_hidden_states = (
1068
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1069
+ )
1070
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1071
+
1072
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1073
+ outputs = self.model(
1074
+ input_ids=input_ids,
1075
+ attention_mask=attention_mask,
1076
+ position_ids=position_ids,
1077
+ past_key_values=past_key_values,
1078
+ inputs_embeds=inputs_embeds,
1079
+ use_cache=use_cache,
1080
+ output_attentions=output_attentions,
1081
+ output_hidden_states=output_hidden_states,
1082
+ return_dict=return_dict,
1083
+ )
1084
+
1085
+ hidden_states = outputs[0]
1086
+ logits = self.lm_head(hidden_states)
1087
+ logits = logits.float()
1088
+
1089
+ loss = None
1090
+ if labels is not None:
1091
+ # Shift so that tokens < n predict n
1092
+ shift_logits = logits[..., :-1, :].contiguous()
1093
+ shift_labels = labels[..., 1:].contiguous()
1094
+ # Flatten the tokens
1095
+ loss_fct = CrossEntropyLoss()
1096
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1097
+ shift_labels = shift_labels.view(-1)
1098
+ # Enable model parallelism
1099
+ shift_labels = shift_labels.to(shift_logits.device)
1100
+ loss = loss_fct(shift_logits, shift_labels)
1101
+
1102
+ if not return_dict:
1103
+ output = (logits,) + outputs[1:]
1104
+ return (loss,) + output if loss is not None else output
1105
+
1106
+ return CausalLMOutputWithPast(
1107
+ loss=loss,
1108
+ logits=logits,
1109
+ past_key_values=outputs.past_key_values,
1110
+ hidden_states=outputs.hidden_states,
1111
+ attentions=outputs.attentions,
1112
+ )
1113
+
1114
+ def prepare_inputs_for_generation(
1115
+ self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
1116
+ ):
1117
+ # Omit tokens covered by past_key_values
1118
+ if past_key_values is not None:
1119
+ if isinstance(past_key_values, Cache):
1120
+ cache_length = past_key_values.get_seq_length()
1121
+ past_length = past_key_values.seen_tokens
1122
+ else:
1123
+ cache_length = past_length = past_key_values[0][0].shape[2]
1124
+
1125
+ # Keep only the unprocessed tokens:
1126
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
1127
+ # some of the inputs are exclusivelly passed as part of the cache (e.g. when passing input_embeds as
1128
+ # input)
1129
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
1130
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
1131
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
1132
+ # input_ids based on the past_length.
1133
+ elif past_length < input_ids.shape[1]:
1134
+ input_ids = input_ids[:, past_length:]
1135
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
1136
+
1137
+ # If the cache has seen more tokens than it can hold, then the cache has a size limit. Let's discard the
1138
+ # older attention values, as their corresponding values are not part of the input.
1139
+ if cache_length < past_length and attention_mask is not None:
1140
+ attention_mask = attention_mask[:, -(cache_length + input_ids.shape[1]) :]
1141
+
1142
+ position_ids = kwargs.get("position_ids", None)
1143
+ if attention_mask is not None and position_ids is None:
1144
+ # create position_ids on the fly for batch generation
1145
+ position_ids = attention_mask.long().cumsum(-1) - 1
1146
+ position_ids.masked_fill_(attention_mask == 0, 1)
1147
+ if past_key_values:
1148
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1149
+
1150
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1151
+ if inputs_embeds is not None and past_key_values is None:
1152
+ model_inputs = {"inputs_embeds": inputs_embeds}
1153
+ else:
1154
+ model_inputs = {"input_ids": input_ids}
1155
+
1156
+ model_inputs.update(
1157
+ {
1158
+ "position_ids": position_ids,
1159
+ "past_key_values": past_key_values,
1160
+ "use_cache": kwargs.get("use_cache"),
1161
+ "attention_mask": attention_mask,
1162
+ }
1163
+ )
1164
+ return model_inputs
1165
+
1166
+ @staticmethod
1167
+ def _reorder_cache(past_key_values, beam_idx):
1168
+ reordered_past = ()
1169
+ for layer_past in past_key_values:
1170
+ reordered_past += (
1171
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
1172
+ )
1173
+ return reordered_past
1174
+
1175
+
1176
+ @add_start_docstrings(
1177
+ """
1178
+ The Mistral Model transformer with a sequence classification head on top (linear layer).
1179
+ [`MistralForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1180
+ (e.g. GPT-2) do.
1181
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1182
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1183
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1184
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1185
+ each row of the batch).
1186
+ """,
1187
+ MISTRAL_START_DOCSTRING,
1188
+ )
1189
+ # Copied from transformers.models.llama.modeling_llama.LlamaForSequenceClassification with Llama->Mistral, LLAMA->MISTRAL
1190
+ class MistralForSequenceClassification(MistralPreTrainedModel):
1191
+ def __init__(self, config):
1192
+ super().__init__(config)
1193
+ self.num_labels = config.num_labels
1194
+ self.model = MistralModel(config)
1195
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1196
+
1197
+ # Initialize weights and apply final processing
1198
+ self.post_init()
1199
+
1200
+ def get_input_embeddings(self):
1201
+ return self.model.embed_tokens
1202
+
1203
+ def set_input_embeddings(self, value):
1204
+ self.model.embed_tokens = value
1205
+
1206
+ @add_start_docstrings_to_model_forward(MISTRAL_INPUTS_DOCSTRING)
1207
+ def forward(
1208
+ self,
1209
+ input_ids: torch.LongTensor = None,
1210
+ attention_mask: Optional[torch.Tensor] = None,
1211
+ position_ids: Optional[torch.LongTensor] = None,
1212
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1213
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1214
+ labels: Optional[torch.LongTensor] = None,
1215
+ use_cache: Optional[bool] = None,
1216
+ output_attentions: Optional[bool] = None,
1217
+ output_hidden_states: Optional[bool] = None,
1218
+ return_dict: Optional[bool] = None,
1219
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1220
+ r"""
1221
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1222
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1223
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1224
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1225
+ """
1226
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1227
+
1228
+ transformer_outputs = self.model(
1229
+ input_ids,
1230
+ attention_mask=attention_mask,
1231
+ position_ids=position_ids,
1232
+ past_key_values=past_key_values,
1233
+ inputs_embeds=inputs_embeds,
1234
+ use_cache=use_cache,
1235
+ output_attentions=output_attentions,
1236
+ output_hidden_states=output_hidden_states,
1237
+ return_dict=return_dict,
1238
+ )
1239
+ hidden_states = transformer_outputs[0]
1240
+ logits = self.score(hidden_states)
1241
+
1242
+ if input_ids is not None:
1243
+ batch_size = input_ids.shape[0]
1244
+ else:
1245
+ batch_size = inputs_embeds.shape[0]
1246
+
1247
+ if self.config.pad_token_id is None and batch_size != 1:
1248
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1249
+ if self.config.pad_token_id is None:
1250
+ sequence_lengths = -1
1251
+ else:
1252
+ if input_ids is not None:
1253
+ sequence_lengths = (torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1).to(
1254
+ logits.device
1255
+ )
1256
+ else:
1257
+ sequence_lengths = -1
1258
+
1259
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1260
+
1261
+ loss = None
1262
+ if labels is not None:
1263
+ labels = labels.to(logits.device)
1264
+ if self.config.problem_type is None:
1265
+ if self.num_labels == 1:
1266
+ self.config.problem_type = "regression"
1267
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1268
+ self.config.problem_type = "single_label_classification"
1269
+ else:
1270
+ self.config.problem_type = "multi_label_classification"
1271
+
1272
+ if self.config.problem_type == "regression":
1273
+ loss_fct = MSELoss()
1274
+ if self.num_labels == 1:
1275
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1276
+ else:
1277
+ loss = loss_fct(pooled_logits, labels)
1278
+ elif self.config.problem_type == "single_label_classification":
1279
+ loss_fct = CrossEntropyLoss()
1280
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1281
+ elif self.config.problem_type == "multi_label_classification":
1282
+ loss_fct = BCEWithLogitsLoss()
1283
+ loss = loss_fct(pooled_logits, labels)
1284
+ if not return_dict:
1285
+ output = (pooled_logits,) + transformer_outputs[1:]
1286
+ return ((loss,) + output) if loss is not None else output
1287
+
1288
+ return SequenceClassifierOutputWithPast(
1289
+ loss=loss,
1290
+ logits=pooled_logits,
1291
+ past_key_values=transformer_outputs.past_key_values,
1292
+ hidden_states=transformer_outputs.hidden_states,
1293
+ attentions=transformer_outputs.attentions,
1294
+ )
pytorch_model-00001-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02350e64225ab0c720bb226afecb72adaea918d32e2fba2f29c0e770626333e4
3
+ size 4892763299
pytorch_model-00002-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4661eed0ac37df40d5a761916e3c7de34f5fc5d30d9f52de1491a719831b4b08
3
+ size 4983016317
pytorch_model-00003-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9793bbbd17a9abee92be42953b54bc3232a4376843aeb5ec346b8f4f4bcc433
3
+ size 4983016401
pytorch_model-00004-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c0452c87ce1451a904c31d85a55a82519f01357138966200e25df21110b385e
3
+ size 4899045823
pytorch_model-00005-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10b1331f6e01ebbd80739d7eca987d624553118d58134d7a3057de7add4d658b
3
+ size 4983016353
pytorch_model-00006-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ec11eb231565823ca405d0eb64be5f15d85805cb2a3a3cb75dd606d3d19f4a7
3
+ size 4983016317
pytorch_model-00007-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b10856848f422cc362776edf77f442d2caf8d3878d4df73a652d21c4b201bc79
3
+ size 4899045887
pytorch_model-00008-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9679cefd9bc7d6b2d0cdbccbf2a6ed0fdf5a52e5899d04a50f2ab3f0d5a9f9d6
3
+ size 4983016441
pytorch_model-00009-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8683c7294d1eb52df87c9a125365687002dbfb09c482627032c5b0d545376418
3
+ size 4983016381
pytorch_model-00010-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e14baf1586f63e2b135f8d59a0d3f73b88db69495845b987ce220686752eaaf3
3
+ size 4899045887
pytorch_model-00011-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e31d56f8475c6a3feefa7eb6a1b314691427891038bfa84179ea577549258152
3
+ size 4983016405
pytorch_model-00012-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:634281cddcdc754de81ead6ace0fc1e9f738b603eda9a17d5e763ed11c5a6d1f
3
+ size 4983016405
pytorch_model-00013-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a7d0b622adc241d01c15bcc0665062e9b4b04cb79e074ca98a78a3317556408
3
+ size 4983016381
pytorch_model-00014-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cfbaad438cc0912f26e0af1a0f92ee01890e6809391fe3b7d4b7153b50680ed
3
+ size 4899045887
pytorch_model-00015-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b653341a03d7b87d42bed9f1c6ea171e7b848913bcc47b8a1e3b71bff4c4984f
3
+ size 4983016441
pytorch_model-00016-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e592003dc5a94cfe1b51642ce49a70b265777efebfc16adc31aa8b4d11313f41
3
+ size 4983016381
pytorch_model-00017-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:220e4a7284070f05e7796a7f974d47485e2a139d27d596a7e8f30b655f88fb2b
3
+ size 4899045887
pytorch_model-00018-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3034cd2490c7d69e39acfb2f4e3322d417a57e88488e152f8b96b1c3411bbd17
3
+ size 4983016417
pytorch_model-00019-of-00019.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e90b51dc00188efe223f397198476d7a16ff4f63ac9d7df453926aa388cc469d
3
+ size 4221762873
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,1002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 93405601792
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00019-of-00019.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00019.bin",
8
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00019.bin",
9
+ "model.layers.0.mlp.experts.0.w1.weight": "pytorch_model-00001-of-00019.bin",
10
+ "model.layers.0.mlp.experts.0.w2.weight": "pytorch_model-00001-of-00019.bin",
11
+ "model.layers.0.mlp.experts.0.w3.weight": "pytorch_model-00001-of-00019.bin",
12
+ "model.layers.0.mlp.experts.1.w1.weight": "pytorch_model-00001-of-00019.bin",
13
+ "model.layers.0.mlp.experts.1.w2.weight": "pytorch_model-00001-of-00019.bin",
14
+ "model.layers.0.mlp.experts.1.w3.weight": "pytorch_model-00001-of-00019.bin",
15
+ "model.layers.0.mlp.experts.2.w1.weight": "pytorch_model-00001-of-00019.bin",
16
+ "model.layers.0.mlp.experts.2.w2.weight": "pytorch_model-00001-of-00019.bin",
17
+ "model.layers.0.mlp.experts.2.w3.weight": "pytorch_model-00001-of-00019.bin",
18
+ "model.layers.0.mlp.experts.3.w1.weight": "pytorch_model-00001-of-00019.bin",
19
+ "model.layers.0.mlp.experts.3.w2.weight": "pytorch_model-00001-of-00019.bin",
20
+ "model.layers.0.mlp.experts.3.w3.weight": "pytorch_model-00001-of-00019.bin",
21
+ "model.layers.0.mlp.experts.4.w1.weight": "pytorch_model-00001-of-00019.bin",
22
+ "model.layers.0.mlp.experts.4.w2.weight": "pytorch_model-00001-of-00019.bin",
23
+ "model.layers.0.mlp.experts.4.w3.weight": "pytorch_model-00001-of-00019.bin",
24
+ "model.layers.0.mlp.experts.5.w1.weight": "pytorch_model-00001-of-00019.bin",
25
+ "model.layers.0.mlp.experts.5.w2.weight": "pytorch_model-00001-of-00019.bin",
26
+ "model.layers.0.mlp.experts.5.w3.weight": "pytorch_model-00001-of-00019.bin",
27
+ "model.layers.0.mlp.experts.6.w1.weight": "pytorch_model-00001-of-00019.bin",
28
+ "model.layers.0.mlp.experts.6.w2.weight": "pytorch_model-00001-of-00019.bin",
29
+ "model.layers.0.mlp.experts.6.w3.weight": "pytorch_model-00001-of-00019.bin",
30
+ "model.layers.0.mlp.experts.7.w1.weight": "pytorch_model-00001-of-00019.bin",
31
+ "model.layers.0.mlp.experts.7.w2.weight": "pytorch_model-00001-of-00019.bin",
32
+ "model.layers.0.mlp.experts.7.w3.weight": "pytorch_model-00001-of-00019.bin",
33
+ "model.layers.0.mlp.gate.weight": "pytorch_model-00001-of-00019.bin",
34
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00019.bin",
35
+ "model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00019.bin",
36
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00019.bin",
37
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00019.bin",
38
+ "model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00019.bin",
39
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00002-of-00019.bin",
40
+ "model.layers.1.mlp.experts.0.w1.weight": "pytorch_model-00001-of-00019.bin",
41
+ "model.layers.1.mlp.experts.0.w2.weight": "pytorch_model-00001-of-00019.bin",
42
+ "model.layers.1.mlp.experts.0.w3.weight": "pytorch_model-00001-of-00019.bin",
43
+ "model.layers.1.mlp.experts.1.w1.weight": "pytorch_model-00001-of-00019.bin",
44
+ "model.layers.1.mlp.experts.1.w2.weight": "pytorch_model-00001-of-00019.bin",
45
+ "model.layers.1.mlp.experts.1.w3.weight": "pytorch_model-00001-of-00019.bin",
46
+ "model.layers.1.mlp.experts.2.w1.weight": "pytorch_model-00001-of-00019.bin",
47
+ "model.layers.1.mlp.experts.2.w2.weight": "pytorch_model-00001-of-00019.bin",
48
+ "model.layers.1.mlp.experts.2.w3.weight": "pytorch_model-00001-of-00019.bin",
49
+ "model.layers.1.mlp.experts.3.w1.weight": "pytorch_model-00001-of-00019.bin",
50
+ "model.layers.1.mlp.experts.3.w2.weight": "pytorch_model-00001-of-00019.bin",
51
+ "model.layers.1.mlp.experts.3.w3.weight": "pytorch_model-00001-of-00019.bin",
52
+ "model.layers.1.mlp.experts.4.w1.weight": "pytorch_model-00001-of-00019.bin",
53
+ "model.layers.1.mlp.experts.4.w2.weight": "pytorch_model-00001-of-00019.bin",
54
+ "model.layers.1.mlp.experts.4.w3.weight": "pytorch_model-00002-of-00019.bin",
55
+ "model.layers.1.mlp.experts.5.w1.weight": "pytorch_model-00002-of-00019.bin",
56
+ "model.layers.1.mlp.experts.5.w2.weight": "pytorch_model-00002-of-00019.bin",
57
+ "model.layers.1.mlp.experts.5.w3.weight": "pytorch_model-00002-of-00019.bin",
58
+ "model.layers.1.mlp.experts.6.w1.weight": "pytorch_model-00002-of-00019.bin",
59
+ "model.layers.1.mlp.experts.6.w2.weight": "pytorch_model-00002-of-00019.bin",
60
+ "model.layers.1.mlp.experts.6.w3.weight": "pytorch_model-00002-of-00019.bin",
61
+ "model.layers.1.mlp.experts.7.w1.weight": "pytorch_model-00002-of-00019.bin",
62
+ "model.layers.1.mlp.experts.7.w2.weight": "pytorch_model-00002-of-00019.bin",
63
+ "model.layers.1.mlp.experts.7.w3.weight": "pytorch_model-00002-of-00019.bin",
64
+ "model.layers.1.mlp.gate.weight": "pytorch_model-00002-of-00019.bin",
65
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00002-of-00019.bin",
66
+ "model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00019.bin",
67
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00019.bin",
68
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00019.bin",
69
+ "model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00019.bin",
70
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00007-of-00019.bin",
71
+ "model.layers.10.mlp.experts.0.w1.weight": "pytorch_model-00006-of-00019.bin",
72
+ "model.layers.10.mlp.experts.0.w2.weight": "pytorch_model-00006-of-00019.bin",
73
+ "model.layers.10.mlp.experts.0.w3.weight": "pytorch_model-00006-of-00019.bin",
74
+ "model.layers.10.mlp.experts.1.w1.weight": "pytorch_model-00007-of-00019.bin",
75
+ "model.layers.10.mlp.experts.1.w2.weight": "pytorch_model-00007-of-00019.bin",
76
+ "model.layers.10.mlp.experts.1.w3.weight": "pytorch_model-00007-of-00019.bin",
77
+ "model.layers.10.mlp.experts.2.w1.weight": "pytorch_model-00007-of-00019.bin",
78
+ "model.layers.10.mlp.experts.2.w2.weight": "pytorch_model-00007-of-00019.bin",
79
+ "model.layers.10.mlp.experts.2.w3.weight": "pytorch_model-00007-of-00019.bin",
80
+ "model.layers.10.mlp.experts.3.w1.weight": "pytorch_model-00007-of-00019.bin",
81
+ "model.layers.10.mlp.experts.3.w2.weight": "pytorch_model-00007-of-00019.bin",
82
+ "model.layers.10.mlp.experts.3.w3.weight": "pytorch_model-00007-of-00019.bin",
83
+ "model.layers.10.mlp.experts.4.w1.weight": "pytorch_model-00007-of-00019.bin",
84
+ "model.layers.10.mlp.experts.4.w2.weight": "pytorch_model-00007-of-00019.bin",
85
+ "model.layers.10.mlp.experts.4.w3.weight": "pytorch_model-00007-of-00019.bin",
86
+ "model.layers.10.mlp.experts.5.w1.weight": "pytorch_model-00007-of-00019.bin",
87
+ "model.layers.10.mlp.experts.5.w2.weight": "pytorch_model-00007-of-00019.bin",
88
+ "model.layers.10.mlp.experts.5.w3.weight": "pytorch_model-00007-of-00019.bin",
89
+ "model.layers.10.mlp.experts.6.w1.weight": "pytorch_model-00007-of-00019.bin",
90
+ "model.layers.10.mlp.experts.6.w2.weight": "pytorch_model-00007-of-00019.bin",
91
+ "model.layers.10.mlp.experts.6.w3.weight": "pytorch_model-00007-of-00019.bin",
92
+ "model.layers.10.mlp.experts.7.w1.weight": "pytorch_model-00007-of-00019.bin",
93
+ "model.layers.10.mlp.experts.7.w2.weight": "pytorch_model-00007-of-00019.bin",
94
+ "model.layers.10.mlp.experts.7.w3.weight": "pytorch_model-00007-of-00019.bin",
95
+ "model.layers.10.mlp.gate.weight": "pytorch_model-00007-of-00019.bin",
96
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00007-of-00019.bin",
97
+ "model.layers.10.self_attn.k_proj.weight": "pytorch_model-00006-of-00019.bin",
98
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00006-of-00019.bin",
99
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00006-of-00019.bin",
100
+ "model.layers.10.self_attn.v_proj.weight": "pytorch_model-00006-of-00019.bin",
101
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00008-of-00019.bin",
102
+ "model.layers.11.mlp.experts.0.w1.weight": "pytorch_model-00007-of-00019.bin",
103
+ "model.layers.11.mlp.experts.0.w2.weight": "pytorch_model-00007-of-00019.bin",
104
+ "model.layers.11.mlp.experts.0.w3.weight": "pytorch_model-00007-of-00019.bin",
105
+ "model.layers.11.mlp.experts.1.w1.weight": "pytorch_model-00007-of-00019.bin",
106
+ "model.layers.11.mlp.experts.1.w2.weight": "pytorch_model-00007-of-00019.bin",
107
+ "model.layers.11.mlp.experts.1.w3.weight": "pytorch_model-00007-of-00019.bin",
108
+ "model.layers.11.mlp.experts.2.w1.weight": "pytorch_model-00007-of-00019.bin",
109
+ "model.layers.11.mlp.experts.2.w2.weight": "pytorch_model-00007-of-00019.bin",
110
+ "model.layers.11.mlp.experts.2.w3.weight": "pytorch_model-00007-of-00019.bin",
111
+ "model.layers.11.mlp.experts.3.w1.weight": "pytorch_model-00007-of-00019.bin",
112
+ "model.layers.11.mlp.experts.3.w2.weight": "pytorch_model-00007-of-00019.bin",
113
+ "model.layers.11.mlp.experts.3.w3.weight": "pytorch_model-00007-of-00019.bin",
114
+ "model.layers.11.mlp.experts.4.w1.weight": "pytorch_model-00007-of-00019.bin",
115
+ "model.layers.11.mlp.experts.4.w2.weight": "pytorch_model-00007-of-00019.bin",
116
+ "model.layers.11.mlp.experts.4.w3.weight": "pytorch_model-00007-of-00019.bin",
117
+ "model.layers.11.mlp.experts.5.w1.weight": "pytorch_model-00007-of-00019.bin",
118
+ "model.layers.11.mlp.experts.5.w2.weight": "pytorch_model-00007-of-00019.bin",
119
+ "model.layers.11.mlp.experts.5.w3.weight": "pytorch_model-00007-of-00019.bin",
120
+ "model.layers.11.mlp.experts.6.w1.weight": "pytorch_model-00007-of-00019.bin",
121
+ "model.layers.11.mlp.experts.6.w2.weight": "pytorch_model-00007-of-00019.bin",
122
+ "model.layers.11.mlp.experts.6.w3.weight": "pytorch_model-00008-of-00019.bin",
123
+ "model.layers.11.mlp.experts.7.w1.weight": "pytorch_model-00008-of-00019.bin",
124
+ "model.layers.11.mlp.experts.7.w2.weight": "pytorch_model-00008-of-00019.bin",
125
+ "model.layers.11.mlp.experts.7.w3.weight": "pytorch_model-00008-of-00019.bin",
126
+ "model.layers.11.mlp.gate.weight": "pytorch_model-00008-of-00019.bin",
127
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00008-of-00019.bin",
128
+ "model.layers.11.self_attn.k_proj.weight": "pytorch_model-00007-of-00019.bin",
129
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00007-of-00019.bin",
130
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00007-of-00019.bin",
131
+ "model.layers.11.self_attn.v_proj.weight": "pytorch_model-00007-of-00019.bin",
132
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00008-of-00019.bin",
133
+ "model.layers.12.mlp.experts.0.w1.weight": "pytorch_model-00008-of-00019.bin",
134
+ "model.layers.12.mlp.experts.0.w2.weight": "pytorch_model-00008-of-00019.bin",
135
+ "model.layers.12.mlp.experts.0.w3.weight": "pytorch_model-00008-of-00019.bin",
136
+ "model.layers.12.mlp.experts.1.w1.weight": "pytorch_model-00008-of-00019.bin",
137
+ "model.layers.12.mlp.experts.1.w2.weight": "pytorch_model-00008-of-00019.bin",
138
+ "model.layers.12.mlp.experts.1.w3.weight": "pytorch_model-00008-of-00019.bin",
139
+ "model.layers.12.mlp.experts.2.w1.weight": "pytorch_model-00008-of-00019.bin",
140
+ "model.layers.12.mlp.experts.2.w2.weight": "pytorch_model-00008-of-00019.bin",
141
+ "model.layers.12.mlp.experts.2.w3.weight": "pytorch_model-00008-of-00019.bin",
142
+ "model.layers.12.mlp.experts.3.w1.weight": "pytorch_model-00008-of-00019.bin",
143
+ "model.layers.12.mlp.experts.3.w2.weight": "pytorch_model-00008-of-00019.bin",
144
+ "model.layers.12.mlp.experts.3.w3.weight": "pytorch_model-00008-of-00019.bin",
145
+ "model.layers.12.mlp.experts.4.w1.weight": "pytorch_model-00008-of-00019.bin",
146
+ "model.layers.12.mlp.experts.4.w2.weight": "pytorch_model-00008-of-00019.bin",
147
+ "model.layers.12.mlp.experts.4.w3.weight": "pytorch_model-00008-of-00019.bin",
148
+ "model.layers.12.mlp.experts.5.w1.weight": "pytorch_model-00008-of-00019.bin",
149
+ "model.layers.12.mlp.experts.5.w2.weight": "pytorch_model-00008-of-00019.bin",
150
+ "model.layers.12.mlp.experts.5.w3.weight": "pytorch_model-00008-of-00019.bin",
151
+ "model.layers.12.mlp.experts.6.w1.weight": "pytorch_model-00008-of-00019.bin",
152
+ "model.layers.12.mlp.experts.6.w2.weight": "pytorch_model-00008-of-00019.bin",
153
+ "model.layers.12.mlp.experts.6.w3.weight": "pytorch_model-00008-of-00019.bin",
154
+ "model.layers.12.mlp.experts.7.w1.weight": "pytorch_model-00008-of-00019.bin",
155
+ "model.layers.12.mlp.experts.7.w2.weight": "pytorch_model-00008-of-00019.bin",
156
+ "model.layers.12.mlp.experts.7.w3.weight": "pytorch_model-00008-of-00019.bin",
157
+ "model.layers.12.mlp.gate.weight": "pytorch_model-00008-of-00019.bin",
158
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00008-of-00019.bin",
159
+ "model.layers.12.self_attn.k_proj.weight": "pytorch_model-00008-of-00019.bin",
160
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00008-of-00019.bin",
161
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00008-of-00019.bin",
162
+ "model.layers.12.self_attn.v_proj.weight": "pytorch_model-00008-of-00019.bin",
163
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00009-of-00019.bin",
164
+ "model.layers.13.mlp.experts.0.w1.weight": "pytorch_model-00008-of-00019.bin",
165
+ "model.layers.13.mlp.experts.0.w2.weight": "pytorch_model-00008-of-00019.bin",
166
+ "model.layers.13.mlp.experts.0.w3.weight": "pytorch_model-00008-of-00019.bin",
167
+ "model.layers.13.mlp.experts.1.w1.weight": "pytorch_model-00008-of-00019.bin",
168
+ "model.layers.13.mlp.experts.1.w2.weight": "pytorch_model-00008-of-00019.bin",
169
+ "model.layers.13.mlp.experts.1.w3.weight": "pytorch_model-00008-of-00019.bin",
170
+ "model.layers.13.mlp.experts.2.w1.weight": "pytorch_model-00008-of-00019.bin",
171
+ "model.layers.13.mlp.experts.2.w2.weight": "pytorch_model-00008-of-00019.bin",
172
+ "model.layers.13.mlp.experts.2.w3.weight": "pytorch_model-00008-of-00019.bin",
173
+ "model.layers.13.mlp.experts.3.w1.weight": "pytorch_model-00008-of-00019.bin",
174
+ "model.layers.13.mlp.experts.3.w2.weight": "pytorch_model-00008-of-00019.bin",
175
+ "model.layers.13.mlp.experts.3.w3.weight": "pytorch_model-00008-of-00019.bin",
176
+ "model.layers.13.mlp.experts.4.w1.weight": "pytorch_model-00008-of-00019.bin",
177
+ "model.layers.13.mlp.experts.4.w2.weight": "pytorch_model-00009-of-00019.bin",
178
+ "model.layers.13.mlp.experts.4.w3.weight": "pytorch_model-00009-of-00019.bin",
179
+ "model.layers.13.mlp.experts.5.w1.weight": "pytorch_model-00009-of-00019.bin",
180
+ "model.layers.13.mlp.experts.5.w2.weight": "pytorch_model-00009-of-00019.bin",
181
+ "model.layers.13.mlp.experts.5.w3.weight": "pytorch_model-00009-of-00019.bin",
182
+ "model.layers.13.mlp.experts.6.w1.weight": "pytorch_model-00009-of-00019.bin",
183
+ "model.layers.13.mlp.experts.6.w2.weight": "pytorch_model-00009-of-00019.bin",
184
+ "model.layers.13.mlp.experts.6.w3.weight": "pytorch_model-00009-of-00019.bin",
185
+ "model.layers.13.mlp.experts.7.w1.weight": "pytorch_model-00009-of-00019.bin",
186
+ "model.layers.13.mlp.experts.7.w2.weight": "pytorch_model-00009-of-00019.bin",
187
+ "model.layers.13.mlp.experts.7.w3.weight": "pytorch_model-00009-of-00019.bin",
188
+ "model.layers.13.mlp.gate.weight": "pytorch_model-00009-of-00019.bin",
189
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00009-of-00019.bin",
190
+ "model.layers.13.self_attn.k_proj.weight": "pytorch_model-00008-of-00019.bin",
191
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00008-of-00019.bin",
192
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00008-of-00019.bin",
193
+ "model.layers.13.self_attn.v_proj.weight": "pytorch_model-00008-of-00019.bin",
194
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00009-of-00019.bin",
195
+ "model.layers.14.mlp.experts.0.w1.weight": "pytorch_model-00009-of-00019.bin",
196
+ "model.layers.14.mlp.experts.0.w2.weight": "pytorch_model-00009-of-00019.bin",
197
+ "model.layers.14.mlp.experts.0.w3.weight": "pytorch_model-00009-of-00019.bin",
198
+ "model.layers.14.mlp.experts.1.w1.weight": "pytorch_model-00009-of-00019.bin",
199
+ "model.layers.14.mlp.experts.1.w2.weight": "pytorch_model-00009-of-00019.bin",
200
+ "model.layers.14.mlp.experts.1.w3.weight": "pytorch_model-00009-of-00019.bin",
201
+ "model.layers.14.mlp.experts.2.w1.weight": "pytorch_model-00009-of-00019.bin",
202
+ "model.layers.14.mlp.experts.2.w2.weight": "pytorch_model-00009-of-00019.bin",
203
+ "model.layers.14.mlp.experts.2.w3.weight": "pytorch_model-00009-of-00019.bin",
204
+ "model.layers.14.mlp.experts.3.w1.weight": "pytorch_model-00009-of-00019.bin",
205
+ "model.layers.14.mlp.experts.3.w2.weight": "pytorch_model-00009-of-00019.bin",
206
+ "model.layers.14.mlp.experts.3.w3.weight": "pytorch_model-00009-of-00019.bin",
207
+ "model.layers.14.mlp.experts.4.w1.weight": "pytorch_model-00009-of-00019.bin",
208
+ "model.layers.14.mlp.experts.4.w2.weight": "pytorch_model-00009-of-00019.bin",
209
+ "model.layers.14.mlp.experts.4.w3.weight": "pytorch_model-00009-of-00019.bin",
210
+ "model.layers.14.mlp.experts.5.w1.weight": "pytorch_model-00009-of-00019.bin",
211
+ "model.layers.14.mlp.experts.5.w2.weight": "pytorch_model-00009-of-00019.bin",
212
+ "model.layers.14.mlp.experts.5.w3.weight": "pytorch_model-00009-of-00019.bin",
213
+ "model.layers.14.mlp.experts.6.w1.weight": "pytorch_model-00009-of-00019.bin",
214
+ "model.layers.14.mlp.experts.6.w2.weight": "pytorch_model-00009-of-00019.bin",
215
+ "model.layers.14.mlp.experts.6.w3.weight": "pytorch_model-00009-of-00019.bin",
216
+ "model.layers.14.mlp.experts.7.w1.weight": "pytorch_model-00009-of-00019.bin",
217
+ "model.layers.14.mlp.experts.7.w2.weight": "pytorch_model-00009-of-00019.bin",
218
+ "model.layers.14.mlp.experts.7.w3.weight": "pytorch_model-00009-of-00019.bin",
219
+ "model.layers.14.mlp.gate.weight": "pytorch_model-00009-of-00019.bin",
220
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00009-of-00019.bin",
221
+ "model.layers.14.self_attn.k_proj.weight": "pytorch_model-00009-of-00019.bin",
222
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00009-of-00019.bin",
223
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00009-of-00019.bin",
224
+ "model.layers.14.self_attn.v_proj.weight": "pytorch_model-00009-of-00019.bin",
225
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00010-of-00019.bin",
226
+ "model.layers.15.mlp.experts.0.w1.weight": "pytorch_model-00009-of-00019.bin",
227
+ "model.layers.15.mlp.experts.0.w2.weight": "pytorch_model-00009-of-00019.bin",
228
+ "model.layers.15.mlp.experts.0.w3.weight": "pytorch_model-00009-of-00019.bin",
229
+ "model.layers.15.mlp.experts.1.w1.weight": "pytorch_model-00009-of-00019.bin",
230
+ "model.layers.15.mlp.experts.1.w2.weight": "pytorch_model-00009-of-00019.bin",
231
+ "model.layers.15.mlp.experts.1.w3.weight": "pytorch_model-00009-of-00019.bin",
232
+ "model.layers.15.mlp.experts.2.w1.weight": "pytorch_model-00010-of-00019.bin",
233
+ "model.layers.15.mlp.experts.2.w2.weight": "pytorch_model-00010-of-00019.bin",
234
+ "model.layers.15.mlp.experts.2.w3.weight": "pytorch_model-00010-of-00019.bin",
235
+ "model.layers.15.mlp.experts.3.w1.weight": "pytorch_model-00010-of-00019.bin",
236
+ "model.layers.15.mlp.experts.3.w2.weight": "pytorch_model-00010-of-00019.bin",
237
+ "model.layers.15.mlp.experts.3.w3.weight": "pytorch_model-00010-of-00019.bin",
238
+ "model.layers.15.mlp.experts.4.w1.weight": "pytorch_model-00010-of-00019.bin",
239
+ "model.layers.15.mlp.experts.4.w2.weight": "pytorch_model-00010-of-00019.bin",
240
+ "model.layers.15.mlp.experts.4.w3.weight": "pytorch_model-00010-of-00019.bin",
241
+ "model.layers.15.mlp.experts.5.w1.weight": "pytorch_model-00010-of-00019.bin",
242
+ "model.layers.15.mlp.experts.5.w2.weight": "pytorch_model-00010-of-00019.bin",
243
+ "model.layers.15.mlp.experts.5.w3.weight": "pytorch_model-00010-of-00019.bin",
244
+ "model.layers.15.mlp.experts.6.w1.weight": "pytorch_model-00010-of-00019.bin",
245
+ "model.layers.15.mlp.experts.6.w2.weight": "pytorch_model-00010-of-00019.bin",
246
+ "model.layers.15.mlp.experts.6.w3.weight": "pytorch_model-00010-of-00019.bin",
247
+ "model.layers.15.mlp.experts.7.w1.weight": "pytorch_model-00010-of-00019.bin",
248
+ "model.layers.15.mlp.experts.7.w2.weight": "pytorch_model-00010-of-00019.bin",
249
+ "model.layers.15.mlp.experts.7.w3.weight": "pytorch_model-00010-of-00019.bin",
250
+ "model.layers.15.mlp.gate.weight": "pytorch_model-00010-of-00019.bin",
251
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00010-of-00019.bin",
252
+ "model.layers.15.self_attn.k_proj.weight": "pytorch_model-00009-of-00019.bin",
253
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00009-of-00019.bin",
254
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00009-of-00019.bin",
255
+ "model.layers.15.self_attn.v_proj.weight": "pytorch_model-00009-of-00019.bin",
256
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00011-of-00019.bin",
257
+ "model.layers.16.mlp.experts.0.w1.weight": "pytorch_model-00010-of-00019.bin",
258
+ "model.layers.16.mlp.experts.0.w2.weight": "pytorch_model-00010-of-00019.bin",
259
+ "model.layers.16.mlp.experts.0.w3.weight": "pytorch_model-00010-of-00019.bin",
260
+ "model.layers.16.mlp.experts.1.w1.weight": "pytorch_model-00010-of-00019.bin",
261
+ "model.layers.16.mlp.experts.1.w2.weight": "pytorch_model-00010-of-00019.bin",
262
+ "model.layers.16.mlp.experts.1.w3.weight": "pytorch_model-00010-of-00019.bin",
263
+ "model.layers.16.mlp.experts.2.w1.weight": "pytorch_model-00010-of-00019.bin",
264
+ "model.layers.16.mlp.experts.2.w2.weight": "pytorch_model-00010-of-00019.bin",
265
+ "model.layers.16.mlp.experts.2.w3.weight": "pytorch_model-00010-of-00019.bin",
266
+ "model.layers.16.mlp.experts.3.w1.weight": "pytorch_model-00010-of-00019.bin",
267
+ "model.layers.16.mlp.experts.3.w2.weight": "pytorch_model-00010-of-00019.bin",
268
+ "model.layers.16.mlp.experts.3.w3.weight": "pytorch_model-00010-of-00019.bin",
269
+ "model.layers.16.mlp.experts.4.w1.weight": "pytorch_model-00010-of-00019.bin",
270
+ "model.layers.16.mlp.experts.4.w2.weight": "pytorch_model-00010-of-00019.bin",
271
+ "model.layers.16.mlp.experts.4.w3.weight": "pytorch_model-00010-of-00019.bin",
272
+ "model.layers.16.mlp.experts.5.w1.weight": "pytorch_model-00010-of-00019.bin",
273
+ "model.layers.16.mlp.experts.5.w2.weight": "pytorch_model-00010-of-00019.bin",
274
+ "model.layers.16.mlp.experts.5.w3.weight": "pytorch_model-00010-of-00019.bin",
275
+ "model.layers.16.mlp.experts.6.w1.weight": "pytorch_model-00010-of-00019.bin",
276
+ "model.layers.16.mlp.experts.6.w2.weight": "pytorch_model-00010-of-00019.bin",
277
+ "model.layers.16.mlp.experts.6.w3.weight": "pytorch_model-00010-of-00019.bin",
278
+ "model.layers.16.mlp.experts.7.w1.weight": "pytorch_model-00010-of-00019.bin",
279
+ "model.layers.16.mlp.experts.7.w2.weight": "pytorch_model-00010-of-00019.bin",
280
+ "model.layers.16.mlp.experts.7.w3.weight": "pytorch_model-00011-of-00019.bin",
281
+ "model.layers.16.mlp.gate.weight": "pytorch_model-00011-of-00019.bin",
282
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00011-of-00019.bin",
283
+ "model.layers.16.self_attn.k_proj.weight": "pytorch_model-00010-of-00019.bin",
284
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00010-of-00019.bin",
285
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00010-of-00019.bin",
286
+ "model.layers.16.self_attn.v_proj.weight": "pytorch_model-00010-of-00019.bin",
287
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00011-of-00019.bin",
288
+ "model.layers.17.mlp.experts.0.w1.weight": "pytorch_model-00011-of-00019.bin",
289
+ "model.layers.17.mlp.experts.0.w2.weight": "pytorch_model-00011-of-00019.bin",
290
+ "model.layers.17.mlp.experts.0.w3.weight": "pytorch_model-00011-of-00019.bin",
291
+ "model.layers.17.mlp.experts.1.w1.weight": "pytorch_model-00011-of-00019.bin",
292
+ "model.layers.17.mlp.experts.1.w2.weight": "pytorch_model-00011-of-00019.bin",
293
+ "model.layers.17.mlp.experts.1.w3.weight": "pytorch_model-00011-of-00019.bin",
294
+ "model.layers.17.mlp.experts.2.w1.weight": "pytorch_model-00011-of-00019.bin",
295
+ "model.layers.17.mlp.experts.2.w2.weight": "pytorch_model-00011-of-00019.bin",
296
+ "model.layers.17.mlp.experts.2.w3.weight": "pytorch_model-00011-of-00019.bin",
297
+ "model.layers.17.mlp.experts.3.w1.weight": "pytorch_model-00011-of-00019.bin",
298
+ "model.layers.17.mlp.experts.3.w2.weight": "pytorch_model-00011-of-00019.bin",
299
+ "model.layers.17.mlp.experts.3.w3.weight": "pytorch_model-00011-of-00019.bin",
300
+ "model.layers.17.mlp.experts.4.w1.weight": "pytorch_model-00011-of-00019.bin",
301
+ "model.layers.17.mlp.experts.4.w2.weight": "pytorch_model-00011-of-00019.bin",
302
+ "model.layers.17.mlp.experts.4.w3.weight": "pytorch_model-00011-of-00019.bin",
303
+ "model.layers.17.mlp.experts.5.w1.weight": "pytorch_model-00011-of-00019.bin",
304
+ "model.layers.17.mlp.experts.5.w2.weight": "pytorch_model-00011-of-00019.bin",
305
+ "model.layers.17.mlp.experts.5.w3.weight": "pytorch_model-00011-of-00019.bin",
306
+ "model.layers.17.mlp.experts.6.w1.weight": "pytorch_model-00011-of-00019.bin",
307
+ "model.layers.17.mlp.experts.6.w2.weight": "pytorch_model-00011-of-00019.bin",
308
+ "model.layers.17.mlp.experts.6.w3.weight": "pytorch_model-00011-of-00019.bin",
309
+ "model.layers.17.mlp.experts.7.w1.weight": "pytorch_model-00011-of-00019.bin",
310
+ "model.layers.17.mlp.experts.7.w2.weight": "pytorch_model-00011-of-00019.bin",
311
+ "model.layers.17.mlp.experts.7.w3.weight": "pytorch_model-00011-of-00019.bin",
312
+ "model.layers.17.mlp.gate.weight": "pytorch_model-00011-of-00019.bin",
313
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00011-of-00019.bin",
314
+ "model.layers.17.self_attn.k_proj.weight": "pytorch_model-00011-of-00019.bin",
315
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00011-of-00019.bin",
316
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00011-of-00019.bin",
317
+ "model.layers.17.self_attn.v_proj.weight": "pytorch_model-00011-of-00019.bin",
318
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00012-of-00019.bin",
319
+ "model.layers.18.mlp.experts.0.w1.weight": "pytorch_model-00011-of-00019.bin",
320
+ "model.layers.18.mlp.experts.0.w2.weight": "pytorch_model-00011-of-00019.bin",
321
+ "model.layers.18.mlp.experts.0.w3.weight": "pytorch_model-00011-of-00019.bin",
322
+ "model.layers.18.mlp.experts.1.w1.weight": "pytorch_model-00011-of-00019.bin",
323
+ "model.layers.18.mlp.experts.1.w2.weight": "pytorch_model-00011-of-00019.bin",
324
+ "model.layers.18.mlp.experts.1.w3.weight": "pytorch_model-00011-of-00019.bin",
325
+ "model.layers.18.mlp.experts.2.w1.weight": "pytorch_model-00011-of-00019.bin",
326
+ "model.layers.18.mlp.experts.2.w2.weight": "pytorch_model-00011-of-00019.bin",
327
+ "model.layers.18.mlp.experts.2.w3.weight": "pytorch_model-00011-of-00019.bin",
328
+ "model.layers.18.mlp.experts.3.w1.weight": "pytorch_model-00011-of-00019.bin",
329
+ "model.layers.18.mlp.experts.3.w2.weight": "pytorch_model-00011-of-00019.bin",
330
+ "model.layers.18.mlp.experts.3.w3.weight": "pytorch_model-00011-of-00019.bin",
331
+ "model.layers.18.mlp.experts.4.w1.weight": "pytorch_model-00011-of-00019.bin",
332
+ "model.layers.18.mlp.experts.4.w2.weight": "pytorch_model-00011-of-00019.bin",
333
+ "model.layers.18.mlp.experts.4.w3.weight": "pytorch_model-00011-of-00019.bin",
334
+ "model.layers.18.mlp.experts.5.w1.weight": "pytorch_model-00011-of-00019.bin",
335
+ "model.layers.18.mlp.experts.5.w2.weight": "pytorch_model-00012-of-00019.bin",
336
+ "model.layers.18.mlp.experts.5.w3.weight": "pytorch_model-00012-of-00019.bin",
337
+ "model.layers.18.mlp.experts.6.w1.weight": "pytorch_model-00012-of-00019.bin",
338
+ "model.layers.18.mlp.experts.6.w2.weight": "pytorch_model-00012-of-00019.bin",
339
+ "model.layers.18.mlp.experts.6.w3.weight": "pytorch_model-00012-of-00019.bin",
340
+ "model.layers.18.mlp.experts.7.w1.weight": "pytorch_model-00012-of-00019.bin",
341
+ "model.layers.18.mlp.experts.7.w2.weight": "pytorch_model-00012-of-00019.bin",
342
+ "model.layers.18.mlp.experts.7.w3.weight": "pytorch_model-00012-of-00019.bin",
343
+ "model.layers.18.mlp.gate.weight": "pytorch_model-00012-of-00019.bin",
344
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00012-of-00019.bin",
345
+ "model.layers.18.self_attn.k_proj.weight": "pytorch_model-00011-of-00019.bin",
346
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00011-of-00019.bin",
347
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00011-of-00019.bin",
348
+ "model.layers.18.self_attn.v_proj.weight": "pytorch_model-00011-of-00019.bin",
349
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00012-of-00019.bin",
350
+ "model.layers.19.mlp.experts.0.w1.weight": "pytorch_model-00012-of-00019.bin",
351
+ "model.layers.19.mlp.experts.0.w2.weight": "pytorch_model-00012-of-00019.bin",
352
+ "model.layers.19.mlp.experts.0.w3.weight": "pytorch_model-00012-of-00019.bin",
353
+ "model.layers.19.mlp.experts.1.w1.weight": "pytorch_model-00012-of-00019.bin",
354
+ "model.layers.19.mlp.experts.1.w2.weight": "pytorch_model-00012-of-00019.bin",
355
+ "model.layers.19.mlp.experts.1.w3.weight": "pytorch_model-00012-of-00019.bin",
356
+ "model.layers.19.mlp.experts.2.w1.weight": "pytorch_model-00012-of-00019.bin",
357
+ "model.layers.19.mlp.experts.2.w2.weight": "pytorch_model-00012-of-00019.bin",
358
+ "model.layers.19.mlp.experts.2.w3.weight": "pytorch_model-00012-of-00019.bin",
359
+ "model.layers.19.mlp.experts.3.w1.weight": "pytorch_model-00012-of-00019.bin",
360
+ "model.layers.19.mlp.experts.3.w2.weight": "pytorch_model-00012-of-00019.bin",
361
+ "model.layers.19.mlp.experts.3.w3.weight": "pytorch_model-00012-of-00019.bin",
362
+ "model.layers.19.mlp.experts.4.w1.weight": "pytorch_model-00012-of-00019.bin",
363
+ "model.layers.19.mlp.experts.4.w2.weight": "pytorch_model-00012-of-00019.bin",
364
+ "model.layers.19.mlp.experts.4.w3.weight": "pytorch_model-00012-of-00019.bin",
365
+ "model.layers.19.mlp.experts.5.w1.weight": "pytorch_model-00012-of-00019.bin",
366
+ "model.layers.19.mlp.experts.5.w2.weight": "pytorch_model-00012-of-00019.bin",
367
+ "model.layers.19.mlp.experts.5.w3.weight": "pytorch_model-00012-of-00019.bin",
368
+ "model.layers.19.mlp.experts.6.w1.weight": "pytorch_model-00012-of-00019.bin",
369
+ "model.layers.19.mlp.experts.6.w2.weight": "pytorch_model-00012-of-00019.bin",
370
+ "model.layers.19.mlp.experts.6.w3.weight": "pytorch_model-00012-of-00019.bin",
371
+ "model.layers.19.mlp.experts.7.w1.weight": "pytorch_model-00012-of-00019.bin",
372
+ "model.layers.19.mlp.experts.7.w2.weight": "pytorch_model-00012-of-00019.bin",
373
+ "model.layers.19.mlp.experts.7.w3.weight": "pytorch_model-00012-of-00019.bin",
374
+ "model.layers.19.mlp.gate.weight": "pytorch_model-00012-of-00019.bin",
375
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00012-of-00019.bin",
376
+ "model.layers.19.self_attn.k_proj.weight": "pytorch_model-00012-of-00019.bin",
377
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00012-of-00019.bin",
378
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00012-of-00019.bin",
379
+ "model.layers.19.self_attn.v_proj.weight": "pytorch_model-00012-of-00019.bin",
380
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00002-of-00019.bin",
381
+ "model.layers.2.mlp.experts.0.w1.weight": "pytorch_model-00002-of-00019.bin",
382
+ "model.layers.2.mlp.experts.0.w2.weight": "pytorch_model-00002-of-00019.bin",
383
+ "model.layers.2.mlp.experts.0.w3.weight": "pytorch_model-00002-of-00019.bin",
384
+ "model.layers.2.mlp.experts.1.w1.weight": "pytorch_model-00002-of-00019.bin",
385
+ "model.layers.2.mlp.experts.1.w2.weight": "pytorch_model-00002-of-00019.bin",
386
+ "model.layers.2.mlp.experts.1.w3.weight": "pytorch_model-00002-of-00019.bin",
387
+ "model.layers.2.mlp.experts.2.w1.weight": "pytorch_model-00002-of-00019.bin",
388
+ "model.layers.2.mlp.experts.2.w2.weight": "pytorch_model-00002-of-00019.bin",
389
+ "model.layers.2.mlp.experts.2.w3.weight": "pytorch_model-00002-of-00019.bin",
390
+ "model.layers.2.mlp.experts.3.w1.weight": "pytorch_model-00002-of-00019.bin",
391
+ "model.layers.2.mlp.experts.3.w2.weight": "pytorch_model-00002-of-00019.bin",
392
+ "model.layers.2.mlp.experts.3.w3.weight": "pytorch_model-00002-of-00019.bin",
393
+ "model.layers.2.mlp.experts.4.w1.weight": "pytorch_model-00002-of-00019.bin",
394
+ "model.layers.2.mlp.experts.4.w2.weight": "pytorch_model-00002-of-00019.bin",
395
+ "model.layers.2.mlp.experts.4.w3.weight": "pytorch_model-00002-of-00019.bin",
396
+ "model.layers.2.mlp.experts.5.w1.weight": "pytorch_model-00002-of-00019.bin",
397
+ "model.layers.2.mlp.experts.5.w2.weight": "pytorch_model-00002-of-00019.bin",
398
+ "model.layers.2.mlp.experts.5.w3.weight": "pytorch_model-00002-of-00019.bin",
399
+ "model.layers.2.mlp.experts.6.w1.weight": "pytorch_model-00002-of-00019.bin",
400
+ "model.layers.2.mlp.experts.6.w2.weight": "pytorch_model-00002-of-00019.bin",
401
+ "model.layers.2.mlp.experts.6.w3.weight": "pytorch_model-00002-of-00019.bin",
402
+ "model.layers.2.mlp.experts.7.w1.weight": "pytorch_model-00002-of-00019.bin",
403
+ "model.layers.2.mlp.experts.7.w2.weight": "pytorch_model-00002-of-00019.bin",
404
+ "model.layers.2.mlp.experts.7.w3.weight": "pytorch_model-00002-of-00019.bin",
405
+ "model.layers.2.mlp.gate.weight": "pytorch_model-00002-of-00019.bin",
406
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00002-of-00019.bin",
407
+ "model.layers.2.self_attn.k_proj.weight": "pytorch_model-00002-of-00019.bin",
408
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00002-of-00019.bin",
409
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00002-of-00019.bin",
410
+ "model.layers.2.self_attn.v_proj.weight": "pytorch_model-00002-of-00019.bin",
411
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00013-of-00019.bin",
412
+ "model.layers.20.mlp.experts.0.w1.weight": "pytorch_model-00012-of-00019.bin",
413
+ "model.layers.20.mlp.experts.0.w2.weight": "pytorch_model-00012-of-00019.bin",
414
+ "model.layers.20.mlp.experts.0.w3.weight": "pytorch_model-00012-of-00019.bin",
415
+ "model.layers.20.mlp.experts.1.w1.weight": "pytorch_model-00012-of-00019.bin",
416
+ "model.layers.20.mlp.experts.1.w2.weight": "pytorch_model-00012-of-00019.bin",
417
+ "model.layers.20.mlp.experts.1.w3.weight": "pytorch_model-00012-of-00019.bin",
418
+ "model.layers.20.mlp.experts.2.w1.weight": "pytorch_model-00012-of-00019.bin",
419
+ "model.layers.20.mlp.experts.2.w2.weight": "pytorch_model-00012-of-00019.bin",
420
+ "model.layers.20.mlp.experts.2.w3.weight": "pytorch_model-00012-of-00019.bin",
421
+ "model.layers.20.mlp.experts.3.w1.weight": "pytorch_model-00013-of-00019.bin",
422
+ "model.layers.20.mlp.experts.3.w2.weight": "pytorch_model-00013-of-00019.bin",
423
+ "model.layers.20.mlp.experts.3.w3.weight": "pytorch_model-00013-of-00019.bin",
424
+ "model.layers.20.mlp.experts.4.w1.weight": "pytorch_model-00013-of-00019.bin",
425
+ "model.layers.20.mlp.experts.4.w2.weight": "pytorch_model-00013-of-00019.bin",
426
+ "model.layers.20.mlp.experts.4.w3.weight": "pytorch_model-00013-of-00019.bin",
427
+ "model.layers.20.mlp.experts.5.w1.weight": "pytorch_model-00013-of-00019.bin",
428
+ "model.layers.20.mlp.experts.5.w2.weight": "pytorch_model-00013-of-00019.bin",
429
+ "model.layers.20.mlp.experts.5.w3.weight": "pytorch_model-00013-of-00019.bin",
430
+ "model.layers.20.mlp.experts.6.w1.weight": "pytorch_model-00013-of-00019.bin",
431
+ "model.layers.20.mlp.experts.6.w2.weight": "pytorch_model-00013-of-00019.bin",
432
+ "model.layers.20.mlp.experts.6.w3.weight": "pytorch_model-00013-of-00019.bin",
433
+ "model.layers.20.mlp.experts.7.w1.weight": "pytorch_model-00013-of-00019.bin",
434
+ "model.layers.20.mlp.experts.7.w2.weight": "pytorch_model-00013-of-00019.bin",
435
+ "model.layers.20.mlp.experts.7.w3.weight": "pytorch_model-00013-of-00019.bin",
436
+ "model.layers.20.mlp.gate.weight": "pytorch_model-00013-of-00019.bin",
437
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00013-of-00019.bin",
438
+ "model.layers.20.self_attn.k_proj.weight": "pytorch_model-00012-of-00019.bin",
439
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00012-of-00019.bin",
440
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00012-of-00019.bin",
441
+ "model.layers.20.self_attn.v_proj.weight": "pytorch_model-00012-of-00019.bin",
442
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00013-of-00019.bin",
443
+ "model.layers.21.mlp.experts.0.w1.weight": "pytorch_model-00013-of-00019.bin",
444
+ "model.layers.21.mlp.experts.0.w2.weight": "pytorch_model-00013-of-00019.bin",
445
+ "model.layers.21.mlp.experts.0.w3.weight": "pytorch_model-00013-of-00019.bin",
446
+ "model.layers.21.mlp.experts.1.w1.weight": "pytorch_model-00013-of-00019.bin",
447
+ "model.layers.21.mlp.experts.1.w2.weight": "pytorch_model-00013-of-00019.bin",
448
+ "model.layers.21.mlp.experts.1.w3.weight": "pytorch_model-00013-of-00019.bin",
449
+ "model.layers.21.mlp.experts.2.w1.weight": "pytorch_model-00013-of-00019.bin",
450
+ "model.layers.21.mlp.experts.2.w2.weight": "pytorch_model-00013-of-00019.bin",
451
+ "model.layers.21.mlp.experts.2.w3.weight": "pytorch_model-00013-of-00019.bin",
452
+ "model.layers.21.mlp.experts.3.w1.weight": "pytorch_model-00013-of-00019.bin",
453
+ "model.layers.21.mlp.experts.3.w2.weight": "pytorch_model-00013-of-00019.bin",
454
+ "model.layers.21.mlp.experts.3.w3.weight": "pytorch_model-00013-of-00019.bin",
455
+ "model.layers.21.mlp.experts.4.w1.weight": "pytorch_model-00013-of-00019.bin",
456
+ "model.layers.21.mlp.experts.4.w2.weight": "pytorch_model-00013-of-00019.bin",
457
+ "model.layers.21.mlp.experts.4.w3.weight": "pytorch_model-00013-of-00019.bin",
458
+ "model.layers.21.mlp.experts.5.w1.weight": "pytorch_model-00013-of-00019.bin",
459
+ "model.layers.21.mlp.experts.5.w2.weight": "pytorch_model-00013-of-00019.bin",
460
+ "model.layers.21.mlp.experts.5.w3.weight": "pytorch_model-00013-of-00019.bin",
461
+ "model.layers.21.mlp.experts.6.w1.weight": "pytorch_model-00013-of-00019.bin",
462
+ "model.layers.21.mlp.experts.6.w2.weight": "pytorch_model-00013-of-00019.bin",
463
+ "model.layers.21.mlp.experts.6.w3.weight": "pytorch_model-00013-of-00019.bin",
464
+ "model.layers.21.mlp.experts.7.w1.weight": "pytorch_model-00013-of-00019.bin",
465
+ "model.layers.21.mlp.experts.7.w2.weight": "pytorch_model-00013-of-00019.bin",
466
+ "model.layers.21.mlp.experts.7.w3.weight": "pytorch_model-00013-of-00019.bin",
467
+ "model.layers.21.mlp.gate.weight": "pytorch_model-00013-of-00019.bin",
468
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00013-of-00019.bin",
469
+ "model.layers.21.self_attn.k_proj.weight": "pytorch_model-00013-of-00019.bin",
470
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00013-of-00019.bin",
471
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00013-of-00019.bin",
472
+ "model.layers.21.self_attn.v_proj.weight": "pytorch_model-00013-of-00019.bin",
473
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00014-of-00019.bin",
474
+ "model.layers.22.mlp.experts.0.w1.weight": "pytorch_model-00013-of-00019.bin",
475
+ "model.layers.22.mlp.experts.0.w2.weight": "pytorch_model-00013-of-00019.bin",
476
+ "model.layers.22.mlp.experts.0.w3.weight": "pytorch_model-00014-of-00019.bin",
477
+ "model.layers.22.mlp.experts.1.w1.weight": "pytorch_model-00014-of-00019.bin",
478
+ "model.layers.22.mlp.experts.1.w2.weight": "pytorch_model-00014-of-00019.bin",
479
+ "model.layers.22.mlp.experts.1.w3.weight": "pytorch_model-00014-of-00019.bin",
480
+ "model.layers.22.mlp.experts.2.w1.weight": "pytorch_model-00014-of-00019.bin",
481
+ "model.layers.22.mlp.experts.2.w2.weight": "pytorch_model-00014-of-00019.bin",
482
+ "model.layers.22.mlp.experts.2.w3.weight": "pytorch_model-00014-of-00019.bin",
483
+ "model.layers.22.mlp.experts.3.w1.weight": "pytorch_model-00014-of-00019.bin",
484
+ "model.layers.22.mlp.experts.3.w2.weight": "pytorch_model-00014-of-00019.bin",
485
+ "model.layers.22.mlp.experts.3.w3.weight": "pytorch_model-00014-of-00019.bin",
486
+ "model.layers.22.mlp.experts.4.w1.weight": "pytorch_model-00014-of-00019.bin",
487
+ "model.layers.22.mlp.experts.4.w2.weight": "pytorch_model-00014-of-00019.bin",
488
+ "model.layers.22.mlp.experts.4.w3.weight": "pytorch_model-00014-of-00019.bin",
489
+ "model.layers.22.mlp.experts.5.w1.weight": "pytorch_model-00014-of-00019.bin",
490
+ "model.layers.22.mlp.experts.5.w2.weight": "pytorch_model-00014-of-00019.bin",
491
+ "model.layers.22.mlp.experts.5.w3.weight": "pytorch_model-00014-of-00019.bin",
492
+ "model.layers.22.mlp.experts.6.w1.weight": "pytorch_model-00014-of-00019.bin",
493
+ "model.layers.22.mlp.experts.6.w2.weight": "pytorch_model-00014-of-00019.bin",
494
+ "model.layers.22.mlp.experts.6.w3.weight": "pytorch_model-00014-of-00019.bin",
495
+ "model.layers.22.mlp.experts.7.w1.weight": "pytorch_model-00014-of-00019.bin",
496
+ "model.layers.22.mlp.experts.7.w2.weight": "pytorch_model-00014-of-00019.bin",
497
+ "model.layers.22.mlp.experts.7.w3.weight": "pytorch_model-00014-of-00019.bin",
498
+ "model.layers.22.mlp.gate.weight": "pytorch_model-00014-of-00019.bin",
499
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00014-of-00019.bin",
500
+ "model.layers.22.self_attn.k_proj.weight": "pytorch_model-00013-of-00019.bin",
501
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00013-of-00019.bin",
502
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00013-of-00019.bin",
503
+ "model.layers.22.self_attn.v_proj.weight": "pytorch_model-00013-of-00019.bin",
504
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00015-of-00019.bin",
505
+ "model.layers.23.mlp.experts.0.w1.weight": "pytorch_model-00014-of-00019.bin",
506
+ "model.layers.23.mlp.experts.0.w2.weight": "pytorch_model-00014-of-00019.bin",
507
+ "model.layers.23.mlp.experts.0.w3.weight": "pytorch_model-00014-of-00019.bin",
508
+ "model.layers.23.mlp.experts.1.w1.weight": "pytorch_model-00014-of-00019.bin",
509
+ "model.layers.23.mlp.experts.1.w2.weight": "pytorch_model-00014-of-00019.bin",
510
+ "model.layers.23.mlp.experts.1.w3.weight": "pytorch_model-00014-of-00019.bin",
511
+ "model.layers.23.mlp.experts.2.w1.weight": "pytorch_model-00014-of-00019.bin",
512
+ "model.layers.23.mlp.experts.2.w2.weight": "pytorch_model-00014-of-00019.bin",
513
+ "model.layers.23.mlp.experts.2.w3.weight": "pytorch_model-00014-of-00019.bin",
514
+ "model.layers.23.mlp.experts.3.w1.weight": "pytorch_model-00014-of-00019.bin",
515
+ "model.layers.23.mlp.experts.3.w2.weight": "pytorch_model-00014-of-00019.bin",
516
+ "model.layers.23.mlp.experts.3.w3.weight": "pytorch_model-00014-of-00019.bin",
517
+ "model.layers.23.mlp.experts.4.w1.weight": "pytorch_model-00014-of-00019.bin",
518
+ "model.layers.23.mlp.experts.4.w2.weight": "pytorch_model-00014-of-00019.bin",
519
+ "model.layers.23.mlp.experts.4.w3.weight": "pytorch_model-00014-of-00019.bin",
520
+ "model.layers.23.mlp.experts.5.w1.weight": "pytorch_model-00014-of-00019.bin",
521
+ "model.layers.23.mlp.experts.5.w2.weight": "pytorch_model-00014-of-00019.bin",
522
+ "model.layers.23.mlp.experts.5.w3.weight": "pytorch_model-00014-of-00019.bin",
523
+ "model.layers.23.mlp.experts.6.w1.weight": "pytorch_model-00014-of-00019.bin",
524
+ "model.layers.23.mlp.experts.6.w2.weight": "pytorch_model-00015-of-00019.bin",
525
+ "model.layers.23.mlp.experts.6.w3.weight": "pytorch_model-00015-of-00019.bin",
526
+ "model.layers.23.mlp.experts.7.w1.weight": "pytorch_model-00015-of-00019.bin",
527
+ "model.layers.23.mlp.experts.7.w2.weight": "pytorch_model-00015-of-00019.bin",
528
+ "model.layers.23.mlp.experts.7.w3.weight": "pytorch_model-00015-of-00019.bin",
529
+ "model.layers.23.mlp.gate.weight": "pytorch_model-00015-of-00019.bin",
530
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00015-of-00019.bin",
531
+ "model.layers.23.self_attn.k_proj.weight": "pytorch_model-00014-of-00019.bin",
532
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00014-of-00019.bin",
533
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00014-of-00019.bin",
534
+ "model.layers.23.self_attn.v_proj.weight": "pytorch_model-00014-of-00019.bin",
535
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00015-of-00019.bin",
536
+ "model.layers.24.mlp.experts.0.w1.weight": "pytorch_model-00015-of-00019.bin",
537
+ "model.layers.24.mlp.experts.0.w2.weight": "pytorch_model-00015-of-00019.bin",
538
+ "model.layers.24.mlp.experts.0.w3.weight": "pytorch_model-00015-of-00019.bin",
539
+ "model.layers.24.mlp.experts.1.w1.weight": "pytorch_model-00015-of-00019.bin",
540
+ "model.layers.24.mlp.experts.1.w2.weight": "pytorch_model-00015-of-00019.bin",
541
+ "model.layers.24.mlp.experts.1.w3.weight": "pytorch_model-00015-of-00019.bin",
542
+ "model.layers.24.mlp.experts.2.w1.weight": "pytorch_model-00015-of-00019.bin",
543
+ "model.layers.24.mlp.experts.2.w2.weight": "pytorch_model-00015-of-00019.bin",
544
+ "model.layers.24.mlp.experts.2.w3.weight": "pytorch_model-00015-of-00019.bin",
545
+ "model.layers.24.mlp.experts.3.w1.weight": "pytorch_model-00015-of-00019.bin",
546
+ "model.layers.24.mlp.experts.3.w2.weight": "pytorch_model-00015-of-00019.bin",
547
+ "model.layers.24.mlp.experts.3.w3.weight": "pytorch_model-00015-of-00019.bin",
548
+ "model.layers.24.mlp.experts.4.w1.weight": "pytorch_model-00015-of-00019.bin",
549
+ "model.layers.24.mlp.experts.4.w2.weight": "pytorch_model-00015-of-00019.bin",
550
+ "model.layers.24.mlp.experts.4.w3.weight": "pytorch_model-00015-of-00019.bin",
551
+ "model.layers.24.mlp.experts.5.w1.weight": "pytorch_model-00015-of-00019.bin",
552
+ "model.layers.24.mlp.experts.5.w2.weight": "pytorch_model-00015-of-00019.bin",
553
+ "model.layers.24.mlp.experts.5.w3.weight": "pytorch_model-00015-of-00019.bin",
554
+ "model.layers.24.mlp.experts.6.w1.weight": "pytorch_model-00015-of-00019.bin",
555
+ "model.layers.24.mlp.experts.6.w2.weight": "pytorch_model-00015-of-00019.bin",
556
+ "model.layers.24.mlp.experts.6.w3.weight": "pytorch_model-00015-of-00019.bin",
557
+ "model.layers.24.mlp.experts.7.w1.weight": "pytorch_model-00015-of-00019.bin",
558
+ "model.layers.24.mlp.experts.7.w2.weight": "pytorch_model-00015-of-00019.bin",
559
+ "model.layers.24.mlp.experts.7.w3.weight": "pytorch_model-00015-of-00019.bin",
560
+ "model.layers.24.mlp.gate.weight": "pytorch_model-00015-of-00019.bin",
561
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00015-of-00019.bin",
562
+ "model.layers.24.self_attn.k_proj.weight": "pytorch_model-00015-of-00019.bin",
563
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00015-of-00019.bin",
564
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00015-of-00019.bin",
565
+ "model.layers.24.self_attn.v_proj.weight": "pytorch_model-00015-of-00019.bin",
566
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00016-of-00019.bin",
567
+ "model.layers.25.mlp.experts.0.w1.weight": "pytorch_model-00015-of-00019.bin",
568
+ "model.layers.25.mlp.experts.0.w2.weight": "pytorch_model-00015-of-00019.bin",
569
+ "model.layers.25.mlp.experts.0.w3.weight": "pytorch_model-00015-of-00019.bin",
570
+ "model.layers.25.mlp.experts.1.w1.weight": "pytorch_model-00015-of-00019.bin",
571
+ "model.layers.25.mlp.experts.1.w2.weight": "pytorch_model-00015-of-00019.bin",
572
+ "model.layers.25.mlp.experts.1.w3.weight": "pytorch_model-00015-of-00019.bin",
573
+ "model.layers.25.mlp.experts.2.w1.weight": "pytorch_model-00015-of-00019.bin",
574
+ "model.layers.25.mlp.experts.2.w2.weight": "pytorch_model-00015-of-00019.bin",
575
+ "model.layers.25.mlp.experts.2.w3.weight": "pytorch_model-00015-of-00019.bin",
576
+ "model.layers.25.mlp.experts.3.w1.weight": "pytorch_model-00015-of-00019.bin",
577
+ "model.layers.25.mlp.experts.3.w2.weight": "pytorch_model-00015-of-00019.bin",
578
+ "model.layers.25.mlp.experts.3.w3.weight": "pytorch_model-00015-of-00019.bin",
579
+ "model.layers.25.mlp.experts.4.w1.weight": "pytorch_model-00016-of-00019.bin",
580
+ "model.layers.25.mlp.experts.4.w2.weight": "pytorch_model-00016-of-00019.bin",
581
+ "model.layers.25.mlp.experts.4.w3.weight": "pytorch_model-00016-of-00019.bin",
582
+ "model.layers.25.mlp.experts.5.w1.weight": "pytorch_model-00016-of-00019.bin",
583
+ "model.layers.25.mlp.experts.5.w2.weight": "pytorch_model-00016-of-00019.bin",
584
+ "model.layers.25.mlp.experts.5.w3.weight": "pytorch_model-00016-of-00019.bin",
585
+ "model.layers.25.mlp.experts.6.w1.weight": "pytorch_model-00016-of-00019.bin",
586
+ "model.layers.25.mlp.experts.6.w2.weight": "pytorch_model-00016-of-00019.bin",
587
+ "model.layers.25.mlp.experts.6.w3.weight": "pytorch_model-00016-of-00019.bin",
588
+ "model.layers.25.mlp.experts.7.w1.weight": "pytorch_model-00016-of-00019.bin",
589
+ "model.layers.25.mlp.experts.7.w2.weight": "pytorch_model-00016-of-00019.bin",
590
+ "model.layers.25.mlp.experts.7.w3.weight": "pytorch_model-00016-of-00019.bin",
591
+ "model.layers.25.mlp.gate.weight": "pytorch_model-00016-of-00019.bin",
592
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00016-of-00019.bin",
593
+ "model.layers.25.self_attn.k_proj.weight": "pytorch_model-00015-of-00019.bin",
594
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00015-of-00019.bin",
595
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00015-of-00019.bin",
596
+ "model.layers.25.self_attn.v_proj.weight": "pytorch_model-00015-of-00019.bin",
597
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00016-of-00019.bin",
598
+ "model.layers.26.mlp.experts.0.w1.weight": "pytorch_model-00016-of-00019.bin",
599
+ "model.layers.26.mlp.experts.0.w2.weight": "pytorch_model-00016-of-00019.bin",
600
+ "model.layers.26.mlp.experts.0.w3.weight": "pytorch_model-00016-of-00019.bin",
601
+ "model.layers.26.mlp.experts.1.w1.weight": "pytorch_model-00016-of-00019.bin",
602
+ "model.layers.26.mlp.experts.1.w2.weight": "pytorch_model-00016-of-00019.bin",
603
+ "model.layers.26.mlp.experts.1.w3.weight": "pytorch_model-00016-of-00019.bin",
604
+ "model.layers.26.mlp.experts.2.w1.weight": "pytorch_model-00016-of-00019.bin",
605
+ "model.layers.26.mlp.experts.2.w2.weight": "pytorch_model-00016-of-00019.bin",
606
+ "model.layers.26.mlp.experts.2.w3.weight": "pytorch_model-00016-of-00019.bin",
607
+ "model.layers.26.mlp.experts.3.w1.weight": "pytorch_model-00016-of-00019.bin",
608
+ "model.layers.26.mlp.experts.3.w2.weight": "pytorch_model-00016-of-00019.bin",
609
+ "model.layers.26.mlp.experts.3.w3.weight": "pytorch_model-00016-of-00019.bin",
610
+ "model.layers.26.mlp.experts.4.w1.weight": "pytorch_model-00016-of-00019.bin",
611
+ "model.layers.26.mlp.experts.4.w2.weight": "pytorch_model-00016-of-00019.bin",
612
+ "model.layers.26.mlp.experts.4.w3.weight": "pytorch_model-00016-of-00019.bin",
613
+ "model.layers.26.mlp.experts.5.w1.weight": "pytorch_model-00016-of-00019.bin",
614
+ "model.layers.26.mlp.experts.5.w2.weight": "pytorch_model-00016-of-00019.bin",
615
+ "model.layers.26.mlp.experts.5.w3.weight": "pytorch_model-00016-of-00019.bin",
616
+ "model.layers.26.mlp.experts.6.w1.weight": "pytorch_model-00016-of-00019.bin",
617
+ "model.layers.26.mlp.experts.6.w2.weight": "pytorch_model-00016-of-00019.bin",
618
+ "model.layers.26.mlp.experts.6.w3.weight": "pytorch_model-00016-of-00019.bin",
619
+ "model.layers.26.mlp.experts.7.w1.weight": "pytorch_model-00016-of-00019.bin",
620
+ "model.layers.26.mlp.experts.7.w2.weight": "pytorch_model-00016-of-00019.bin",
621
+ "model.layers.26.mlp.experts.7.w3.weight": "pytorch_model-00016-of-00019.bin",
622
+ "model.layers.26.mlp.gate.weight": "pytorch_model-00016-of-00019.bin",
623
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00016-of-00019.bin",
624
+ "model.layers.26.self_attn.k_proj.weight": "pytorch_model-00016-of-00019.bin",
625
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00016-of-00019.bin",
626
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00016-of-00019.bin",
627
+ "model.layers.26.self_attn.v_proj.weight": "pytorch_model-00016-of-00019.bin",
628
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00017-of-00019.bin",
629
+ "model.layers.27.mlp.experts.0.w1.weight": "pytorch_model-00016-of-00019.bin",
630
+ "model.layers.27.mlp.experts.0.w2.weight": "pytorch_model-00016-of-00019.bin",
631
+ "model.layers.27.mlp.experts.0.w3.weight": "pytorch_model-00016-of-00019.bin",
632
+ "model.layers.27.mlp.experts.1.w1.weight": "pytorch_model-00016-of-00019.bin",
633
+ "model.layers.27.mlp.experts.1.w2.weight": "pytorch_model-00016-of-00019.bin",
634
+ "model.layers.27.mlp.experts.1.w3.weight": "pytorch_model-00017-of-00019.bin",
635
+ "model.layers.27.mlp.experts.2.w1.weight": "pytorch_model-00017-of-00019.bin",
636
+ "model.layers.27.mlp.experts.2.w2.weight": "pytorch_model-00017-of-00019.bin",
637
+ "model.layers.27.mlp.experts.2.w3.weight": "pytorch_model-00017-of-00019.bin",
638
+ "model.layers.27.mlp.experts.3.w1.weight": "pytorch_model-00017-of-00019.bin",
639
+ "model.layers.27.mlp.experts.3.w2.weight": "pytorch_model-00017-of-00019.bin",
640
+ "model.layers.27.mlp.experts.3.w3.weight": "pytorch_model-00017-of-00019.bin",
641
+ "model.layers.27.mlp.experts.4.w1.weight": "pytorch_model-00017-of-00019.bin",
642
+ "model.layers.27.mlp.experts.4.w2.weight": "pytorch_model-00017-of-00019.bin",
643
+ "model.layers.27.mlp.experts.4.w3.weight": "pytorch_model-00017-of-00019.bin",
644
+ "model.layers.27.mlp.experts.5.w1.weight": "pytorch_model-00017-of-00019.bin",
645
+ "model.layers.27.mlp.experts.5.w2.weight": "pytorch_model-00017-of-00019.bin",
646
+ "model.layers.27.mlp.experts.5.w3.weight": "pytorch_model-00017-of-00019.bin",
647
+ "model.layers.27.mlp.experts.6.w1.weight": "pytorch_model-00017-of-00019.bin",
648
+ "model.layers.27.mlp.experts.6.w2.weight": "pytorch_model-00017-of-00019.bin",
649
+ "model.layers.27.mlp.experts.6.w3.weight": "pytorch_model-00017-of-00019.bin",
650
+ "model.layers.27.mlp.experts.7.w1.weight": "pytorch_model-00017-of-00019.bin",
651
+ "model.layers.27.mlp.experts.7.w2.weight": "pytorch_model-00017-of-00019.bin",
652
+ "model.layers.27.mlp.experts.7.w3.weight": "pytorch_model-00017-of-00019.bin",
653
+ "model.layers.27.mlp.gate.weight": "pytorch_model-00017-of-00019.bin",
654
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00017-of-00019.bin",
655
+ "model.layers.27.self_attn.k_proj.weight": "pytorch_model-00016-of-00019.bin",
656
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00016-of-00019.bin",
657
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00016-of-00019.bin",
658
+ "model.layers.27.self_attn.v_proj.weight": "pytorch_model-00016-of-00019.bin",
659
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00018-of-00019.bin",
660
+ "model.layers.28.mlp.experts.0.w1.weight": "pytorch_model-00017-of-00019.bin",
661
+ "model.layers.28.mlp.experts.0.w2.weight": "pytorch_model-00017-of-00019.bin",
662
+ "model.layers.28.mlp.experts.0.w3.weight": "pytorch_model-00017-of-00019.bin",
663
+ "model.layers.28.mlp.experts.1.w1.weight": "pytorch_model-00017-of-00019.bin",
664
+ "model.layers.28.mlp.experts.1.w2.weight": "pytorch_model-00017-of-00019.bin",
665
+ "model.layers.28.mlp.experts.1.w3.weight": "pytorch_model-00017-of-00019.bin",
666
+ "model.layers.28.mlp.experts.2.w1.weight": "pytorch_model-00017-of-00019.bin",
667
+ "model.layers.28.mlp.experts.2.w2.weight": "pytorch_model-00017-of-00019.bin",
668
+ "model.layers.28.mlp.experts.2.w3.weight": "pytorch_model-00017-of-00019.bin",
669
+ "model.layers.28.mlp.experts.3.w1.weight": "pytorch_model-00017-of-00019.bin",
670
+ "model.layers.28.mlp.experts.3.w2.weight": "pytorch_model-00017-of-00019.bin",
671
+ "model.layers.28.mlp.experts.3.w3.weight": "pytorch_model-00017-of-00019.bin",
672
+ "model.layers.28.mlp.experts.4.w1.weight": "pytorch_model-00017-of-00019.bin",
673
+ "model.layers.28.mlp.experts.4.w2.weight": "pytorch_model-00017-of-00019.bin",
674
+ "model.layers.28.mlp.experts.4.w3.weight": "pytorch_model-00017-of-00019.bin",
675
+ "model.layers.28.mlp.experts.5.w1.weight": "pytorch_model-00017-of-00019.bin",
676
+ "model.layers.28.mlp.experts.5.w2.weight": "pytorch_model-00017-of-00019.bin",
677
+ "model.layers.28.mlp.experts.5.w3.weight": "pytorch_model-00017-of-00019.bin",
678
+ "model.layers.28.mlp.experts.6.w1.weight": "pytorch_model-00017-of-00019.bin",
679
+ "model.layers.28.mlp.experts.6.w2.weight": "pytorch_model-00017-of-00019.bin",
680
+ "model.layers.28.mlp.experts.6.w3.weight": "pytorch_model-00017-of-00019.bin",
681
+ "model.layers.28.mlp.experts.7.w1.weight": "pytorch_model-00017-of-00019.bin",
682
+ "model.layers.28.mlp.experts.7.w2.weight": "pytorch_model-00018-of-00019.bin",
683
+ "model.layers.28.mlp.experts.7.w3.weight": "pytorch_model-00018-of-00019.bin",
684
+ "model.layers.28.mlp.gate.weight": "pytorch_model-00018-of-00019.bin",
685
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00018-of-00019.bin",
686
+ "model.layers.28.self_attn.k_proj.weight": "pytorch_model-00017-of-00019.bin",
687
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00017-of-00019.bin",
688
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00017-of-00019.bin",
689
+ "model.layers.28.self_attn.v_proj.weight": "pytorch_model-00017-of-00019.bin",
690
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00018-of-00019.bin",
691
+ "model.layers.29.mlp.experts.0.w1.weight": "pytorch_model-00018-of-00019.bin",
692
+ "model.layers.29.mlp.experts.0.w2.weight": "pytorch_model-00018-of-00019.bin",
693
+ "model.layers.29.mlp.experts.0.w3.weight": "pytorch_model-00018-of-00019.bin",
694
+ "model.layers.29.mlp.experts.1.w1.weight": "pytorch_model-00018-of-00019.bin",
695
+ "model.layers.29.mlp.experts.1.w2.weight": "pytorch_model-00018-of-00019.bin",
696
+ "model.layers.29.mlp.experts.1.w3.weight": "pytorch_model-00018-of-00019.bin",
697
+ "model.layers.29.mlp.experts.2.w1.weight": "pytorch_model-00018-of-00019.bin",
698
+ "model.layers.29.mlp.experts.2.w2.weight": "pytorch_model-00018-of-00019.bin",
699
+ "model.layers.29.mlp.experts.2.w3.weight": "pytorch_model-00018-of-00019.bin",
700
+ "model.layers.29.mlp.experts.3.w1.weight": "pytorch_model-00018-of-00019.bin",
701
+ "model.layers.29.mlp.experts.3.w2.weight": "pytorch_model-00018-of-00019.bin",
702
+ "model.layers.29.mlp.experts.3.w3.weight": "pytorch_model-00018-of-00019.bin",
703
+ "model.layers.29.mlp.experts.4.w1.weight": "pytorch_model-00018-of-00019.bin",
704
+ "model.layers.29.mlp.experts.4.w2.weight": "pytorch_model-00018-of-00019.bin",
705
+ "model.layers.29.mlp.experts.4.w3.weight": "pytorch_model-00018-of-00019.bin",
706
+ "model.layers.29.mlp.experts.5.w1.weight": "pytorch_model-00018-of-00019.bin",
707
+ "model.layers.29.mlp.experts.5.w2.weight": "pytorch_model-00018-of-00019.bin",
708
+ "model.layers.29.mlp.experts.5.w3.weight": "pytorch_model-00018-of-00019.bin",
709
+ "model.layers.29.mlp.experts.6.w1.weight": "pytorch_model-00018-of-00019.bin",
710
+ "model.layers.29.mlp.experts.6.w2.weight": "pytorch_model-00018-of-00019.bin",
711
+ "model.layers.29.mlp.experts.6.w3.weight": "pytorch_model-00018-of-00019.bin",
712
+ "model.layers.29.mlp.experts.7.w1.weight": "pytorch_model-00018-of-00019.bin",
713
+ "model.layers.29.mlp.experts.7.w2.weight": "pytorch_model-00018-of-00019.bin",
714
+ "model.layers.29.mlp.experts.7.w3.weight": "pytorch_model-00018-of-00019.bin",
715
+ "model.layers.29.mlp.gate.weight": "pytorch_model-00018-of-00019.bin",
716
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00018-of-00019.bin",
717
+ "model.layers.29.self_attn.k_proj.weight": "pytorch_model-00018-of-00019.bin",
718
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00018-of-00019.bin",
719
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00018-of-00019.bin",
720
+ "model.layers.29.self_attn.v_proj.weight": "pytorch_model-00018-of-00019.bin",
721
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00003-of-00019.bin",
722
+ "model.layers.3.mlp.experts.0.w1.weight": "pytorch_model-00002-of-00019.bin",
723
+ "model.layers.3.mlp.experts.0.w2.weight": "pytorch_model-00002-of-00019.bin",
724
+ "model.layers.3.mlp.experts.0.w3.weight": "pytorch_model-00002-of-00019.bin",
725
+ "model.layers.3.mlp.experts.1.w1.weight": "pytorch_model-00002-of-00019.bin",
726
+ "model.layers.3.mlp.experts.1.w2.weight": "pytorch_model-00002-of-00019.bin",
727
+ "model.layers.3.mlp.experts.1.w3.weight": "pytorch_model-00002-of-00019.bin",
728
+ "model.layers.3.mlp.experts.2.w1.weight": "pytorch_model-00002-of-00019.bin",
729
+ "model.layers.3.mlp.experts.2.w2.weight": "pytorch_model-00003-of-00019.bin",
730
+ "model.layers.3.mlp.experts.2.w3.weight": "pytorch_model-00003-of-00019.bin",
731
+ "model.layers.3.mlp.experts.3.w1.weight": "pytorch_model-00003-of-00019.bin",
732
+ "model.layers.3.mlp.experts.3.w2.weight": "pytorch_model-00003-of-00019.bin",
733
+ "model.layers.3.mlp.experts.3.w3.weight": "pytorch_model-00003-of-00019.bin",
734
+ "model.layers.3.mlp.experts.4.w1.weight": "pytorch_model-00003-of-00019.bin",
735
+ "model.layers.3.mlp.experts.4.w2.weight": "pytorch_model-00003-of-00019.bin",
736
+ "model.layers.3.mlp.experts.4.w3.weight": "pytorch_model-00003-of-00019.bin",
737
+ "model.layers.3.mlp.experts.5.w1.weight": "pytorch_model-00003-of-00019.bin",
738
+ "model.layers.3.mlp.experts.5.w2.weight": "pytorch_model-00003-of-00019.bin",
739
+ "model.layers.3.mlp.experts.5.w3.weight": "pytorch_model-00003-of-00019.bin",
740
+ "model.layers.3.mlp.experts.6.w1.weight": "pytorch_model-00003-of-00019.bin",
741
+ "model.layers.3.mlp.experts.6.w2.weight": "pytorch_model-00003-of-00019.bin",
742
+ "model.layers.3.mlp.experts.6.w3.weight": "pytorch_model-00003-of-00019.bin",
743
+ "model.layers.3.mlp.experts.7.w1.weight": "pytorch_model-00003-of-00019.bin",
744
+ "model.layers.3.mlp.experts.7.w2.weight": "pytorch_model-00003-of-00019.bin",
745
+ "model.layers.3.mlp.experts.7.w3.weight": "pytorch_model-00003-of-00019.bin",
746
+ "model.layers.3.mlp.gate.weight": "pytorch_model-00003-of-00019.bin",
747
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00003-of-00019.bin",
748
+ "model.layers.3.self_attn.k_proj.weight": "pytorch_model-00002-of-00019.bin",
749
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00002-of-00019.bin",
750
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00002-of-00019.bin",
751
+ "model.layers.3.self_attn.v_proj.weight": "pytorch_model-00002-of-00019.bin",
752
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00019-of-00019.bin",
753
+ "model.layers.30.mlp.experts.0.w1.weight": "pytorch_model-00018-of-00019.bin",
754
+ "model.layers.30.mlp.experts.0.w2.weight": "pytorch_model-00018-of-00019.bin",
755
+ "model.layers.30.mlp.experts.0.w3.weight": "pytorch_model-00018-of-00019.bin",
756
+ "model.layers.30.mlp.experts.1.w1.weight": "pytorch_model-00018-of-00019.bin",
757
+ "model.layers.30.mlp.experts.1.w2.weight": "pytorch_model-00018-of-00019.bin",
758
+ "model.layers.30.mlp.experts.1.w3.weight": "pytorch_model-00018-of-00019.bin",
759
+ "model.layers.30.mlp.experts.2.w1.weight": "pytorch_model-00018-of-00019.bin",
760
+ "model.layers.30.mlp.experts.2.w2.weight": "pytorch_model-00018-of-00019.bin",
761
+ "model.layers.30.mlp.experts.2.w3.weight": "pytorch_model-00018-of-00019.bin",
762
+ "model.layers.30.mlp.experts.3.w1.weight": "pytorch_model-00018-of-00019.bin",
763
+ "model.layers.30.mlp.experts.3.w2.weight": "pytorch_model-00018-of-00019.bin",
764
+ "model.layers.30.mlp.experts.3.w3.weight": "pytorch_model-00018-of-00019.bin",
765
+ "model.layers.30.mlp.experts.4.w1.weight": "pytorch_model-00018-of-00019.bin",
766
+ "model.layers.30.mlp.experts.4.w2.weight": "pytorch_model-00018-of-00019.bin",
767
+ "model.layers.30.mlp.experts.4.w3.weight": "pytorch_model-00018-of-00019.bin",
768
+ "model.layers.30.mlp.experts.5.w1.weight": "pytorch_model-00019-of-00019.bin",
769
+ "model.layers.30.mlp.experts.5.w2.weight": "pytorch_model-00019-of-00019.bin",
770
+ "model.layers.30.mlp.experts.5.w3.weight": "pytorch_model-00019-of-00019.bin",
771
+ "model.layers.30.mlp.experts.6.w1.weight": "pytorch_model-00019-of-00019.bin",
772
+ "model.layers.30.mlp.experts.6.w2.weight": "pytorch_model-00019-of-00019.bin",
773
+ "model.layers.30.mlp.experts.6.w3.weight": "pytorch_model-00019-of-00019.bin",
774
+ "model.layers.30.mlp.experts.7.w1.weight": "pytorch_model-00019-of-00019.bin",
775
+ "model.layers.30.mlp.experts.7.w2.weight": "pytorch_model-00019-of-00019.bin",
776
+ "model.layers.30.mlp.experts.7.w3.weight": "pytorch_model-00019-of-00019.bin",
777
+ "model.layers.30.mlp.gate.weight": "pytorch_model-00019-of-00019.bin",
778
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00019-of-00019.bin",
779
+ "model.layers.30.self_attn.k_proj.weight": "pytorch_model-00018-of-00019.bin",
780
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00018-of-00019.bin",
781
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00018-of-00019.bin",
782
+ "model.layers.30.self_attn.v_proj.weight": "pytorch_model-00018-of-00019.bin",
783
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00019-of-00019.bin",
784
+ "model.layers.31.mlp.experts.0.w1.weight": "pytorch_model-00019-of-00019.bin",
785
+ "model.layers.31.mlp.experts.0.w2.weight": "pytorch_model-00019-of-00019.bin",
786
+ "model.layers.31.mlp.experts.0.w3.weight": "pytorch_model-00019-of-00019.bin",
787
+ "model.layers.31.mlp.experts.1.w1.weight": "pytorch_model-00019-of-00019.bin",
788
+ "model.layers.31.mlp.experts.1.w2.weight": "pytorch_model-00019-of-00019.bin",
789
+ "model.layers.31.mlp.experts.1.w3.weight": "pytorch_model-00019-of-00019.bin",
790
+ "model.layers.31.mlp.experts.2.w1.weight": "pytorch_model-00019-of-00019.bin",
791
+ "model.layers.31.mlp.experts.2.w2.weight": "pytorch_model-00019-of-00019.bin",
792
+ "model.layers.31.mlp.experts.2.w3.weight": "pytorch_model-00019-of-00019.bin",
793
+ "model.layers.31.mlp.experts.3.w1.weight": "pytorch_model-00019-of-00019.bin",
794
+ "model.layers.31.mlp.experts.3.w2.weight": "pytorch_model-00019-of-00019.bin",
795
+ "model.layers.31.mlp.experts.3.w3.weight": "pytorch_model-00019-of-00019.bin",
796
+ "model.layers.31.mlp.experts.4.w1.weight": "pytorch_model-00019-of-00019.bin",
797
+ "model.layers.31.mlp.experts.4.w2.weight": "pytorch_model-00019-of-00019.bin",
798
+ "model.layers.31.mlp.experts.4.w3.weight": "pytorch_model-00019-of-00019.bin",
799
+ "model.layers.31.mlp.experts.5.w1.weight": "pytorch_model-00019-of-00019.bin",
800
+ "model.layers.31.mlp.experts.5.w2.weight": "pytorch_model-00019-of-00019.bin",
801
+ "model.layers.31.mlp.experts.5.w3.weight": "pytorch_model-00019-of-00019.bin",
802
+ "model.layers.31.mlp.experts.6.w1.weight": "pytorch_model-00019-of-00019.bin",
803
+ "model.layers.31.mlp.experts.6.w2.weight": "pytorch_model-00019-of-00019.bin",
804
+ "model.layers.31.mlp.experts.6.w3.weight": "pytorch_model-00019-of-00019.bin",
805
+ "model.layers.31.mlp.experts.7.w1.weight": "pytorch_model-00019-of-00019.bin",
806
+ "model.layers.31.mlp.experts.7.w2.weight": "pytorch_model-00019-of-00019.bin",
807
+ "model.layers.31.mlp.experts.7.w3.weight": "pytorch_model-00019-of-00019.bin",
808
+ "model.layers.31.mlp.gate.weight": "pytorch_model-00019-of-00019.bin",
809
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00019-of-00019.bin",
810
+ "model.layers.31.self_attn.k_proj.weight": "pytorch_model-00019-of-00019.bin",
811
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00019-of-00019.bin",
812
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00019-of-00019.bin",
813
+ "model.layers.31.self_attn.v_proj.weight": "pytorch_model-00019-of-00019.bin",
814
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00003-of-00019.bin",
815
+ "model.layers.4.mlp.experts.0.w1.weight": "pytorch_model-00003-of-00019.bin",
816
+ "model.layers.4.mlp.experts.0.w2.weight": "pytorch_model-00003-of-00019.bin",
817
+ "model.layers.4.mlp.experts.0.w3.weight": "pytorch_model-00003-of-00019.bin",
818
+ "model.layers.4.mlp.experts.1.w1.weight": "pytorch_model-00003-of-00019.bin",
819
+ "model.layers.4.mlp.experts.1.w2.weight": "pytorch_model-00003-of-00019.bin",
820
+ "model.layers.4.mlp.experts.1.w3.weight": "pytorch_model-00003-of-00019.bin",
821
+ "model.layers.4.mlp.experts.2.w1.weight": "pytorch_model-00003-of-00019.bin",
822
+ "model.layers.4.mlp.experts.2.w2.weight": "pytorch_model-00003-of-00019.bin",
823
+ "model.layers.4.mlp.experts.2.w3.weight": "pytorch_model-00003-of-00019.bin",
824
+ "model.layers.4.mlp.experts.3.w1.weight": "pytorch_model-00003-of-00019.bin",
825
+ "model.layers.4.mlp.experts.3.w2.weight": "pytorch_model-00003-of-00019.bin",
826
+ "model.layers.4.mlp.experts.3.w3.weight": "pytorch_model-00003-of-00019.bin",
827
+ "model.layers.4.mlp.experts.4.w1.weight": "pytorch_model-00003-of-00019.bin",
828
+ "model.layers.4.mlp.experts.4.w2.weight": "pytorch_model-00003-of-00019.bin",
829
+ "model.layers.4.mlp.experts.4.w3.weight": "pytorch_model-00003-of-00019.bin",
830
+ "model.layers.4.mlp.experts.5.w1.weight": "pytorch_model-00003-of-00019.bin",
831
+ "model.layers.4.mlp.experts.5.w2.weight": "pytorch_model-00003-of-00019.bin",
832
+ "model.layers.4.mlp.experts.5.w3.weight": "pytorch_model-00003-of-00019.bin",
833
+ "model.layers.4.mlp.experts.6.w1.weight": "pytorch_model-00003-of-00019.bin",
834
+ "model.layers.4.mlp.experts.6.w2.weight": "pytorch_model-00003-of-00019.bin",
835
+ "model.layers.4.mlp.experts.6.w3.weight": "pytorch_model-00003-of-00019.bin",
836
+ "model.layers.4.mlp.experts.7.w1.weight": "pytorch_model-00003-of-00019.bin",
837
+ "model.layers.4.mlp.experts.7.w2.weight": "pytorch_model-00003-of-00019.bin",
838
+ "model.layers.4.mlp.experts.7.w3.weight": "pytorch_model-00003-of-00019.bin",
839
+ "model.layers.4.mlp.gate.weight": "pytorch_model-00003-of-00019.bin",
840
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00003-of-00019.bin",
841
+ "model.layers.4.self_attn.k_proj.weight": "pytorch_model-00003-of-00019.bin",
842
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00003-of-00019.bin",
843
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00003-of-00019.bin",
844
+ "model.layers.4.self_attn.v_proj.weight": "pytorch_model-00003-of-00019.bin",
845
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00004-of-00019.bin",
846
+ "model.layers.5.mlp.experts.0.w1.weight": "pytorch_model-00004-of-00019.bin",
847
+ "model.layers.5.mlp.experts.0.w2.weight": "pytorch_model-00004-of-00019.bin",
848
+ "model.layers.5.mlp.experts.0.w3.weight": "pytorch_model-00004-of-00019.bin",
849
+ "model.layers.5.mlp.experts.1.w1.weight": "pytorch_model-00004-of-00019.bin",
850
+ "model.layers.5.mlp.experts.1.w2.weight": "pytorch_model-00004-of-00019.bin",
851
+ "model.layers.5.mlp.experts.1.w3.weight": "pytorch_model-00004-of-00019.bin",
852
+ "model.layers.5.mlp.experts.2.w1.weight": "pytorch_model-00004-of-00019.bin",
853
+ "model.layers.5.mlp.experts.2.w2.weight": "pytorch_model-00004-of-00019.bin",
854
+ "model.layers.5.mlp.experts.2.w3.weight": "pytorch_model-00004-of-00019.bin",
855
+ "model.layers.5.mlp.experts.3.w1.weight": "pytorch_model-00004-of-00019.bin",
856
+ "model.layers.5.mlp.experts.3.w2.weight": "pytorch_model-00004-of-00019.bin",
857
+ "model.layers.5.mlp.experts.3.w3.weight": "pytorch_model-00004-of-00019.bin",
858
+ "model.layers.5.mlp.experts.4.w1.weight": "pytorch_model-00004-of-00019.bin",
859
+ "model.layers.5.mlp.experts.4.w2.weight": "pytorch_model-00004-of-00019.bin",
860
+ "model.layers.5.mlp.experts.4.w3.weight": "pytorch_model-00004-of-00019.bin",
861
+ "model.layers.5.mlp.experts.5.w1.weight": "pytorch_model-00004-of-00019.bin",
862
+ "model.layers.5.mlp.experts.5.w2.weight": "pytorch_model-00004-of-00019.bin",
863
+ "model.layers.5.mlp.experts.5.w3.weight": "pytorch_model-00004-of-00019.bin",
864
+ "model.layers.5.mlp.experts.6.w1.weight": "pytorch_model-00004-of-00019.bin",
865
+ "model.layers.5.mlp.experts.6.w2.weight": "pytorch_model-00004-of-00019.bin",
866
+ "model.layers.5.mlp.experts.6.w3.weight": "pytorch_model-00004-of-00019.bin",
867
+ "model.layers.5.mlp.experts.7.w1.weight": "pytorch_model-00004-of-00019.bin",
868
+ "model.layers.5.mlp.experts.7.w2.weight": "pytorch_model-00004-of-00019.bin",
869
+ "model.layers.5.mlp.experts.7.w3.weight": "pytorch_model-00004-of-00019.bin",
870
+ "model.layers.5.mlp.gate.weight": "pytorch_model-00004-of-00019.bin",
871
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00004-of-00019.bin",
872
+ "model.layers.5.self_attn.k_proj.weight": "pytorch_model-00003-of-00019.bin",
873
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00003-of-00019.bin",
874
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00003-of-00019.bin",
875
+ "model.layers.5.self_attn.v_proj.weight": "pytorch_model-00003-of-00019.bin",
876
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00005-of-00019.bin",
877
+ "model.layers.6.mlp.experts.0.w1.weight": "pytorch_model-00004-of-00019.bin",
878
+ "model.layers.6.mlp.experts.0.w2.weight": "pytorch_model-00004-of-00019.bin",
879
+ "model.layers.6.mlp.experts.0.w3.weight": "pytorch_model-00004-of-00019.bin",
880
+ "model.layers.6.mlp.experts.1.w1.weight": "pytorch_model-00004-of-00019.bin",
881
+ "model.layers.6.mlp.experts.1.w2.weight": "pytorch_model-00004-of-00019.bin",
882
+ "model.layers.6.mlp.experts.1.w3.weight": "pytorch_model-00004-of-00019.bin",
883
+ "model.layers.6.mlp.experts.2.w1.weight": "pytorch_model-00004-of-00019.bin",
884
+ "model.layers.6.mlp.experts.2.w2.weight": "pytorch_model-00004-of-00019.bin",
885
+ "model.layers.6.mlp.experts.2.w3.weight": "pytorch_model-00004-of-00019.bin",
886
+ "model.layers.6.mlp.experts.3.w1.weight": "pytorch_model-00004-of-00019.bin",
887
+ "model.layers.6.mlp.experts.3.w2.weight": "pytorch_model-00004-of-00019.bin",
888
+ "model.layers.6.mlp.experts.3.w3.weight": "pytorch_model-00004-of-00019.bin",
889
+ "model.layers.6.mlp.experts.4.w1.weight": "pytorch_model-00004-of-00019.bin",
890
+ "model.layers.6.mlp.experts.4.w2.weight": "pytorch_model-00004-of-00019.bin",
891
+ "model.layers.6.mlp.experts.4.w3.weight": "pytorch_model-00004-of-00019.bin",
892
+ "model.layers.6.mlp.experts.5.w1.weight": "pytorch_model-00004-of-00019.bin",
893
+ "model.layers.6.mlp.experts.5.w2.weight": "pytorch_model-00004-of-00019.bin",
894
+ "model.layers.6.mlp.experts.5.w3.weight": "pytorch_model-00005-of-00019.bin",
895
+ "model.layers.6.mlp.experts.6.w1.weight": "pytorch_model-00005-of-00019.bin",
896
+ "model.layers.6.mlp.experts.6.w2.weight": "pytorch_model-00005-of-00019.bin",
897
+ "model.layers.6.mlp.experts.6.w3.weight": "pytorch_model-00005-of-00019.bin",
898
+ "model.layers.6.mlp.experts.7.w1.weight": "pytorch_model-00005-of-00019.bin",
899
+ "model.layers.6.mlp.experts.7.w2.weight": "pytorch_model-00005-of-00019.bin",
900
+ "model.layers.6.mlp.experts.7.w3.weight": "pytorch_model-00005-of-00019.bin",
901
+ "model.layers.6.mlp.gate.weight": "pytorch_model-00005-of-00019.bin",
902
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00005-of-00019.bin",
903
+ "model.layers.6.self_attn.k_proj.weight": "pytorch_model-00004-of-00019.bin",
904
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00004-of-00019.bin",
905
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00004-of-00019.bin",
906
+ "model.layers.6.self_attn.v_proj.weight": "pytorch_model-00004-of-00019.bin",
907
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00005-of-00019.bin",
908
+ "model.layers.7.mlp.experts.0.w1.weight": "pytorch_model-00005-of-00019.bin",
909
+ "model.layers.7.mlp.experts.0.w2.weight": "pytorch_model-00005-of-00019.bin",
910
+ "model.layers.7.mlp.experts.0.w3.weight": "pytorch_model-00005-of-00019.bin",
911
+ "model.layers.7.mlp.experts.1.w1.weight": "pytorch_model-00005-of-00019.bin",
912
+ "model.layers.7.mlp.experts.1.w2.weight": "pytorch_model-00005-of-00019.bin",
913
+ "model.layers.7.mlp.experts.1.w3.weight": "pytorch_model-00005-of-00019.bin",
914
+ "model.layers.7.mlp.experts.2.w1.weight": "pytorch_model-00005-of-00019.bin",
915
+ "model.layers.7.mlp.experts.2.w2.weight": "pytorch_model-00005-of-00019.bin",
916
+ "model.layers.7.mlp.experts.2.w3.weight": "pytorch_model-00005-of-00019.bin",
917
+ "model.layers.7.mlp.experts.3.w1.weight": "pytorch_model-00005-of-00019.bin",
918
+ "model.layers.7.mlp.experts.3.w2.weight": "pytorch_model-00005-of-00019.bin",
919
+ "model.layers.7.mlp.experts.3.w3.weight": "pytorch_model-00005-of-00019.bin",
920
+ "model.layers.7.mlp.experts.4.w1.weight": "pytorch_model-00005-of-00019.bin",
921
+ "model.layers.7.mlp.experts.4.w2.weight": "pytorch_model-00005-of-00019.bin",
922
+ "model.layers.7.mlp.experts.4.w3.weight": "pytorch_model-00005-of-00019.bin",
923
+ "model.layers.7.mlp.experts.5.w1.weight": "pytorch_model-00005-of-00019.bin",
924
+ "model.layers.7.mlp.experts.5.w2.weight": "pytorch_model-00005-of-00019.bin",
925
+ "model.layers.7.mlp.experts.5.w3.weight": "pytorch_model-00005-of-00019.bin",
926
+ "model.layers.7.mlp.experts.6.w1.weight": "pytorch_model-00005-of-00019.bin",
927
+ "model.layers.7.mlp.experts.6.w2.weight": "pytorch_model-00005-of-00019.bin",
928
+ "model.layers.7.mlp.experts.6.w3.weight": "pytorch_model-00005-of-00019.bin",
929
+ "model.layers.7.mlp.experts.7.w1.weight": "pytorch_model-00005-of-00019.bin",
930
+ "model.layers.7.mlp.experts.7.w2.weight": "pytorch_model-00005-of-00019.bin",
931
+ "model.layers.7.mlp.experts.7.w3.weight": "pytorch_model-00005-of-00019.bin",
932
+ "model.layers.7.mlp.gate.weight": "pytorch_model-00005-of-00019.bin",
933
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00005-of-00019.bin",
934
+ "model.layers.7.self_attn.k_proj.weight": "pytorch_model-00005-of-00019.bin",
935
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00005-of-00019.bin",
936
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00005-of-00019.bin",
937
+ "model.layers.7.self_attn.v_proj.weight": "pytorch_model-00005-of-00019.bin",
938
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00006-of-00019.bin",
939
+ "model.layers.8.mlp.experts.0.w1.weight": "pytorch_model-00005-of-00019.bin",
940
+ "model.layers.8.mlp.experts.0.w2.weight": "pytorch_model-00005-of-00019.bin",
941
+ "model.layers.8.mlp.experts.0.w3.weight": "pytorch_model-00005-of-00019.bin",
942
+ "model.layers.8.mlp.experts.1.w1.weight": "pytorch_model-00005-of-00019.bin",
943
+ "model.layers.8.mlp.experts.1.w2.weight": "pytorch_model-00005-of-00019.bin",
944
+ "model.layers.8.mlp.experts.1.w3.weight": "pytorch_model-00005-of-00019.bin",
945
+ "model.layers.8.mlp.experts.2.w1.weight": "pytorch_model-00005-of-00019.bin",
946
+ "model.layers.8.mlp.experts.2.w2.weight": "pytorch_model-00005-of-00019.bin",
947
+ "model.layers.8.mlp.experts.2.w3.weight": "pytorch_model-00005-of-00019.bin",
948
+ "model.layers.8.mlp.experts.3.w1.weight": "pytorch_model-00005-of-00019.bin",
949
+ "model.layers.8.mlp.experts.3.w2.weight": "pytorch_model-00006-of-00019.bin",
950
+ "model.layers.8.mlp.experts.3.w3.weight": "pytorch_model-00006-of-00019.bin",
951
+ "model.layers.8.mlp.experts.4.w1.weight": "pytorch_model-00006-of-00019.bin",
952
+ "model.layers.8.mlp.experts.4.w2.weight": "pytorch_model-00006-of-00019.bin",
953
+ "model.layers.8.mlp.experts.4.w3.weight": "pytorch_model-00006-of-00019.bin",
954
+ "model.layers.8.mlp.experts.5.w1.weight": "pytorch_model-00006-of-00019.bin",
955
+ "model.layers.8.mlp.experts.5.w2.weight": "pytorch_model-00006-of-00019.bin",
956
+ "model.layers.8.mlp.experts.5.w3.weight": "pytorch_model-00006-of-00019.bin",
957
+ "model.layers.8.mlp.experts.6.w1.weight": "pytorch_model-00006-of-00019.bin",
958
+ "model.layers.8.mlp.experts.6.w2.weight": "pytorch_model-00006-of-00019.bin",
959
+ "model.layers.8.mlp.experts.6.w3.weight": "pytorch_model-00006-of-00019.bin",
960
+ "model.layers.8.mlp.experts.7.w1.weight": "pytorch_model-00006-of-00019.bin",
961
+ "model.layers.8.mlp.experts.7.w2.weight": "pytorch_model-00006-of-00019.bin",
962
+ "model.layers.8.mlp.experts.7.w3.weight": "pytorch_model-00006-of-00019.bin",
963
+ "model.layers.8.mlp.gate.weight": "pytorch_model-00006-of-00019.bin",
964
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00006-of-00019.bin",
965
+ "model.layers.8.self_attn.k_proj.weight": "pytorch_model-00005-of-00019.bin",
966
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00005-of-00019.bin",
967
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00005-of-00019.bin",
968
+ "model.layers.8.self_attn.v_proj.weight": "pytorch_model-00005-of-00019.bin",
969
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00006-of-00019.bin",
970
+ "model.layers.9.mlp.experts.0.w1.weight": "pytorch_model-00006-of-00019.bin",
971
+ "model.layers.9.mlp.experts.0.w2.weight": "pytorch_model-00006-of-00019.bin",
972
+ "model.layers.9.mlp.experts.0.w3.weight": "pytorch_model-00006-of-00019.bin",
973
+ "model.layers.9.mlp.experts.1.w1.weight": "pytorch_model-00006-of-00019.bin",
974
+ "model.layers.9.mlp.experts.1.w2.weight": "pytorch_model-00006-of-00019.bin",
975
+ "model.layers.9.mlp.experts.1.w3.weight": "pytorch_model-00006-of-00019.bin",
976
+ "model.layers.9.mlp.experts.2.w1.weight": "pytorch_model-00006-of-00019.bin",
977
+ "model.layers.9.mlp.experts.2.w2.weight": "pytorch_model-00006-of-00019.bin",
978
+ "model.layers.9.mlp.experts.2.w3.weight": "pytorch_model-00006-of-00019.bin",
979
+ "model.layers.9.mlp.experts.3.w1.weight": "pytorch_model-00006-of-00019.bin",
980
+ "model.layers.9.mlp.experts.3.w2.weight": "pytorch_model-00006-of-00019.bin",
981
+ "model.layers.9.mlp.experts.3.w3.weight": "pytorch_model-00006-of-00019.bin",
982
+ "model.layers.9.mlp.experts.4.w1.weight": "pytorch_model-00006-of-00019.bin",
983
+ "model.layers.9.mlp.experts.4.w2.weight": "pytorch_model-00006-of-00019.bin",
984
+ "model.layers.9.mlp.experts.4.w3.weight": "pytorch_model-00006-of-00019.bin",
985
+ "model.layers.9.mlp.experts.5.w1.weight": "pytorch_model-00006-of-00019.bin",
986
+ "model.layers.9.mlp.experts.5.w2.weight": "pytorch_model-00006-of-00019.bin",
987
+ "model.layers.9.mlp.experts.5.w3.weight": "pytorch_model-00006-of-00019.bin",
988
+ "model.layers.9.mlp.experts.6.w1.weight": "pytorch_model-00006-of-00019.bin",
989
+ "model.layers.9.mlp.experts.6.w2.weight": "pytorch_model-00006-of-00019.bin",
990
+ "model.layers.9.mlp.experts.6.w3.weight": "pytorch_model-00006-of-00019.bin",
991
+ "model.layers.9.mlp.experts.7.w1.weight": "pytorch_model-00006-of-00019.bin",
992
+ "model.layers.9.mlp.experts.7.w2.weight": "pytorch_model-00006-of-00019.bin",
993
+ "model.layers.9.mlp.experts.7.w3.weight": "pytorch_model-00006-of-00019.bin",
994
+ "model.layers.9.mlp.gate.weight": "pytorch_model-00006-of-00019.bin",
995
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00006-of-00019.bin",
996
+ "model.layers.9.self_attn.k_proj.weight": "pytorch_model-00006-of-00019.bin",
997
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00006-of-00019.bin",
998
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00006-of-00019.bin",
999
+ "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00006-of-00019.bin",
1000
+ "model.norm.weight": "pytorch_model-00019-of-00019.bin"
1001
+ }
1002
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
Binary file (493 kB). View file
 
tokenizer_config.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "32000": {
30
+ "content": "<|im_end|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ }
37
+ },
38
+ "bos_token": "<s>",
39
+ "clean_up_tokenization_spaces": false,
40
+ "eos_token": "<|im_end|>",
41
+ "legacy": true,
42
+ "model_max_length": 1000000000000000019884624838656,
43
+ "pad_token": "</s>",
44
+ "sp_model_kwargs": {},
45
+ "spaces_between_special_tokens": false,
46
+ "tokenizer_class": "LlamaTokenizer",
47
+ "trust_remote_code": false,
48
+ "unk_token": "<unk>",
49
+ "use_default_system_prompt": false,
50
+ "use_fast": true
51
+ }
upload_adapter.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from huggingface_hub import HfApi
2
+ api = HfApi()
3
+
4
+ api.upload_folder(folder_path="./",repo_id="mattshumer/mistral-8x7b-chat", repo_type="model", multi_commits=True, multi_commits_verbose=True)