Crystalcareai commited on
Commit
2491747
1 Parent(s): c8838fe

Upload folder using huggingface_hub

Browse files
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./out",
3
+ "architectures": [
4
+ "DeepseekForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_deepseek.DeepseekConfig",
10
+ "AutoModel": "modeling_deepseek.DeepseekModel",
11
+ "AutoModelForCausalLM": "modeling_deepseek.DeepseekForCausalLM"
12
+ },
13
+ "aux_loss_alpha": 0.02,
14
+ "bos_token_id": 1,
15
+ "eos_token_id": 2,
16
+ "first_k_dense_replace": 0,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 4096,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 14336,
21
+ "max_position_embeddings": 32768,
22
+ "model_type": "deepseek",
23
+ "moe_intermediate_size": 14336,
24
+ "moe_layer_freq": 1,
25
+ "n_routed_experts": 8,
26
+ "n_shared_experts": null,
27
+ "norm_topk_prob": true,
28
+ "num_attention_heads": 32,
29
+ "num_experts_per_tok": 2,
30
+ "num_hidden_layers": 32,
31
+ "num_key_value_heads": 8,
32
+ "num_local_experts": 8,
33
+ "output_router_logits": false,
34
+ "pretraining_tp": 1,
35
+ "rms_norm_eps": 1e-05,
36
+ "rope_scaling": null,
37
+ "rope_theta": 1000000.0,
38
+ "router_aux_loss_coef": 0.02,
39
+ "scoring_func": "softmax",
40
+ "seq_aux": true,
41
+ "sliding_window": null,
42
+ "tie_word_embeddings": false,
43
+ "torch_dtype": "bfloat16",
44
+ "transformers_version": "4.40.0.dev0",
45
+ "use_cache": false,
46
+ "vocab_size": 32000
47
+ }
configuration_deepseek.py ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.configuration_utils import PretrainedConfig
2
+ from transformers.utils import logging
3
+
4
+ logger = logging.get_logger(__name__)
5
+
6
+ DEEPSEEK_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
7
+ class DeepseekConfig(PretrainedConfig):
8
+ r"""
9
+ This is the configuration class to store the configuration of a [`DeepseekModel`]. It is used to instantiate an DeepSeek
10
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
11
+ defaults will yield a similar configuration to that of the DeepSeek-7B.
12
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
13
+ documentation from [`PretrainedConfig`] for more information.
14
+ Args:
15
+ vocab_size (`int`, *optional*, defaults to 102400):
16
+ Vocabulary size of the Deep model. Defines the number of different tokens that can be represented by the
17
+ `inputs_ids` passed when calling [`DeepseekModel`]
18
+ hidden_size (`int`, *optional*, defaults to 4096):
19
+ Dimension of the hidden representations.
20
+ intermediate_size (`int`, *optional*, defaults to 11008):
21
+ Dimension of the MLP representations.
22
+ moe_intermediate_size (`int`, *optional*, defaults to 1407):
23
+ Dimension of the MoE representations.
24
+ num_hidden_layers (`int`, *optional*, defaults to 32):
25
+ Number of hidden layers in the Transformer decoder.
26
+ num_attention_heads (`int`, *optional*, defaults to 32):
27
+ Number of attention heads for each attention layer in the Transformer decoder.
28
+ n_shared_experts (`int`, *optional*, defaults to None):
29
+ Number of shared experts, None means dense model.
30
+ n_routed_experts (`int`, *optional*, defaults to None):
31
+ Number of routed experts, None means dense model.
32
+ num_experts_per_tok (`int`, *optional*, defaults to None):
33
+ Number of selected experts, None means dense model.
34
+ moe_layer_freq (`int`, *optional*, defaults to 1):
35
+ The frequency of the MoE layer: one expert layer for every `moe_layer_freq - 1` dense layers.
36
+ first_k_dense_replace (`int`, *optional*, defaults to 0):
37
+ Number of dense layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head).
38
+ \--k dense layers--/
39
+ norm_topk_prob (`bool`, *optional*, defaults to False):
40
+ Whether to normalize the weights of the routed experts.
41
+ scoring_func (`str`, *optional*, defaults to 'softmax'):
42
+ Method of computing expert weights.
43
+ aux_loss_alpha (`float`, *optional*, defaults to 0.001):
44
+ Auxiliary loss weight coefficient.
45
+ seq_aux = (`bool`, *optional*, defaults to True):
46
+ Whether to compute the auxiliary loss for each individual sample.
47
+ num_key_value_heads (`int`, *optional*):
48
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
49
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
50
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
51
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
52
+ by meanpooling all the original heads within that group. For more details checkout [this
53
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
54
+ `num_attention_heads`.
55
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
56
+ The non-linear activation function (function or string) in the decoder.
57
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
58
+ The maximum sequence length that this model might ever be used with.
59
+ initializer_range (`float`, *optional*, defaults to 0.02):
60
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
61
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
62
+ The epsilon used by the rms normalization layers.
63
+ use_cache (`bool`, *optional*, defaults to `True`):
64
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
65
+ relevant if `config.is_decoder=True`.
66
+ pad_token_id (`int`, *optional*):
67
+ Padding token id.
68
+ bos_token_id (`int`, *optional*, defaults to 1):
69
+ Beginning of stream token id.
70
+ eos_token_id (`int`, *optional*, defaults to 2):
71
+ End of stream token id.
72
+ pretraining_tp (`int`, *optional*, defaults to 1):
73
+ Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
74
+ document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is
75
+ necessary to ensure exact reproducibility of the pretraining results. Please refer to [this
76
+ issue](https://github.com/pytorch/pytorch/issues/76232).
77
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
78
+ Whether to tie weight embeddings
79
+ rope_theta (`float`, *optional*, defaults to 10000.0):
80
+ The base period of the RoPE embeddings.
81
+ rope_scaling (`Dict`, *optional*):
82
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
83
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
84
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
85
+ `max_position_embeddings` to the expected new maximum.
86
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
87
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
88
+ attention_dropout (`float`, *optional*, defaults to 0.0):
89
+ The dropout ratio for the attention probabilities.
90
+ ```python
91
+ >>> from transformers import DeepseekModel, DeepseekConfig
92
+ >>> # Initializing a Deepseek deepseek-7b style configuration
93
+ >>> configuration = DeepseekConfig()
94
+ >>> # Accessing the model configuration
95
+ >>> configuration = model.config
96
+ ```"""
97
+
98
+ model_type = "deepseek"
99
+ keys_to_ignore_at_inference = ["past_key_values"]
100
+
101
+ def __init__(
102
+ self,
103
+ vocab_size=102400,
104
+ hidden_size=4096,
105
+ intermediate_size=11008,
106
+ moe_intermediate_size = 1407,
107
+ num_hidden_layers=30,
108
+ num_attention_heads=32,
109
+ num_key_value_heads=32,
110
+ n_shared_experts = None,
111
+ n_routed_experts = None,
112
+ num_experts_per_tok = None,
113
+ moe_layer_freq = 1,
114
+ first_k_dense_replace = 0,
115
+ norm_topk_prob = False,
116
+ scoring_func = 'softmax',
117
+ aux_loss_alpha = 0.001,
118
+ seq_aux = True,
119
+ hidden_act="silu",
120
+ max_position_embeddings=2048,
121
+ initializer_range=0.02,
122
+ rms_norm_eps=1e-6,
123
+ use_cache=True,
124
+ pad_token_id=None,
125
+ bos_token_id=100000,
126
+ eos_token_id=100001,
127
+ pretraining_tp=1,
128
+ tie_word_embeddings=False,
129
+ rope_theta=10000.0,
130
+ rope_scaling=None,
131
+ attention_bias=False,
132
+ attention_dropout=0.0,
133
+ **kwargs,
134
+ ):
135
+ self.vocab_size = vocab_size
136
+ self.max_position_embeddings = max_position_embeddings
137
+ self.hidden_size = hidden_size
138
+ self.intermediate_size = intermediate_size
139
+ self.moe_intermediate_size = moe_intermediate_size
140
+ self.num_hidden_layers = num_hidden_layers
141
+ self.num_attention_heads = num_attention_heads
142
+ self.n_shared_experts = n_shared_experts
143
+ self.n_routed_experts = n_routed_experts
144
+ self.num_experts_per_tok = num_experts_per_tok
145
+ self.moe_layer_freq = moe_layer_freq
146
+ self.first_k_dense_replace = first_k_dense_replace
147
+ self.norm_topk_prob = norm_topk_prob
148
+ self.scoring_func = scoring_func
149
+ self.aux_loss_alpha = aux_loss_alpha
150
+ self.seq_aux = seq_aux
151
+ # for backward compatibility
152
+ if num_key_value_heads is None:
153
+ num_key_value_heads = num_attention_heads
154
+
155
+ self.num_key_value_heads = num_key_value_heads
156
+ self.hidden_act = hidden_act
157
+ self.initializer_range = initializer_range
158
+ self.rms_norm_eps = rms_norm_eps
159
+ self.pretraining_tp = pretraining_tp
160
+ self.use_cache = use_cache
161
+ self.rope_theta = rope_theta
162
+ self.rope_scaling = rope_scaling
163
+ self._rope_scaling_validation()
164
+ self.attention_bias = attention_bias
165
+ self.attention_dropout = attention_dropout
166
+
167
+ super().__init__(
168
+ pad_token_id=pad_token_id,
169
+ bos_token_id=bos_token_id,
170
+ eos_token_id=eos_token_id,
171
+ tie_word_embeddings=tie_word_embeddings,
172
+ **kwargs,
173
+ )
174
+
175
+ def _rope_scaling_validation(self):
176
+ """
177
+ Validate the `rope_scaling` configuration.
178
+ """
179
+ if self.rope_scaling is None:
180
+ return
181
+
182
+ if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
183
+ raise ValueError(
184
+ "`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, "
185
+ f"got {self.rope_scaling}"
186
+ )
187
+ rope_scaling_type = self.rope_scaling.get("type", None)
188
+ rope_scaling_factor = self.rope_scaling.get("factor", None)
189
+ if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
190
+ raise ValueError(
191
+ f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
192
+ )
193
+ if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor <= 1.0:
194
+ raise ValueError(f"`rope_scaling`'s factor field must be a float > 1, got {rope_scaling_factor}")
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.40.0.dev0"
6
+ }
model-00001-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e000ce6e1fb51d09f9170fa5af9aa830334f32fd8ef43ef536be6a0ae289f731
3
+ size 4892743656
model-00002-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ddd62a67faaf32dda64666fc4396b993dff4b2bd19566c5db344e25759ec4da
3
+ size 4983003704
model-00003-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8bf30ecc8ed66135f92a8dc2a7765574a5620082bca7d97878b3224a68e692ff
3
+ size 4983003704
model-00004-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3836f6324d8ccf4d8986e27b949a0d2895fddbf9292077c3a66ae690c58845f7
3
+ size 4899034904
model-00005-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3d574c2508cad5d7e3ea2259ae30009de37086a44101758c134bf9a455ad46a
3
+ size 4983003704
model-00006-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6847c60396f20b8e2e0e9fde69298ff445d7c9796d94a6931511fd93649c1e96
3
+ size 4983003720
model-00007-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f4ee92952f794109f5050166707afe92d046fea18bf6f7358fe0f74cb232ebd
3
+ size 4899034952
model-00008-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba0dcaa928a430e11dbad4c65b008c5c71fa500e2a354b8cf10bda24472c3bc7
3
+ size 4983003760
model-00009-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:867cdb58012ea7ef0c7800041732991c28face06dcc4764cdcf52b0053782b32
3
+ size 4983003760
model-00010-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e13fbf4cb53712c4a33ed5f725177b1d0529d1ba52a4fcfefc5e4254ca07f1f8
3
+ size 4899034952
model-00011-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53d534882a8304df7c3bf5311ed96b4f2ad878754797929c737a927150f5ac14
3
+ size 4983003760
model-00012-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:877048eb794c2c21481f7f0128a4a52f36adc683f09cdc793d4594439b6dd1cd
3
+ size 4983003752
model-00013-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86456281600b12a9803c8e12ec7c5f9c385f66b03a7a18927606ef3cbfc4b030
3
+ size 4983003760
model-00014-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:855b3443c40327f8f49d6b53b5e91232dd81d6173a37298a275d119afbefef36
3
+ size 4899034952
model-00015-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29cc4ee44348a5caf411a1f10497b9f691d5ac1b8be0fc351cf59676e6113160
3
+ size 4983003752
model-00016-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c11a220292131e4a94890077cac4cb1d3828160b73590d69d47288c00d089d8
3
+ size 4983003760
model-00017-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49ab8569e1078fb3af6a586a0b66e65179b4aac7c6290996ab406a55e39de427
3
+ size 4899034952
model-00018-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:215d9953d7850fc840d1e8a5fdf4a0ec7237331bcf3cc246135bdca54c98d6ed
3
+ size 4983003752
model-00019-of-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0849f5d5f88a9b07fd9c31f98c3235049c7629738e4bf53ebfddb38ced8e52f3
3
+ size 4221744496
model.safetensors.index.json ADDED
@@ -0,0 +1,1002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 93405585408
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00019-of-00019.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00019.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00019.safetensors",
9
+ "model.layers.0.mlp.experts.0.down_proj.weight": "model-00001-of-00019.safetensors",
10
+ "model.layers.0.mlp.experts.0.gate_proj.weight": "model-00001-of-00019.safetensors",
11
+ "model.layers.0.mlp.experts.0.up_proj.weight": "model-00001-of-00019.safetensors",
12
+ "model.layers.0.mlp.experts.1.down_proj.weight": "model-00001-of-00019.safetensors",
13
+ "model.layers.0.mlp.experts.1.gate_proj.weight": "model-00001-of-00019.safetensors",
14
+ "model.layers.0.mlp.experts.1.up_proj.weight": "model-00001-of-00019.safetensors",
15
+ "model.layers.0.mlp.experts.2.down_proj.weight": "model-00001-of-00019.safetensors",
16
+ "model.layers.0.mlp.experts.2.gate_proj.weight": "model-00001-of-00019.safetensors",
17
+ "model.layers.0.mlp.experts.2.up_proj.weight": "model-00001-of-00019.safetensors",
18
+ "model.layers.0.mlp.experts.3.down_proj.weight": "model-00001-of-00019.safetensors",
19
+ "model.layers.0.mlp.experts.3.gate_proj.weight": "model-00001-of-00019.safetensors",
20
+ "model.layers.0.mlp.experts.3.up_proj.weight": "model-00001-of-00019.safetensors",
21
+ "model.layers.0.mlp.experts.4.down_proj.weight": "model-00001-of-00019.safetensors",
22
+ "model.layers.0.mlp.experts.4.gate_proj.weight": "model-00001-of-00019.safetensors",
23
+ "model.layers.0.mlp.experts.4.up_proj.weight": "model-00001-of-00019.safetensors",
24
+ "model.layers.0.mlp.experts.5.down_proj.weight": "model-00001-of-00019.safetensors",
25
+ "model.layers.0.mlp.experts.5.gate_proj.weight": "model-00001-of-00019.safetensors",
26
+ "model.layers.0.mlp.experts.5.up_proj.weight": "model-00001-of-00019.safetensors",
27
+ "model.layers.0.mlp.experts.6.down_proj.weight": "model-00001-of-00019.safetensors",
28
+ "model.layers.0.mlp.experts.6.gate_proj.weight": "model-00001-of-00019.safetensors",
29
+ "model.layers.0.mlp.experts.6.up_proj.weight": "model-00001-of-00019.safetensors",
30
+ "model.layers.0.mlp.experts.7.down_proj.weight": "model-00001-of-00019.safetensors",
31
+ "model.layers.0.mlp.experts.7.gate_proj.weight": "model-00001-of-00019.safetensors",
32
+ "model.layers.0.mlp.experts.7.up_proj.weight": "model-00001-of-00019.safetensors",
33
+ "model.layers.0.mlp.gate.weight": "model-00001-of-00019.safetensors",
34
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00019.safetensors",
35
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00019.safetensors",
36
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00019.safetensors",
37
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00019.safetensors",
38
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00019.safetensors",
39
+ "model.layers.1.input_layernorm.weight": "model-00002-of-00019.safetensors",
40
+ "model.layers.1.mlp.experts.0.down_proj.weight": "model-00001-of-00019.safetensors",
41
+ "model.layers.1.mlp.experts.0.gate_proj.weight": "model-00001-of-00019.safetensors",
42
+ "model.layers.1.mlp.experts.0.up_proj.weight": "model-00001-of-00019.safetensors",
43
+ "model.layers.1.mlp.experts.1.down_proj.weight": "model-00001-of-00019.safetensors",
44
+ "model.layers.1.mlp.experts.1.gate_proj.weight": "model-00001-of-00019.safetensors",
45
+ "model.layers.1.mlp.experts.1.up_proj.weight": "model-00001-of-00019.safetensors",
46
+ "model.layers.1.mlp.experts.2.down_proj.weight": "model-00001-of-00019.safetensors",
47
+ "model.layers.1.mlp.experts.2.gate_proj.weight": "model-00001-of-00019.safetensors",
48
+ "model.layers.1.mlp.experts.2.up_proj.weight": "model-00001-of-00019.safetensors",
49
+ "model.layers.1.mlp.experts.3.down_proj.weight": "model-00001-of-00019.safetensors",
50
+ "model.layers.1.mlp.experts.3.gate_proj.weight": "model-00001-of-00019.safetensors",
51
+ "model.layers.1.mlp.experts.3.up_proj.weight": "model-00001-of-00019.safetensors",
52
+ "model.layers.1.mlp.experts.4.down_proj.weight": "model-00002-of-00019.safetensors",
53
+ "model.layers.1.mlp.experts.4.gate_proj.weight": "model-00001-of-00019.safetensors",
54
+ "model.layers.1.mlp.experts.4.up_proj.weight": "model-00001-of-00019.safetensors",
55
+ "model.layers.1.mlp.experts.5.down_proj.weight": "model-00002-of-00019.safetensors",
56
+ "model.layers.1.mlp.experts.5.gate_proj.weight": "model-00002-of-00019.safetensors",
57
+ "model.layers.1.mlp.experts.5.up_proj.weight": "model-00002-of-00019.safetensors",
58
+ "model.layers.1.mlp.experts.6.down_proj.weight": "model-00002-of-00019.safetensors",
59
+ "model.layers.1.mlp.experts.6.gate_proj.weight": "model-00002-of-00019.safetensors",
60
+ "model.layers.1.mlp.experts.6.up_proj.weight": "model-00002-of-00019.safetensors",
61
+ "model.layers.1.mlp.experts.7.down_proj.weight": "model-00002-of-00019.safetensors",
62
+ "model.layers.1.mlp.experts.7.gate_proj.weight": "model-00002-of-00019.safetensors",
63
+ "model.layers.1.mlp.experts.7.up_proj.weight": "model-00002-of-00019.safetensors",
64
+ "model.layers.1.mlp.gate.weight": "model-00002-of-00019.safetensors",
65
+ "model.layers.1.post_attention_layernorm.weight": "model-00002-of-00019.safetensors",
66
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00019.safetensors",
67
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00019.safetensors",
68
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00019.safetensors",
69
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00019.safetensors",
70
+ "model.layers.10.input_layernorm.weight": "model-00007-of-00019.safetensors",
71
+ "model.layers.10.mlp.experts.0.down_proj.weight": "model-00006-of-00019.safetensors",
72
+ "model.layers.10.mlp.experts.0.gate_proj.weight": "model-00006-of-00019.safetensors",
73
+ "model.layers.10.mlp.experts.0.up_proj.weight": "model-00006-of-00019.safetensors",
74
+ "model.layers.10.mlp.experts.1.down_proj.weight": "model-00007-of-00019.safetensors",
75
+ "model.layers.10.mlp.experts.1.gate_proj.weight": "model-00007-of-00019.safetensors",
76
+ "model.layers.10.mlp.experts.1.up_proj.weight": "model-00007-of-00019.safetensors",
77
+ "model.layers.10.mlp.experts.2.down_proj.weight": "model-00007-of-00019.safetensors",
78
+ "model.layers.10.mlp.experts.2.gate_proj.weight": "model-00007-of-00019.safetensors",
79
+ "model.layers.10.mlp.experts.2.up_proj.weight": "model-00007-of-00019.safetensors",
80
+ "model.layers.10.mlp.experts.3.down_proj.weight": "model-00007-of-00019.safetensors",
81
+ "model.layers.10.mlp.experts.3.gate_proj.weight": "model-00007-of-00019.safetensors",
82
+ "model.layers.10.mlp.experts.3.up_proj.weight": "model-00007-of-00019.safetensors",
83
+ "model.layers.10.mlp.experts.4.down_proj.weight": "model-00007-of-00019.safetensors",
84
+ "model.layers.10.mlp.experts.4.gate_proj.weight": "model-00007-of-00019.safetensors",
85
+ "model.layers.10.mlp.experts.4.up_proj.weight": "model-00007-of-00019.safetensors",
86
+ "model.layers.10.mlp.experts.5.down_proj.weight": "model-00007-of-00019.safetensors",
87
+ "model.layers.10.mlp.experts.5.gate_proj.weight": "model-00007-of-00019.safetensors",
88
+ "model.layers.10.mlp.experts.5.up_proj.weight": "model-00007-of-00019.safetensors",
89
+ "model.layers.10.mlp.experts.6.down_proj.weight": "model-00007-of-00019.safetensors",
90
+ "model.layers.10.mlp.experts.6.gate_proj.weight": "model-00007-of-00019.safetensors",
91
+ "model.layers.10.mlp.experts.6.up_proj.weight": "model-00007-of-00019.safetensors",
92
+ "model.layers.10.mlp.experts.7.down_proj.weight": "model-00007-of-00019.safetensors",
93
+ "model.layers.10.mlp.experts.7.gate_proj.weight": "model-00007-of-00019.safetensors",
94
+ "model.layers.10.mlp.experts.7.up_proj.weight": "model-00007-of-00019.safetensors",
95
+ "model.layers.10.mlp.gate.weight": "model-00007-of-00019.safetensors",
96
+ "model.layers.10.post_attention_layernorm.weight": "model-00007-of-00019.safetensors",
97
+ "model.layers.10.self_attn.k_proj.weight": "model-00006-of-00019.safetensors",
98
+ "model.layers.10.self_attn.o_proj.weight": "model-00006-of-00019.safetensors",
99
+ "model.layers.10.self_attn.q_proj.weight": "model-00006-of-00019.safetensors",
100
+ "model.layers.10.self_attn.v_proj.weight": "model-00006-of-00019.safetensors",
101
+ "model.layers.11.input_layernorm.weight": "model-00008-of-00019.safetensors",
102
+ "model.layers.11.mlp.experts.0.down_proj.weight": "model-00007-of-00019.safetensors",
103
+ "model.layers.11.mlp.experts.0.gate_proj.weight": "model-00007-of-00019.safetensors",
104
+ "model.layers.11.mlp.experts.0.up_proj.weight": "model-00007-of-00019.safetensors",
105
+ "model.layers.11.mlp.experts.1.down_proj.weight": "model-00007-of-00019.safetensors",
106
+ "model.layers.11.mlp.experts.1.gate_proj.weight": "model-00007-of-00019.safetensors",
107
+ "model.layers.11.mlp.experts.1.up_proj.weight": "model-00007-of-00019.safetensors",
108
+ "model.layers.11.mlp.experts.2.down_proj.weight": "model-00007-of-00019.safetensors",
109
+ "model.layers.11.mlp.experts.2.gate_proj.weight": "model-00007-of-00019.safetensors",
110
+ "model.layers.11.mlp.experts.2.up_proj.weight": "model-00007-of-00019.safetensors",
111
+ "model.layers.11.mlp.experts.3.down_proj.weight": "model-00007-of-00019.safetensors",
112
+ "model.layers.11.mlp.experts.3.gate_proj.weight": "model-00007-of-00019.safetensors",
113
+ "model.layers.11.mlp.experts.3.up_proj.weight": "model-00007-of-00019.safetensors",
114
+ "model.layers.11.mlp.experts.4.down_proj.weight": "model-00007-of-00019.safetensors",
115
+ "model.layers.11.mlp.experts.4.gate_proj.weight": "model-00007-of-00019.safetensors",
116
+ "model.layers.11.mlp.experts.4.up_proj.weight": "model-00007-of-00019.safetensors",
117
+ "model.layers.11.mlp.experts.5.down_proj.weight": "model-00007-of-00019.safetensors",
118
+ "model.layers.11.mlp.experts.5.gate_proj.weight": "model-00007-of-00019.safetensors",
119
+ "model.layers.11.mlp.experts.5.up_proj.weight": "model-00007-of-00019.safetensors",
120
+ "model.layers.11.mlp.experts.6.down_proj.weight": "model-00008-of-00019.safetensors",
121
+ "model.layers.11.mlp.experts.6.gate_proj.weight": "model-00007-of-00019.safetensors",
122
+ "model.layers.11.mlp.experts.6.up_proj.weight": "model-00007-of-00019.safetensors",
123
+ "model.layers.11.mlp.experts.7.down_proj.weight": "model-00008-of-00019.safetensors",
124
+ "model.layers.11.mlp.experts.7.gate_proj.weight": "model-00008-of-00019.safetensors",
125
+ "model.layers.11.mlp.experts.7.up_proj.weight": "model-00008-of-00019.safetensors",
126
+ "model.layers.11.mlp.gate.weight": "model-00008-of-00019.safetensors",
127
+ "model.layers.11.post_attention_layernorm.weight": "model-00008-of-00019.safetensors",
128
+ "model.layers.11.self_attn.k_proj.weight": "model-00007-of-00019.safetensors",
129
+ "model.layers.11.self_attn.o_proj.weight": "model-00007-of-00019.safetensors",
130
+ "model.layers.11.self_attn.q_proj.weight": "model-00007-of-00019.safetensors",
131
+ "model.layers.11.self_attn.v_proj.weight": "model-00007-of-00019.safetensors",
132
+ "model.layers.12.input_layernorm.weight": "model-00008-of-00019.safetensors",
133
+ "model.layers.12.mlp.experts.0.down_proj.weight": "model-00008-of-00019.safetensors",
134
+ "model.layers.12.mlp.experts.0.gate_proj.weight": "model-00008-of-00019.safetensors",
135
+ "model.layers.12.mlp.experts.0.up_proj.weight": "model-00008-of-00019.safetensors",
136
+ "model.layers.12.mlp.experts.1.down_proj.weight": "model-00008-of-00019.safetensors",
137
+ "model.layers.12.mlp.experts.1.gate_proj.weight": "model-00008-of-00019.safetensors",
138
+ "model.layers.12.mlp.experts.1.up_proj.weight": "model-00008-of-00019.safetensors",
139
+ "model.layers.12.mlp.experts.2.down_proj.weight": "model-00008-of-00019.safetensors",
140
+ "model.layers.12.mlp.experts.2.gate_proj.weight": "model-00008-of-00019.safetensors",
141
+ "model.layers.12.mlp.experts.2.up_proj.weight": "model-00008-of-00019.safetensors",
142
+ "model.layers.12.mlp.experts.3.down_proj.weight": "model-00008-of-00019.safetensors",
143
+ "model.layers.12.mlp.experts.3.gate_proj.weight": "model-00008-of-00019.safetensors",
144
+ "model.layers.12.mlp.experts.3.up_proj.weight": "model-00008-of-00019.safetensors",
145
+ "model.layers.12.mlp.experts.4.down_proj.weight": "model-00008-of-00019.safetensors",
146
+ "model.layers.12.mlp.experts.4.gate_proj.weight": "model-00008-of-00019.safetensors",
147
+ "model.layers.12.mlp.experts.4.up_proj.weight": "model-00008-of-00019.safetensors",
148
+ "model.layers.12.mlp.experts.5.down_proj.weight": "model-00008-of-00019.safetensors",
149
+ "model.layers.12.mlp.experts.5.gate_proj.weight": "model-00008-of-00019.safetensors",
150
+ "model.layers.12.mlp.experts.5.up_proj.weight": "model-00008-of-00019.safetensors",
151
+ "model.layers.12.mlp.experts.6.down_proj.weight": "model-00008-of-00019.safetensors",
152
+ "model.layers.12.mlp.experts.6.gate_proj.weight": "model-00008-of-00019.safetensors",
153
+ "model.layers.12.mlp.experts.6.up_proj.weight": "model-00008-of-00019.safetensors",
154
+ "model.layers.12.mlp.experts.7.down_proj.weight": "model-00008-of-00019.safetensors",
155
+ "model.layers.12.mlp.experts.7.gate_proj.weight": "model-00008-of-00019.safetensors",
156
+ "model.layers.12.mlp.experts.7.up_proj.weight": "model-00008-of-00019.safetensors",
157
+ "model.layers.12.mlp.gate.weight": "model-00008-of-00019.safetensors",
158
+ "model.layers.12.post_attention_layernorm.weight": "model-00008-of-00019.safetensors",
159
+ "model.layers.12.self_attn.k_proj.weight": "model-00008-of-00019.safetensors",
160
+ "model.layers.12.self_attn.o_proj.weight": "model-00008-of-00019.safetensors",
161
+ "model.layers.12.self_attn.q_proj.weight": "model-00008-of-00019.safetensors",
162
+ "model.layers.12.self_attn.v_proj.weight": "model-00008-of-00019.safetensors",
163
+ "model.layers.13.input_layernorm.weight": "model-00009-of-00019.safetensors",
164
+ "model.layers.13.mlp.experts.0.down_proj.weight": "model-00008-of-00019.safetensors",
165
+ "model.layers.13.mlp.experts.0.gate_proj.weight": "model-00008-of-00019.safetensors",
166
+ "model.layers.13.mlp.experts.0.up_proj.weight": "model-00008-of-00019.safetensors",
167
+ "model.layers.13.mlp.experts.1.down_proj.weight": "model-00008-of-00019.safetensors",
168
+ "model.layers.13.mlp.experts.1.gate_proj.weight": "model-00008-of-00019.safetensors",
169
+ "model.layers.13.mlp.experts.1.up_proj.weight": "model-00008-of-00019.safetensors",
170
+ "model.layers.13.mlp.experts.2.down_proj.weight": "model-00008-of-00019.safetensors",
171
+ "model.layers.13.mlp.experts.2.gate_proj.weight": "model-00008-of-00019.safetensors",
172
+ "model.layers.13.mlp.experts.2.up_proj.weight": "model-00008-of-00019.safetensors",
173
+ "model.layers.13.mlp.experts.3.down_proj.weight": "model-00008-of-00019.safetensors",
174
+ "model.layers.13.mlp.experts.3.gate_proj.weight": "model-00008-of-00019.safetensors",
175
+ "model.layers.13.mlp.experts.3.up_proj.weight": "model-00008-of-00019.safetensors",
176
+ "model.layers.13.mlp.experts.4.down_proj.weight": "model-00009-of-00019.safetensors",
177
+ "model.layers.13.mlp.experts.4.gate_proj.weight": "model-00008-of-00019.safetensors",
178
+ "model.layers.13.mlp.experts.4.up_proj.weight": "model-00009-of-00019.safetensors",
179
+ "model.layers.13.mlp.experts.5.down_proj.weight": "model-00009-of-00019.safetensors",
180
+ "model.layers.13.mlp.experts.5.gate_proj.weight": "model-00009-of-00019.safetensors",
181
+ "model.layers.13.mlp.experts.5.up_proj.weight": "model-00009-of-00019.safetensors",
182
+ "model.layers.13.mlp.experts.6.down_proj.weight": "model-00009-of-00019.safetensors",
183
+ "model.layers.13.mlp.experts.6.gate_proj.weight": "model-00009-of-00019.safetensors",
184
+ "model.layers.13.mlp.experts.6.up_proj.weight": "model-00009-of-00019.safetensors",
185
+ "model.layers.13.mlp.experts.7.down_proj.weight": "model-00009-of-00019.safetensors",
186
+ "model.layers.13.mlp.experts.7.gate_proj.weight": "model-00009-of-00019.safetensors",
187
+ "model.layers.13.mlp.experts.7.up_proj.weight": "model-00009-of-00019.safetensors",
188
+ "model.layers.13.mlp.gate.weight": "model-00009-of-00019.safetensors",
189
+ "model.layers.13.post_attention_layernorm.weight": "model-00009-of-00019.safetensors",
190
+ "model.layers.13.self_attn.k_proj.weight": "model-00008-of-00019.safetensors",
191
+ "model.layers.13.self_attn.o_proj.weight": "model-00008-of-00019.safetensors",
192
+ "model.layers.13.self_attn.q_proj.weight": "model-00008-of-00019.safetensors",
193
+ "model.layers.13.self_attn.v_proj.weight": "model-00008-of-00019.safetensors",
194
+ "model.layers.14.input_layernorm.weight": "model-00009-of-00019.safetensors",
195
+ "model.layers.14.mlp.experts.0.down_proj.weight": "model-00009-of-00019.safetensors",
196
+ "model.layers.14.mlp.experts.0.gate_proj.weight": "model-00009-of-00019.safetensors",
197
+ "model.layers.14.mlp.experts.0.up_proj.weight": "model-00009-of-00019.safetensors",
198
+ "model.layers.14.mlp.experts.1.down_proj.weight": "model-00009-of-00019.safetensors",
199
+ "model.layers.14.mlp.experts.1.gate_proj.weight": "model-00009-of-00019.safetensors",
200
+ "model.layers.14.mlp.experts.1.up_proj.weight": "model-00009-of-00019.safetensors",
201
+ "model.layers.14.mlp.experts.2.down_proj.weight": "model-00009-of-00019.safetensors",
202
+ "model.layers.14.mlp.experts.2.gate_proj.weight": "model-00009-of-00019.safetensors",
203
+ "model.layers.14.mlp.experts.2.up_proj.weight": "model-00009-of-00019.safetensors",
204
+ "model.layers.14.mlp.experts.3.down_proj.weight": "model-00009-of-00019.safetensors",
205
+ "model.layers.14.mlp.experts.3.gate_proj.weight": "model-00009-of-00019.safetensors",
206
+ "model.layers.14.mlp.experts.3.up_proj.weight": "model-00009-of-00019.safetensors",
207
+ "model.layers.14.mlp.experts.4.down_proj.weight": "model-00009-of-00019.safetensors",
208
+ "model.layers.14.mlp.experts.4.gate_proj.weight": "model-00009-of-00019.safetensors",
209
+ "model.layers.14.mlp.experts.4.up_proj.weight": "model-00009-of-00019.safetensors",
210
+ "model.layers.14.mlp.experts.5.down_proj.weight": "model-00009-of-00019.safetensors",
211
+ "model.layers.14.mlp.experts.5.gate_proj.weight": "model-00009-of-00019.safetensors",
212
+ "model.layers.14.mlp.experts.5.up_proj.weight": "model-00009-of-00019.safetensors",
213
+ "model.layers.14.mlp.experts.6.down_proj.weight": "model-00009-of-00019.safetensors",
214
+ "model.layers.14.mlp.experts.6.gate_proj.weight": "model-00009-of-00019.safetensors",
215
+ "model.layers.14.mlp.experts.6.up_proj.weight": "model-00009-of-00019.safetensors",
216
+ "model.layers.14.mlp.experts.7.down_proj.weight": "model-00009-of-00019.safetensors",
217
+ "model.layers.14.mlp.experts.7.gate_proj.weight": "model-00009-of-00019.safetensors",
218
+ "model.layers.14.mlp.experts.7.up_proj.weight": "model-00009-of-00019.safetensors",
219
+ "model.layers.14.mlp.gate.weight": "model-00009-of-00019.safetensors",
220
+ "model.layers.14.post_attention_layernorm.weight": "model-00009-of-00019.safetensors",
221
+ "model.layers.14.self_attn.k_proj.weight": "model-00009-of-00019.safetensors",
222
+ "model.layers.14.self_attn.o_proj.weight": "model-00009-of-00019.safetensors",
223
+ "model.layers.14.self_attn.q_proj.weight": "model-00009-of-00019.safetensors",
224
+ "model.layers.14.self_attn.v_proj.weight": "model-00009-of-00019.safetensors",
225
+ "model.layers.15.input_layernorm.weight": "model-00010-of-00019.safetensors",
226
+ "model.layers.15.mlp.experts.0.down_proj.weight": "model-00009-of-00019.safetensors",
227
+ "model.layers.15.mlp.experts.0.gate_proj.weight": "model-00009-of-00019.safetensors",
228
+ "model.layers.15.mlp.experts.0.up_proj.weight": "model-00009-of-00019.safetensors",
229
+ "model.layers.15.mlp.experts.1.down_proj.weight": "model-00009-of-00019.safetensors",
230
+ "model.layers.15.mlp.experts.1.gate_proj.weight": "model-00009-of-00019.safetensors",
231
+ "model.layers.15.mlp.experts.1.up_proj.weight": "model-00009-of-00019.safetensors",
232
+ "model.layers.15.mlp.experts.2.down_proj.weight": "model-00010-of-00019.safetensors",
233
+ "model.layers.15.mlp.experts.2.gate_proj.weight": "model-00010-of-00019.safetensors",
234
+ "model.layers.15.mlp.experts.2.up_proj.weight": "model-00010-of-00019.safetensors",
235
+ "model.layers.15.mlp.experts.3.down_proj.weight": "model-00010-of-00019.safetensors",
236
+ "model.layers.15.mlp.experts.3.gate_proj.weight": "model-00010-of-00019.safetensors",
237
+ "model.layers.15.mlp.experts.3.up_proj.weight": "model-00010-of-00019.safetensors",
238
+ "model.layers.15.mlp.experts.4.down_proj.weight": "model-00010-of-00019.safetensors",
239
+ "model.layers.15.mlp.experts.4.gate_proj.weight": "model-00010-of-00019.safetensors",
240
+ "model.layers.15.mlp.experts.4.up_proj.weight": "model-00010-of-00019.safetensors",
241
+ "model.layers.15.mlp.experts.5.down_proj.weight": "model-00010-of-00019.safetensors",
242
+ "model.layers.15.mlp.experts.5.gate_proj.weight": "model-00010-of-00019.safetensors",
243
+ "model.layers.15.mlp.experts.5.up_proj.weight": "model-00010-of-00019.safetensors",
244
+ "model.layers.15.mlp.experts.6.down_proj.weight": "model-00010-of-00019.safetensors",
245
+ "model.layers.15.mlp.experts.6.gate_proj.weight": "model-00010-of-00019.safetensors",
246
+ "model.layers.15.mlp.experts.6.up_proj.weight": "model-00010-of-00019.safetensors",
247
+ "model.layers.15.mlp.experts.7.down_proj.weight": "model-00010-of-00019.safetensors",
248
+ "model.layers.15.mlp.experts.7.gate_proj.weight": "model-00010-of-00019.safetensors",
249
+ "model.layers.15.mlp.experts.7.up_proj.weight": "model-00010-of-00019.safetensors",
250
+ "model.layers.15.mlp.gate.weight": "model-00010-of-00019.safetensors",
251
+ "model.layers.15.post_attention_layernorm.weight": "model-00010-of-00019.safetensors",
252
+ "model.layers.15.self_attn.k_proj.weight": "model-00009-of-00019.safetensors",
253
+ "model.layers.15.self_attn.o_proj.weight": "model-00009-of-00019.safetensors",
254
+ "model.layers.15.self_attn.q_proj.weight": "model-00009-of-00019.safetensors",
255
+ "model.layers.15.self_attn.v_proj.weight": "model-00009-of-00019.safetensors",
256
+ "model.layers.16.input_layernorm.weight": "model-00011-of-00019.safetensors",
257
+ "model.layers.16.mlp.experts.0.down_proj.weight": "model-00010-of-00019.safetensors",
258
+ "model.layers.16.mlp.experts.0.gate_proj.weight": "model-00010-of-00019.safetensors",
259
+ "model.layers.16.mlp.experts.0.up_proj.weight": "model-00010-of-00019.safetensors",
260
+ "model.layers.16.mlp.experts.1.down_proj.weight": "model-00010-of-00019.safetensors",
261
+ "model.layers.16.mlp.experts.1.gate_proj.weight": "model-00010-of-00019.safetensors",
262
+ "model.layers.16.mlp.experts.1.up_proj.weight": "model-00010-of-00019.safetensors",
263
+ "model.layers.16.mlp.experts.2.down_proj.weight": "model-00010-of-00019.safetensors",
264
+ "model.layers.16.mlp.experts.2.gate_proj.weight": "model-00010-of-00019.safetensors",
265
+ "model.layers.16.mlp.experts.2.up_proj.weight": "model-00010-of-00019.safetensors",
266
+ "model.layers.16.mlp.experts.3.down_proj.weight": "model-00010-of-00019.safetensors",
267
+ "model.layers.16.mlp.experts.3.gate_proj.weight": "model-00010-of-00019.safetensors",
268
+ "model.layers.16.mlp.experts.3.up_proj.weight": "model-00010-of-00019.safetensors",
269
+ "model.layers.16.mlp.experts.4.down_proj.weight": "model-00010-of-00019.safetensors",
270
+ "model.layers.16.mlp.experts.4.gate_proj.weight": "model-00010-of-00019.safetensors",
271
+ "model.layers.16.mlp.experts.4.up_proj.weight": "model-00010-of-00019.safetensors",
272
+ "model.layers.16.mlp.experts.5.down_proj.weight": "model-00010-of-00019.safetensors",
273
+ "model.layers.16.mlp.experts.5.gate_proj.weight": "model-00010-of-00019.safetensors",
274
+ "model.layers.16.mlp.experts.5.up_proj.weight": "model-00010-of-00019.safetensors",
275
+ "model.layers.16.mlp.experts.6.down_proj.weight": "model-00010-of-00019.safetensors",
276
+ "model.layers.16.mlp.experts.6.gate_proj.weight": "model-00010-of-00019.safetensors",
277
+ "model.layers.16.mlp.experts.6.up_proj.weight": "model-00010-of-00019.safetensors",
278
+ "model.layers.16.mlp.experts.7.down_proj.weight": "model-00011-of-00019.safetensors",
279
+ "model.layers.16.mlp.experts.7.gate_proj.weight": "model-00010-of-00019.safetensors",
280
+ "model.layers.16.mlp.experts.7.up_proj.weight": "model-00010-of-00019.safetensors",
281
+ "model.layers.16.mlp.gate.weight": "model-00011-of-00019.safetensors",
282
+ "model.layers.16.post_attention_layernorm.weight": "model-00011-of-00019.safetensors",
283
+ "model.layers.16.self_attn.k_proj.weight": "model-00010-of-00019.safetensors",
284
+ "model.layers.16.self_attn.o_proj.weight": "model-00010-of-00019.safetensors",
285
+ "model.layers.16.self_attn.q_proj.weight": "model-00010-of-00019.safetensors",
286
+ "model.layers.16.self_attn.v_proj.weight": "model-00010-of-00019.safetensors",
287
+ "model.layers.17.input_layernorm.weight": "model-00011-of-00019.safetensors",
288
+ "model.layers.17.mlp.experts.0.down_proj.weight": "model-00011-of-00019.safetensors",
289
+ "model.layers.17.mlp.experts.0.gate_proj.weight": "model-00011-of-00019.safetensors",
290
+ "model.layers.17.mlp.experts.0.up_proj.weight": "model-00011-of-00019.safetensors",
291
+ "model.layers.17.mlp.experts.1.down_proj.weight": "model-00011-of-00019.safetensors",
292
+ "model.layers.17.mlp.experts.1.gate_proj.weight": "model-00011-of-00019.safetensors",
293
+ "model.layers.17.mlp.experts.1.up_proj.weight": "model-00011-of-00019.safetensors",
294
+ "model.layers.17.mlp.experts.2.down_proj.weight": "model-00011-of-00019.safetensors",
295
+ "model.layers.17.mlp.experts.2.gate_proj.weight": "model-00011-of-00019.safetensors",
296
+ "model.layers.17.mlp.experts.2.up_proj.weight": "model-00011-of-00019.safetensors",
297
+ "model.layers.17.mlp.experts.3.down_proj.weight": "model-00011-of-00019.safetensors",
298
+ "model.layers.17.mlp.experts.3.gate_proj.weight": "model-00011-of-00019.safetensors",
299
+ "model.layers.17.mlp.experts.3.up_proj.weight": "model-00011-of-00019.safetensors",
300
+ "model.layers.17.mlp.experts.4.down_proj.weight": "model-00011-of-00019.safetensors",
301
+ "model.layers.17.mlp.experts.4.gate_proj.weight": "model-00011-of-00019.safetensors",
302
+ "model.layers.17.mlp.experts.4.up_proj.weight": "model-00011-of-00019.safetensors",
303
+ "model.layers.17.mlp.experts.5.down_proj.weight": "model-00011-of-00019.safetensors",
304
+ "model.layers.17.mlp.experts.5.gate_proj.weight": "model-00011-of-00019.safetensors",
305
+ "model.layers.17.mlp.experts.5.up_proj.weight": "model-00011-of-00019.safetensors",
306
+ "model.layers.17.mlp.experts.6.down_proj.weight": "model-00011-of-00019.safetensors",
307
+ "model.layers.17.mlp.experts.6.gate_proj.weight": "model-00011-of-00019.safetensors",
308
+ "model.layers.17.mlp.experts.6.up_proj.weight": "model-00011-of-00019.safetensors",
309
+ "model.layers.17.mlp.experts.7.down_proj.weight": "model-00011-of-00019.safetensors",
310
+ "model.layers.17.mlp.experts.7.gate_proj.weight": "model-00011-of-00019.safetensors",
311
+ "model.layers.17.mlp.experts.7.up_proj.weight": "model-00011-of-00019.safetensors",
312
+ "model.layers.17.mlp.gate.weight": "model-00011-of-00019.safetensors",
313
+ "model.layers.17.post_attention_layernorm.weight": "model-00011-of-00019.safetensors",
314
+ "model.layers.17.self_attn.k_proj.weight": "model-00011-of-00019.safetensors",
315
+ "model.layers.17.self_attn.o_proj.weight": "model-00011-of-00019.safetensors",
316
+ "model.layers.17.self_attn.q_proj.weight": "model-00011-of-00019.safetensors",
317
+ "model.layers.17.self_attn.v_proj.weight": "model-00011-of-00019.safetensors",
318
+ "model.layers.18.input_layernorm.weight": "model-00012-of-00019.safetensors",
319
+ "model.layers.18.mlp.experts.0.down_proj.weight": "model-00011-of-00019.safetensors",
320
+ "model.layers.18.mlp.experts.0.gate_proj.weight": "model-00011-of-00019.safetensors",
321
+ "model.layers.18.mlp.experts.0.up_proj.weight": "model-00011-of-00019.safetensors",
322
+ "model.layers.18.mlp.experts.1.down_proj.weight": "model-00011-of-00019.safetensors",
323
+ "model.layers.18.mlp.experts.1.gate_proj.weight": "model-00011-of-00019.safetensors",
324
+ "model.layers.18.mlp.experts.1.up_proj.weight": "model-00011-of-00019.safetensors",
325
+ "model.layers.18.mlp.experts.2.down_proj.weight": "model-00011-of-00019.safetensors",
326
+ "model.layers.18.mlp.experts.2.gate_proj.weight": "model-00011-of-00019.safetensors",
327
+ "model.layers.18.mlp.experts.2.up_proj.weight": "model-00011-of-00019.safetensors",
328
+ "model.layers.18.mlp.experts.3.down_proj.weight": "model-00011-of-00019.safetensors",
329
+ "model.layers.18.mlp.experts.3.gate_proj.weight": "model-00011-of-00019.safetensors",
330
+ "model.layers.18.mlp.experts.3.up_proj.weight": "model-00011-of-00019.safetensors",
331
+ "model.layers.18.mlp.experts.4.down_proj.weight": "model-00011-of-00019.safetensors",
332
+ "model.layers.18.mlp.experts.4.gate_proj.weight": "model-00011-of-00019.safetensors",
333
+ "model.layers.18.mlp.experts.4.up_proj.weight": "model-00011-of-00019.safetensors",
334
+ "model.layers.18.mlp.experts.5.down_proj.weight": "model-00012-of-00019.safetensors",
335
+ "model.layers.18.mlp.experts.5.gate_proj.weight": "model-00011-of-00019.safetensors",
336
+ "model.layers.18.mlp.experts.5.up_proj.weight": "model-00012-of-00019.safetensors",
337
+ "model.layers.18.mlp.experts.6.down_proj.weight": "model-00012-of-00019.safetensors",
338
+ "model.layers.18.mlp.experts.6.gate_proj.weight": "model-00012-of-00019.safetensors",
339
+ "model.layers.18.mlp.experts.6.up_proj.weight": "model-00012-of-00019.safetensors",
340
+ "model.layers.18.mlp.experts.7.down_proj.weight": "model-00012-of-00019.safetensors",
341
+ "model.layers.18.mlp.experts.7.gate_proj.weight": "model-00012-of-00019.safetensors",
342
+ "model.layers.18.mlp.experts.7.up_proj.weight": "model-00012-of-00019.safetensors",
343
+ "model.layers.18.mlp.gate.weight": "model-00012-of-00019.safetensors",
344
+ "model.layers.18.post_attention_layernorm.weight": "model-00012-of-00019.safetensors",
345
+ "model.layers.18.self_attn.k_proj.weight": "model-00011-of-00019.safetensors",
346
+ "model.layers.18.self_attn.o_proj.weight": "model-00011-of-00019.safetensors",
347
+ "model.layers.18.self_attn.q_proj.weight": "model-00011-of-00019.safetensors",
348
+ "model.layers.18.self_attn.v_proj.weight": "model-00011-of-00019.safetensors",
349
+ "model.layers.19.input_layernorm.weight": "model-00012-of-00019.safetensors",
350
+ "model.layers.19.mlp.experts.0.down_proj.weight": "model-00012-of-00019.safetensors",
351
+ "model.layers.19.mlp.experts.0.gate_proj.weight": "model-00012-of-00019.safetensors",
352
+ "model.layers.19.mlp.experts.0.up_proj.weight": "model-00012-of-00019.safetensors",
353
+ "model.layers.19.mlp.experts.1.down_proj.weight": "model-00012-of-00019.safetensors",
354
+ "model.layers.19.mlp.experts.1.gate_proj.weight": "model-00012-of-00019.safetensors",
355
+ "model.layers.19.mlp.experts.1.up_proj.weight": "model-00012-of-00019.safetensors",
356
+ "model.layers.19.mlp.experts.2.down_proj.weight": "model-00012-of-00019.safetensors",
357
+ "model.layers.19.mlp.experts.2.gate_proj.weight": "model-00012-of-00019.safetensors",
358
+ "model.layers.19.mlp.experts.2.up_proj.weight": "model-00012-of-00019.safetensors",
359
+ "model.layers.19.mlp.experts.3.down_proj.weight": "model-00012-of-00019.safetensors",
360
+ "model.layers.19.mlp.experts.3.gate_proj.weight": "model-00012-of-00019.safetensors",
361
+ "model.layers.19.mlp.experts.3.up_proj.weight": "model-00012-of-00019.safetensors",
362
+ "model.layers.19.mlp.experts.4.down_proj.weight": "model-00012-of-00019.safetensors",
363
+ "model.layers.19.mlp.experts.4.gate_proj.weight": "model-00012-of-00019.safetensors",
364
+ "model.layers.19.mlp.experts.4.up_proj.weight": "model-00012-of-00019.safetensors",
365
+ "model.layers.19.mlp.experts.5.down_proj.weight": "model-00012-of-00019.safetensors",
366
+ "model.layers.19.mlp.experts.5.gate_proj.weight": "model-00012-of-00019.safetensors",
367
+ "model.layers.19.mlp.experts.5.up_proj.weight": "model-00012-of-00019.safetensors",
368
+ "model.layers.19.mlp.experts.6.down_proj.weight": "model-00012-of-00019.safetensors",
369
+ "model.layers.19.mlp.experts.6.gate_proj.weight": "model-00012-of-00019.safetensors",
370
+ "model.layers.19.mlp.experts.6.up_proj.weight": "model-00012-of-00019.safetensors",
371
+ "model.layers.19.mlp.experts.7.down_proj.weight": "model-00012-of-00019.safetensors",
372
+ "model.layers.19.mlp.experts.7.gate_proj.weight": "model-00012-of-00019.safetensors",
373
+ "model.layers.19.mlp.experts.7.up_proj.weight": "model-00012-of-00019.safetensors",
374
+ "model.layers.19.mlp.gate.weight": "model-00012-of-00019.safetensors",
375
+ "model.layers.19.post_attention_layernorm.weight": "model-00012-of-00019.safetensors",
376
+ "model.layers.19.self_attn.k_proj.weight": "model-00012-of-00019.safetensors",
377
+ "model.layers.19.self_attn.o_proj.weight": "model-00012-of-00019.safetensors",
378
+ "model.layers.19.self_attn.q_proj.weight": "model-00012-of-00019.safetensors",
379
+ "model.layers.19.self_attn.v_proj.weight": "model-00012-of-00019.safetensors",
380
+ "model.layers.2.input_layernorm.weight": "model-00002-of-00019.safetensors",
381
+ "model.layers.2.mlp.experts.0.down_proj.weight": "model-00002-of-00019.safetensors",
382
+ "model.layers.2.mlp.experts.0.gate_proj.weight": "model-00002-of-00019.safetensors",
383
+ "model.layers.2.mlp.experts.0.up_proj.weight": "model-00002-of-00019.safetensors",
384
+ "model.layers.2.mlp.experts.1.down_proj.weight": "model-00002-of-00019.safetensors",
385
+ "model.layers.2.mlp.experts.1.gate_proj.weight": "model-00002-of-00019.safetensors",
386
+ "model.layers.2.mlp.experts.1.up_proj.weight": "model-00002-of-00019.safetensors",
387
+ "model.layers.2.mlp.experts.2.down_proj.weight": "model-00002-of-00019.safetensors",
388
+ "model.layers.2.mlp.experts.2.gate_proj.weight": "model-00002-of-00019.safetensors",
389
+ "model.layers.2.mlp.experts.2.up_proj.weight": "model-00002-of-00019.safetensors",
390
+ "model.layers.2.mlp.experts.3.down_proj.weight": "model-00002-of-00019.safetensors",
391
+ "model.layers.2.mlp.experts.3.gate_proj.weight": "model-00002-of-00019.safetensors",
392
+ "model.layers.2.mlp.experts.3.up_proj.weight": "model-00002-of-00019.safetensors",
393
+ "model.layers.2.mlp.experts.4.down_proj.weight": "model-00002-of-00019.safetensors",
394
+ "model.layers.2.mlp.experts.4.gate_proj.weight": "model-00002-of-00019.safetensors",
395
+ "model.layers.2.mlp.experts.4.up_proj.weight": "model-00002-of-00019.safetensors",
396
+ "model.layers.2.mlp.experts.5.down_proj.weight": "model-00002-of-00019.safetensors",
397
+ "model.layers.2.mlp.experts.5.gate_proj.weight": "model-00002-of-00019.safetensors",
398
+ "model.layers.2.mlp.experts.5.up_proj.weight": "model-00002-of-00019.safetensors",
399
+ "model.layers.2.mlp.experts.6.down_proj.weight": "model-00002-of-00019.safetensors",
400
+ "model.layers.2.mlp.experts.6.gate_proj.weight": "model-00002-of-00019.safetensors",
401
+ "model.layers.2.mlp.experts.6.up_proj.weight": "model-00002-of-00019.safetensors",
402
+ "model.layers.2.mlp.experts.7.down_proj.weight": "model-00002-of-00019.safetensors",
403
+ "model.layers.2.mlp.experts.7.gate_proj.weight": "model-00002-of-00019.safetensors",
404
+ "model.layers.2.mlp.experts.7.up_proj.weight": "model-00002-of-00019.safetensors",
405
+ "model.layers.2.mlp.gate.weight": "model-00002-of-00019.safetensors",
406
+ "model.layers.2.post_attention_layernorm.weight": "model-00002-of-00019.safetensors",
407
+ "model.layers.2.self_attn.k_proj.weight": "model-00002-of-00019.safetensors",
408
+ "model.layers.2.self_attn.o_proj.weight": "model-00002-of-00019.safetensors",
409
+ "model.layers.2.self_attn.q_proj.weight": "model-00002-of-00019.safetensors",
410
+ "model.layers.2.self_attn.v_proj.weight": "model-00002-of-00019.safetensors",
411
+ "model.layers.20.input_layernorm.weight": "model-00013-of-00019.safetensors",
412
+ "model.layers.20.mlp.experts.0.down_proj.weight": "model-00012-of-00019.safetensors",
413
+ "model.layers.20.mlp.experts.0.gate_proj.weight": "model-00012-of-00019.safetensors",
414
+ "model.layers.20.mlp.experts.0.up_proj.weight": "model-00012-of-00019.safetensors",
415
+ "model.layers.20.mlp.experts.1.down_proj.weight": "model-00012-of-00019.safetensors",
416
+ "model.layers.20.mlp.experts.1.gate_proj.weight": "model-00012-of-00019.safetensors",
417
+ "model.layers.20.mlp.experts.1.up_proj.weight": "model-00012-of-00019.safetensors",
418
+ "model.layers.20.mlp.experts.2.down_proj.weight": "model-00012-of-00019.safetensors",
419
+ "model.layers.20.mlp.experts.2.gate_proj.weight": "model-00012-of-00019.safetensors",
420
+ "model.layers.20.mlp.experts.2.up_proj.weight": "model-00012-of-00019.safetensors",
421
+ "model.layers.20.mlp.experts.3.down_proj.weight": "model-00013-of-00019.safetensors",
422
+ "model.layers.20.mlp.experts.3.gate_proj.weight": "model-00013-of-00019.safetensors",
423
+ "model.layers.20.mlp.experts.3.up_proj.weight": "model-00013-of-00019.safetensors",
424
+ "model.layers.20.mlp.experts.4.down_proj.weight": "model-00013-of-00019.safetensors",
425
+ "model.layers.20.mlp.experts.4.gate_proj.weight": "model-00013-of-00019.safetensors",
426
+ "model.layers.20.mlp.experts.4.up_proj.weight": "model-00013-of-00019.safetensors",
427
+ "model.layers.20.mlp.experts.5.down_proj.weight": "model-00013-of-00019.safetensors",
428
+ "model.layers.20.mlp.experts.5.gate_proj.weight": "model-00013-of-00019.safetensors",
429
+ "model.layers.20.mlp.experts.5.up_proj.weight": "model-00013-of-00019.safetensors",
430
+ "model.layers.20.mlp.experts.6.down_proj.weight": "model-00013-of-00019.safetensors",
431
+ "model.layers.20.mlp.experts.6.gate_proj.weight": "model-00013-of-00019.safetensors",
432
+ "model.layers.20.mlp.experts.6.up_proj.weight": "model-00013-of-00019.safetensors",
433
+ "model.layers.20.mlp.experts.7.down_proj.weight": "model-00013-of-00019.safetensors",
434
+ "model.layers.20.mlp.experts.7.gate_proj.weight": "model-00013-of-00019.safetensors",
435
+ "model.layers.20.mlp.experts.7.up_proj.weight": "model-00013-of-00019.safetensors",
436
+ "model.layers.20.mlp.gate.weight": "model-00013-of-00019.safetensors",
437
+ "model.layers.20.post_attention_layernorm.weight": "model-00013-of-00019.safetensors",
438
+ "model.layers.20.self_attn.k_proj.weight": "model-00012-of-00019.safetensors",
439
+ "model.layers.20.self_attn.o_proj.weight": "model-00012-of-00019.safetensors",
440
+ "model.layers.20.self_attn.q_proj.weight": "model-00012-of-00019.safetensors",
441
+ "model.layers.20.self_attn.v_proj.weight": "model-00012-of-00019.safetensors",
442
+ "model.layers.21.input_layernorm.weight": "model-00013-of-00019.safetensors",
443
+ "model.layers.21.mlp.experts.0.down_proj.weight": "model-00013-of-00019.safetensors",
444
+ "model.layers.21.mlp.experts.0.gate_proj.weight": "model-00013-of-00019.safetensors",
445
+ "model.layers.21.mlp.experts.0.up_proj.weight": "model-00013-of-00019.safetensors",
446
+ "model.layers.21.mlp.experts.1.down_proj.weight": "model-00013-of-00019.safetensors",
447
+ "model.layers.21.mlp.experts.1.gate_proj.weight": "model-00013-of-00019.safetensors",
448
+ "model.layers.21.mlp.experts.1.up_proj.weight": "model-00013-of-00019.safetensors",
449
+ "model.layers.21.mlp.experts.2.down_proj.weight": "model-00013-of-00019.safetensors",
450
+ "model.layers.21.mlp.experts.2.gate_proj.weight": "model-00013-of-00019.safetensors",
451
+ "model.layers.21.mlp.experts.2.up_proj.weight": "model-00013-of-00019.safetensors",
452
+ "model.layers.21.mlp.experts.3.down_proj.weight": "model-00013-of-00019.safetensors",
453
+ "model.layers.21.mlp.experts.3.gate_proj.weight": "model-00013-of-00019.safetensors",
454
+ "model.layers.21.mlp.experts.3.up_proj.weight": "model-00013-of-00019.safetensors",
455
+ "model.layers.21.mlp.experts.4.down_proj.weight": "model-00013-of-00019.safetensors",
456
+ "model.layers.21.mlp.experts.4.gate_proj.weight": "model-00013-of-00019.safetensors",
457
+ "model.layers.21.mlp.experts.4.up_proj.weight": "model-00013-of-00019.safetensors",
458
+ "model.layers.21.mlp.experts.5.down_proj.weight": "model-00013-of-00019.safetensors",
459
+ "model.layers.21.mlp.experts.5.gate_proj.weight": "model-00013-of-00019.safetensors",
460
+ "model.layers.21.mlp.experts.5.up_proj.weight": "model-00013-of-00019.safetensors",
461
+ "model.layers.21.mlp.experts.6.down_proj.weight": "model-00013-of-00019.safetensors",
462
+ "model.layers.21.mlp.experts.6.gate_proj.weight": "model-00013-of-00019.safetensors",
463
+ "model.layers.21.mlp.experts.6.up_proj.weight": "model-00013-of-00019.safetensors",
464
+ "model.layers.21.mlp.experts.7.down_proj.weight": "model-00013-of-00019.safetensors",
465
+ "model.layers.21.mlp.experts.7.gate_proj.weight": "model-00013-of-00019.safetensors",
466
+ "model.layers.21.mlp.experts.7.up_proj.weight": "model-00013-of-00019.safetensors",
467
+ "model.layers.21.mlp.gate.weight": "model-00013-of-00019.safetensors",
468
+ "model.layers.21.post_attention_layernorm.weight": "model-00013-of-00019.safetensors",
469
+ "model.layers.21.self_attn.k_proj.weight": "model-00013-of-00019.safetensors",
470
+ "model.layers.21.self_attn.o_proj.weight": "model-00013-of-00019.safetensors",
471
+ "model.layers.21.self_attn.q_proj.weight": "model-00013-of-00019.safetensors",
472
+ "model.layers.21.self_attn.v_proj.weight": "model-00013-of-00019.safetensors",
473
+ "model.layers.22.input_layernorm.weight": "model-00014-of-00019.safetensors",
474
+ "model.layers.22.mlp.experts.0.down_proj.weight": "model-00014-of-00019.safetensors",
475
+ "model.layers.22.mlp.experts.0.gate_proj.weight": "model-00013-of-00019.safetensors",
476
+ "model.layers.22.mlp.experts.0.up_proj.weight": "model-00013-of-00019.safetensors",
477
+ "model.layers.22.mlp.experts.1.down_proj.weight": "model-00014-of-00019.safetensors",
478
+ "model.layers.22.mlp.experts.1.gate_proj.weight": "model-00014-of-00019.safetensors",
479
+ "model.layers.22.mlp.experts.1.up_proj.weight": "model-00014-of-00019.safetensors",
480
+ "model.layers.22.mlp.experts.2.down_proj.weight": "model-00014-of-00019.safetensors",
481
+ "model.layers.22.mlp.experts.2.gate_proj.weight": "model-00014-of-00019.safetensors",
482
+ "model.layers.22.mlp.experts.2.up_proj.weight": "model-00014-of-00019.safetensors",
483
+ "model.layers.22.mlp.experts.3.down_proj.weight": "model-00014-of-00019.safetensors",
484
+ "model.layers.22.mlp.experts.3.gate_proj.weight": "model-00014-of-00019.safetensors",
485
+ "model.layers.22.mlp.experts.3.up_proj.weight": "model-00014-of-00019.safetensors",
486
+ "model.layers.22.mlp.experts.4.down_proj.weight": "model-00014-of-00019.safetensors",
487
+ "model.layers.22.mlp.experts.4.gate_proj.weight": "model-00014-of-00019.safetensors",
488
+ "model.layers.22.mlp.experts.4.up_proj.weight": "model-00014-of-00019.safetensors",
489
+ "model.layers.22.mlp.experts.5.down_proj.weight": "model-00014-of-00019.safetensors",
490
+ "model.layers.22.mlp.experts.5.gate_proj.weight": "model-00014-of-00019.safetensors",
491
+ "model.layers.22.mlp.experts.5.up_proj.weight": "model-00014-of-00019.safetensors",
492
+ "model.layers.22.mlp.experts.6.down_proj.weight": "model-00014-of-00019.safetensors",
493
+ "model.layers.22.mlp.experts.6.gate_proj.weight": "model-00014-of-00019.safetensors",
494
+ "model.layers.22.mlp.experts.6.up_proj.weight": "model-00014-of-00019.safetensors",
495
+ "model.layers.22.mlp.experts.7.down_proj.weight": "model-00014-of-00019.safetensors",
496
+ "model.layers.22.mlp.experts.7.gate_proj.weight": "model-00014-of-00019.safetensors",
497
+ "model.layers.22.mlp.experts.7.up_proj.weight": "model-00014-of-00019.safetensors",
498
+ "model.layers.22.mlp.gate.weight": "model-00014-of-00019.safetensors",
499
+ "model.layers.22.post_attention_layernorm.weight": "model-00014-of-00019.safetensors",
500
+ "model.layers.22.self_attn.k_proj.weight": "model-00013-of-00019.safetensors",
501
+ "model.layers.22.self_attn.o_proj.weight": "model-00013-of-00019.safetensors",
502
+ "model.layers.22.self_attn.q_proj.weight": "model-00013-of-00019.safetensors",
503
+ "model.layers.22.self_attn.v_proj.weight": "model-00013-of-00019.safetensors",
504
+ "model.layers.23.input_layernorm.weight": "model-00015-of-00019.safetensors",
505
+ "model.layers.23.mlp.experts.0.down_proj.weight": "model-00014-of-00019.safetensors",
506
+ "model.layers.23.mlp.experts.0.gate_proj.weight": "model-00014-of-00019.safetensors",
507
+ "model.layers.23.mlp.experts.0.up_proj.weight": "model-00014-of-00019.safetensors",
508
+ "model.layers.23.mlp.experts.1.down_proj.weight": "model-00014-of-00019.safetensors",
509
+ "model.layers.23.mlp.experts.1.gate_proj.weight": "model-00014-of-00019.safetensors",
510
+ "model.layers.23.mlp.experts.1.up_proj.weight": "model-00014-of-00019.safetensors",
511
+ "model.layers.23.mlp.experts.2.down_proj.weight": "model-00014-of-00019.safetensors",
512
+ "model.layers.23.mlp.experts.2.gate_proj.weight": "model-00014-of-00019.safetensors",
513
+ "model.layers.23.mlp.experts.2.up_proj.weight": "model-00014-of-00019.safetensors",
514
+ "model.layers.23.mlp.experts.3.down_proj.weight": "model-00014-of-00019.safetensors",
515
+ "model.layers.23.mlp.experts.3.gate_proj.weight": "model-00014-of-00019.safetensors",
516
+ "model.layers.23.mlp.experts.3.up_proj.weight": "model-00014-of-00019.safetensors",
517
+ "model.layers.23.mlp.experts.4.down_proj.weight": "model-00014-of-00019.safetensors",
518
+ "model.layers.23.mlp.experts.4.gate_proj.weight": "model-00014-of-00019.safetensors",
519
+ "model.layers.23.mlp.experts.4.up_proj.weight": "model-00014-of-00019.safetensors",
520
+ "model.layers.23.mlp.experts.5.down_proj.weight": "model-00014-of-00019.safetensors",
521
+ "model.layers.23.mlp.experts.5.gate_proj.weight": "model-00014-of-00019.safetensors",
522
+ "model.layers.23.mlp.experts.5.up_proj.weight": "model-00014-of-00019.safetensors",
523
+ "model.layers.23.mlp.experts.6.down_proj.weight": "model-00015-of-00019.safetensors",
524
+ "model.layers.23.mlp.experts.6.gate_proj.weight": "model-00014-of-00019.safetensors",
525
+ "model.layers.23.mlp.experts.6.up_proj.weight": "model-00015-of-00019.safetensors",
526
+ "model.layers.23.mlp.experts.7.down_proj.weight": "model-00015-of-00019.safetensors",
527
+ "model.layers.23.mlp.experts.7.gate_proj.weight": "model-00015-of-00019.safetensors",
528
+ "model.layers.23.mlp.experts.7.up_proj.weight": "model-00015-of-00019.safetensors",
529
+ "model.layers.23.mlp.gate.weight": "model-00015-of-00019.safetensors",
530
+ "model.layers.23.post_attention_layernorm.weight": "model-00015-of-00019.safetensors",
531
+ "model.layers.23.self_attn.k_proj.weight": "model-00014-of-00019.safetensors",
532
+ "model.layers.23.self_attn.o_proj.weight": "model-00014-of-00019.safetensors",
533
+ "model.layers.23.self_attn.q_proj.weight": "model-00014-of-00019.safetensors",
534
+ "model.layers.23.self_attn.v_proj.weight": "model-00014-of-00019.safetensors",
535
+ "model.layers.24.input_layernorm.weight": "model-00015-of-00019.safetensors",
536
+ "model.layers.24.mlp.experts.0.down_proj.weight": "model-00015-of-00019.safetensors",
537
+ "model.layers.24.mlp.experts.0.gate_proj.weight": "model-00015-of-00019.safetensors",
538
+ "model.layers.24.mlp.experts.0.up_proj.weight": "model-00015-of-00019.safetensors",
539
+ "model.layers.24.mlp.experts.1.down_proj.weight": "model-00015-of-00019.safetensors",
540
+ "model.layers.24.mlp.experts.1.gate_proj.weight": "model-00015-of-00019.safetensors",
541
+ "model.layers.24.mlp.experts.1.up_proj.weight": "model-00015-of-00019.safetensors",
542
+ "model.layers.24.mlp.experts.2.down_proj.weight": "model-00015-of-00019.safetensors",
543
+ "model.layers.24.mlp.experts.2.gate_proj.weight": "model-00015-of-00019.safetensors",
544
+ "model.layers.24.mlp.experts.2.up_proj.weight": "model-00015-of-00019.safetensors",
545
+ "model.layers.24.mlp.experts.3.down_proj.weight": "model-00015-of-00019.safetensors",
546
+ "model.layers.24.mlp.experts.3.gate_proj.weight": "model-00015-of-00019.safetensors",
547
+ "model.layers.24.mlp.experts.3.up_proj.weight": "model-00015-of-00019.safetensors",
548
+ "model.layers.24.mlp.experts.4.down_proj.weight": "model-00015-of-00019.safetensors",
549
+ "model.layers.24.mlp.experts.4.gate_proj.weight": "model-00015-of-00019.safetensors",
550
+ "model.layers.24.mlp.experts.4.up_proj.weight": "model-00015-of-00019.safetensors",
551
+ "model.layers.24.mlp.experts.5.down_proj.weight": "model-00015-of-00019.safetensors",
552
+ "model.layers.24.mlp.experts.5.gate_proj.weight": "model-00015-of-00019.safetensors",
553
+ "model.layers.24.mlp.experts.5.up_proj.weight": "model-00015-of-00019.safetensors",
554
+ "model.layers.24.mlp.experts.6.down_proj.weight": "model-00015-of-00019.safetensors",
555
+ "model.layers.24.mlp.experts.6.gate_proj.weight": "model-00015-of-00019.safetensors",
556
+ "model.layers.24.mlp.experts.6.up_proj.weight": "model-00015-of-00019.safetensors",
557
+ "model.layers.24.mlp.experts.7.down_proj.weight": "model-00015-of-00019.safetensors",
558
+ "model.layers.24.mlp.experts.7.gate_proj.weight": "model-00015-of-00019.safetensors",
559
+ "model.layers.24.mlp.experts.7.up_proj.weight": "model-00015-of-00019.safetensors",
560
+ "model.layers.24.mlp.gate.weight": "model-00015-of-00019.safetensors",
561
+ "model.layers.24.post_attention_layernorm.weight": "model-00015-of-00019.safetensors",
562
+ "model.layers.24.self_attn.k_proj.weight": "model-00015-of-00019.safetensors",
563
+ "model.layers.24.self_attn.o_proj.weight": "model-00015-of-00019.safetensors",
564
+ "model.layers.24.self_attn.q_proj.weight": "model-00015-of-00019.safetensors",
565
+ "model.layers.24.self_attn.v_proj.weight": "model-00015-of-00019.safetensors",
566
+ "model.layers.25.input_layernorm.weight": "model-00016-of-00019.safetensors",
567
+ "model.layers.25.mlp.experts.0.down_proj.weight": "model-00015-of-00019.safetensors",
568
+ "model.layers.25.mlp.experts.0.gate_proj.weight": "model-00015-of-00019.safetensors",
569
+ "model.layers.25.mlp.experts.0.up_proj.weight": "model-00015-of-00019.safetensors",
570
+ "model.layers.25.mlp.experts.1.down_proj.weight": "model-00015-of-00019.safetensors",
571
+ "model.layers.25.mlp.experts.1.gate_proj.weight": "model-00015-of-00019.safetensors",
572
+ "model.layers.25.mlp.experts.1.up_proj.weight": "model-00015-of-00019.safetensors",
573
+ "model.layers.25.mlp.experts.2.down_proj.weight": "model-00015-of-00019.safetensors",
574
+ "model.layers.25.mlp.experts.2.gate_proj.weight": "model-00015-of-00019.safetensors",
575
+ "model.layers.25.mlp.experts.2.up_proj.weight": "model-00015-of-00019.safetensors",
576
+ "model.layers.25.mlp.experts.3.down_proj.weight": "model-00015-of-00019.safetensors",
577
+ "model.layers.25.mlp.experts.3.gate_proj.weight": "model-00015-of-00019.safetensors",
578
+ "model.layers.25.mlp.experts.3.up_proj.weight": "model-00015-of-00019.safetensors",
579
+ "model.layers.25.mlp.experts.4.down_proj.weight": "model-00016-of-00019.safetensors",
580
+ "model.layers.25.mlp.experts.4.gate_proj.weight": "model-00016-of-00019.safetensors",
581
+ "model.layers.25.mlp.experts.4.up_proj.weight": "model-00016-of-00019.safetensors",
582
+ "model.layers.25.mlp.experts.5.down_proj.weight": "model-00016-of-00019.safetensors",
583
+ "model.layers.25.mlp.experts.5.gate_proj.weight": "model-00016-of-00019.safetensors",
584
+ "model.layers.25.mlp.experts.5.up_proj.weight": "model-00016-of-00019.safetensors",
585
+ "model.layers.25.mlp.experts.6.down_proj.weight": "model-00016-of-00019.safetensors",
586
+ "model.layers.25.mlp.experts.6.gate_proj.weight": "model-00016-of-00019.safetensors",
587
+ "model.layers.25.mlp.experts.6.up_proj.weight": "model-00016-of-00019.safetensors",
588
+ "model.layers.25.mlp.experts.7.down_proj.weight": "model-00016-of-00019.safetensors",
589
+ "model.layers.25.mlp.experts.7.gate_proj.weight": "model-00016-of-00019.safetensors",
590
+ "model.layers.25.mlp.experts.7.up_proj.weight": "model-00016-of-00019.safetensors",
591
+ "model.layers.25.mlp.gate.weight": "model-00016-of-00019.safetensors",
592
+ "model.layers.25.post_attention_layernorm.weight": "model-00016-of-00019.safetensors",
593
+ "model.layers.25.self_attn.k_proj.weight": "model-00015-of-00019.safetensors",
594
+ "model.layers.25.self_attn.o_proj.weight": "model-00015-of-00019.safetensors",
595
+ "model.layers.25.self_attn.q_proj.weight": "model-00015-of-00019.safetensors",
596
+ "model.layers.25.self_attn.v_proj.weight": "model-00015-of-00019.safetensors",
597
+ "model.layers.26.input_layernorm.weight": "model-00016-of-00019.safetensors",
598
+ "model.layers.26.mlp.experts.0.down_proj.weight": "model-00016-of-00019.safetensors",
599
+ "model.layers.26.mlp.experts.0.gate_proj.weight": "model-00016-of-00019.safetensors",
600
+ "model.layers.26.mlp.experts.0.up_proj.weight": "model-00016-of-00019.safetensors",
601
+ "model.layers.26.mlp.experts.1.down_proj.weight": "model-00016-of-00019.safetensors",
602
+ "model.layers.26.mlp.experts.1.gate_proj.weight": "model-00016-of-00019.safetensors",
603
+ "model.layers.26.mlp.experts.1.up_proj.weight": "model-00016-of-00019.safetensors",
604
+ "model.layers.26.mlp.experts.2.down_proj.weight": "model-00016-of-00019.safetensors",
605
+ "model.layers.26.mlp.experts.2.gate_proj.weight": "model-00016-of-00019.safetensors",
606
+ "model.layers.26.mlp.experts.2.up_proj.weight": "model-00016-of-00019.safetensors",
607
+ "model.layers.26.mlp.experts.3.down_proj.weight": "model-00016-of-00019.safetensors",
608
+ "model.layers.26.mlp.experts.3.gate_proj.weight": "model-00016-of-00019.safetensors",
609
+ "model.layers.26.mlp.experts.3.up_proj.weight": "model-00016-of-00019.safetensors",
610
+ "model.layers.26.mlp.experts.4.down_proj.weight": "model-00016-of-00019.safetensors",
611
+ "model.layers.26.mlp.experts.4.gate_proj.weight": "model-00016-of-00019.safetensors",
612
+ "model.layers.26.mlp.experts.4.up_proj.weight": "model-00016-of-00019.safetensors",
613
+ "model.layers.26.mlp.experts.5.down_proj.weight": "model-00016-of-00019.safetensors",
614
+ "model.layers.26.mlp.experts.5.gate_proj.weight": "model-00016-of-00019.safetensors",
615
+ "model.layers.26.mlp.experts.5.up_proj.weight": "model-00016-of-00019.safetensors",
616
+ "model.layers.26.mlp.experts.6.down_proj.weight": "model-00016-of-00019.safetensors",
617
+ "model.layers.26.mlp.experts.6.gate_proj.weight": "model-00016-of-00019.safetensors",
618
+ "model.layers.26.mlp.experts.6.up_proj.weight": "model-00016-of-00019.safetensors",
619
+ "model.layers.26.mlp.experts.7.down_proj.weight": "model-00016-of-00019.safetensors",
620
+ "model.layers.26.mlp.experts.7.gate_proj.weight": "model-00016-of-00019.safetensors",
621
+ "model.layers.26.mlp.experts.7.up_proj.weight": "model-00016-of-00019.safetensors",
622
+ "model.layers.26.mlp.gate.weight": "model-00016-of-00019.safetensors",
623
+ "model.layers.26.post_attention_layernorm.weight": "model-00016-of-00019.safetensors",
624
+ "model.layers.26.self_attn.k_proj.weight": "model-00016-of-00019.safetensors",
625
+ "model.layers.26.self_attn.o_proj.weight": "model-00016-of-00019.safetensors",
626
+ "model.layers.26.self_attn.q_proj.weight": "model-00016-of-00019.safetensors",
627
+ "model.layers.26.self_attn.v_proj.weight": "model-00016-of-00019.safetensors",
628
+ "model.layers.27.input_layernorm.weight": "model-00017-of-00019.safetensors",
629
+ "model.layers.27.mlp.experts.0.down_proj.weight": "model-00016-of-00019.safetensors",
630
+ "model.layers.27.mlp.experts.0.gate_proj.weight": "model-00016-of-00019.safetensors",
631
+ "model.layers.27.mlp.experts.0.up_proj.weight": "model-00016-of-00019.safetensors",
632
+ "model.layers.27.mlp.experts.1.down_proj.weight": "model-00017-of-00019.safetensors",
633
+ "model.layers.27.mlp.experts.1.gate_proj.weight": "model-00016-of-00019.safetensors",
634
+ "model.layers.27.mlp.experts.1.up_proj.weight": "model-00016-of-00019.safetensors",
635
+ "model.layers.27.mlp.experts.2.down_proj.weight": "model-00017-of-00019.safetensors",
636
+ "model.layers.27.mlp.experts.2.gate_proj.weight": "model-00017-of-00019.safetensors",
637
+ "model.layers.27.mlp.experts.2.up_proj.weight": "model-00017-of-00019.safetensors",
638
+ "model.layers.27.mlp.experts.3.down_proj.weight": "model-00017-of-00019.safetensors",
639
+ "model.layers.27.mlp.experts.3.gate_proj.weight": "model-00017-of-00019.safetensors",
640
+ "model.layers.27.mlp.experts.3.up_proj.weight": "model-00017-of-00019.safetensors",
641
+ "model.layers.27.mlp.experts.4.down_proj.weight": "model-00017-of-00019.safetensors",
642
+ "model.layers.27.mlp.experts.4.gate_proj.weight": "model-00017-of-00019.safetensors",
643
+ "model.layers.27.mlp.experts.4.up_proj.weight": "model-00017-of-00019.safetensors",
644
+ "model.layers.27.mlp.experts.5.down_proj.weight": "model-00017-of-00019.safetensors",
645
+ "model.layers.27.mlp.experts.5.gate_proj.weight": "model-00017-of-00019.safetensors",
646
+ "model.layers.27.mlp.experts.5.up_proj.weight": "model-00017-of-00019.safetensors",
647
+ "model.layers.27.mlp.experts.6.down_proj.weight": "model-00017-of-00019.safetensors",
648
+ "model.layers.27.mlp.experts.6.gate_proj.weight": "model-00017-of-00019.safetensors",
649
+ "model.layers.27.mlp.experts.6.up_proj.weight": "model-00017-of-00019.safetensors",
650
+ "model.layers.27.mlp.experts.7.down_proj.weight": "model-00017-of-00019.safetensors",
651
+ "model.layers.27.mlp.experts.7.gate_proj.weight": "model-00017-of-00019.safetensors",
652
+ "model.layers.27.mlp.experts.7.up_proj.weight": "model-00017-of-00019.safetensors",
653
+ "model.layers.27.mlp.gate.weight": "model-00017-of-00019.safetensors",
654
+ "model.layers.27.post_attention_layernorm.weight": "model-00017-of-00019.safetensors",
655
+ "model.layers.27.self_attn.k_proj.weight": "model-00016-of-00019.safetensors",
656
+ "model.layers.27.self_attn.o_proj.weight": "model-00016-of-00019.safetensors",
657
+ "model.layers.27.self_attn.q_proj.weight": "model-00016-of-00019.safetensors",
658
+ "model.layers.27.self_attn.v_proj.weight": "model-00016-of-00019.safetensors",
659
+ "model.layers.28.input_layernorm.weight": "model-00018-of-00019.safetensors",
660
+ "model.layers.28.mlp.experts.0.down_proj.weight": "model-00017-of-00019.safetensors",
661
+ "model.layers.28.mlp.experts.0.gate_proj.weight": "model-00017-of-00019.safetensors",
662
+ "model.layers.28.mlp.experts.0.up_proj.weight": "model-00017-of-00019.safetensors",
663
+ "model.layers.28.mlp.experts.1.down_proj.weight": "model-00017-of-00019.safetensors",
664
+ "model.layers.28.mlp.experts.1.gate_proj.weight": "model-00017-of-00019.safetensors",
665
+ "model.layers.28.mlp.experts.1.up_proj.weight": "model-00017-of-00019.safetensors",
666
+ "model.layers.28.mlp.experts.2.down_proj.weight": "model-00017-of-00019.safetensors",
667
+ "model.layers.28.mlp.experts.2.gate_proj.weight": "model-00017-of-00019.safetensors",
668
+ "model.layers.28.mlp.experts.2.up_proj.weight": "model-00017-of-00019.safetensors",
669
+ "model.layers.28.mlp.experts.3.down_proj.weight": "model-00017-of-00019.safetensors",
670
+ "model.layers.28.mlp.experts.3.gate_proj.weight": "model-00017-of-00019.safetensors",
671
+ "model.layers.28.mlp.experts.3.up_proj.weight": "model-00017-of-00019.safetensors",
672
+ "model.layers.28.mlp.experts.4.down_proj.weight": "model-00017-of-00019.safetensors",
673
+ "model.layers.28.mlp.experts.4.gate_proj.weight": "model-00017-of-00019.safetensors",
674
+ "model.layers.28.mlp.experts.4.up_proj.weight": "model-00017-of-00019.safetensors",
675
+ "model.layers.28.mlp.experts.5.down_proj.weight": "model-00017-of-00019.safetensors",
676
+ "model.layers.28.mlp.experts.5.gate_proj.weight": "model-00017-of-00019.safetensors",
677
+ "model.layers.28.mlp.experts.5.up_proj.weight": "model-00017-of-00019.safetensors",
678
+ "model.layers.28.mlp.experts.6.down_proj.weight": "model-00017-of-00019.safetensors",
679
+ "model.layers.28.mlp.experts.6.gate_proj.weight": "model-00017-of-00019.safetensors",
680
+ "model.layers.28.mlp.experts.6.up_proj.weight": "model-00017-of-00019.safetensors",
681
+ "model.layers.28.mlp.experts.7.down_proj.weight": "model-00018-of-00019.safetensors",
682
+ "model.layers.28.mlp.experts.7.gate_proj.weight": "model-00017-of-00019.safetensors",
683
+ "model.layers.28.mlp.experts.7.up_proj.weight": "model-00018-of-00019.safetensors",
684
+ "model.layers.28.mlp.gate.weight": "model-00018-of-00019.safetensors",
685
+ "model.layers.28.post_attention_layernorm.weight": "model-00018-of-00019.safetensors",
686
+ "model.layers.28.self_attn.k_proj.weight": "model-00017-of-00019.safetensors",
687
+ "model.layers.28.self_attn.o_proj.weight": "model-00017-of-00019.safetensors",
688
+ "model.layers.28.self_attn.q_proj.weight": "model-00017-of-00019.safetensors",
689
+ "model.layers.28.self_attn.v_proj.weight": "model-00017-of-00019.safetensors",
690
+ "model.layers.29.input_layernorm.weight": "model-00018-of-00019.safetensors",
691
+ "model.layers.29.mlp.experts.0.down_proj.weight": "model-00018-of-00019.safetensors",
692
+ "model.layers.29.mlp.experts.0.gate_proj.weight": "model-00018-of-00019.safetensors",
693
+ "model.layers.29.mlp.experts.0.up_proj.weight": "model-00018-of-00019.safetensors",
694
+ "model.layers.29.mlp.experts.1.down_proj.weight": "model-00018-of-00019.safetensors",
695
+ "model.layers.29.mlp.experts.1.gate_proj.weight": "model-00018-of-00019.safetensors",
696
+ "model.layers.29.mlp.experts.1.up_proj.weight": "model-00018-of-00019.safetensors",
697
+ "model.layers.29.mlp.experts.2.down_proj.weight": "model-00018-of-00019.safetensors",
698
+ "model.layers.29.mlp.experts.2.gate_proj.weight": "model-00018-of-00019.safetensors",
699
+ "model.layers.29.mlp.experts.2.up_proj.weight": "model-00018-of-00019.safetensors",
700
+ "model.layers.29.mlp.experts.3.down_proj.weight": "model-00018-of-00019.safetensors",
701
+ "model.layers.29.mlp.experts.3.gate_proj.weight": "model-00018-of-00019.safetensors",
702
+ "model.layers.29.mlp.experts.3.up_proj.weight": "model-00018-of-00019.safetensors",
703
+ "model.layers.29.mlp.experts.4.down_proj.weight": "model-00018-of-00019.safetensors",
704
+ "model.layers.29.mlp.experts.4.gate_proj.weight": "model-00018-of-00019.safetensors",
705
+ "model.layers.29.mlp.experts.4.up_proj.weight": "model-00018-of-00019.safetensors",
706
+ "model.layers.29.mlp.experts.5.down_proj.weight": "model-00018-of-00019.safetensors",
707
+ "model.layers.29.mlp.experts.5.gate_proj.weight": "model-00018-of-00019.safetensors",
708
+ "model.layers.29.mlp.experts.5.up_proj.weight": "model-00018-of-00019.safetensors",
709
+ "model.layers.29.mlp.experts.6.down_proj.weight": "model-00018-of-00019.safetensors",
710
+ "model.layers.29.mlp.experts.6.gate_proj.weight": "model-00018-of-00019.safetensors",
711
+ "model.layers.29.mlp.experts.6.up_proj.weight": "model-00018-of-00019.safetensors",
712
+ "model.layers.29.mlp.experts.7.down_proj.weight": "model-00018-of-00019.safetensors",
713
+ "model.layers.29.mlp.experts.7.gate_proj.weight": "model-00018-of-00019.safetensors",
714
+ "model.layers.29.mlp.experts.7.up_proj.weight": "model-00018-of-00019.safetensors",
715
+ "model.layers.29.mlp.gate.weight": "model-00018-of-00019.safetensors",
716
+ "model.layers.29.post_attention_layernorm.weight": "model-00018-of-00019.safetensors",
717
+ "model.layers.29.self_attn.k_proj.weight": "model-00018-of-00019.safetensors",
718
+ "model.layers.29.self_attn.o_proj.weight": "model-00018-of-00019.safetensors",
719
+ "model.layers.29.self_attn.q_proj.weight": "model-00018-of-00019.safetensors",
720
+ "model.layers.29.self_attn.v_proj.weight": "model-00018-of-00019.safetensors",
721
+ "model.layers.3.input_layernorm.weight": "model-00003-of-00019.safetensors",
722
+ "model.layers.3.mlp.experts.0.down_proj.weight": "model-00002-of-00019.safetensors",
723
+ "model.layers.3.mlp.experts.0.gate_proj.weight": "model-00002-of-00019.safetensors",
724
+ "model.layers.3.mlp.experts.0.up_proj.weight": "model-00002-of-00019.safetensors",
725
+ "model.layers.3.mlp.experts.1.down_proj.weight": "model-00002-of-00019.safetensors",
726
+ "model.layers.3.mlp.experts.1.gate_proj.weight": "model-00002-of-00019.safetensors",
727
+ "model.layers.3.mlp.experts.1.up_proj.weight": "model-00002-of-00019.safetensors",
728
+ "model.layers.3.mlp.experts.2.down_proj.weight": "model-00003-of-00019.safetensors",
729
+ "model.layers.3.mlp.experts.2.gate_proj.weight": "model-00002-of-00019.safetensors",
730
+ "model.layers.3.mlp.experts.2.up_proj.weight": "model-00003-of-00019.safetensors",
731
+ "model.layers.3.mlp.experts.3.down_proj.weight": "model-00003-of-00019.safetensors",
732
+ "model.layers.3.mlp.experts.3.gate_proj.weight": "model-00003-of-00019.safetensors",
733
+ "model.layers.3.mlp.experts.3.up_proj.weight": "model-00003-of-00019.safetensors",
734
+ "model.layers.3.mlp.experts.4.down_proj.weight": "model-00003-of-00019.safetensors",
735
+ "model.layers.3.mlp.experts.4.gate_proj.weight": "model-00003-of-00019.safetensors",
736
+ "model.layers.3.mlp.experts.4.up_proj.weight": "model-00003-of-00019.safetensors",
737
+ "model.layers.3.mlp.experts.5.down_proj.weight": "model-00003-of-00019.safetensors",
738
+ "model.layers.3.mlp.experts.5.gate_proj.weight": "model-00003-of-00019.safetensors",
739
+ "model.layers.3.mlp.experts.5.up_proj.weight": "model-00003-of-00019.safetensors",
740
+ "model.layers.3.mlp.experts.6.down_proj.weight": "model-00003-of-00019.safetensors",
741
+ "model.layers.3.mlp.experts.6.gate_proj.weight": "model-00003-of-00019.safetensors",
742
+ "model.layers.3.mlp.experts.6.up_proj.weight": "model-00003-of-00019.safetensors",
743
+ "model.layers.3.mlp.experts.7.down_proj.weight": "model-00003-of-00019.safetensors",
744
+ "model.layers.3.mlp.experts.7.gate_proj.weight": "model-00003-of-00019.safetensors",
745
+ "model.layers.3.mlp.experts.7.up_proj.weight": "model-00003-of-00019.safetensors",
746
+ "model.layers.3.mlp.gate.weight": "model-00003-of-00019.safetensors",
747
+ "model.layers.3.post_attention_layernorm.weight": "model-00003-of-00019.safetensors",
748
+ "model.layers.3.self_attn.k_proj.weight": "model-00002-of-00019.safetensors",
749
+ "model.layers.3.self_attn.o_proj.weight": "model-00002-of-00019.safetensors",
750
+ "model.layers.3.self_attn.q_proj.weight": "model-00002-of-00019.safetensors",
751
+ "model.layers.3.self_attn.v_proj.weight": "model-00002-of-00019.safetensors",
752
+ "model.layers.30.input_layernorm.weight": "model-00019-of-00019.safetensors",
753
+ "model.layers.30.mlp.experts.0.down_proj.weight": "model-00018-of-00019.safetensors",
754
+ "model.layers.30.mlp.experts.0.gate_proj.weight": "model-00018-of-00019.safetensors",
755
+ "model.layers.30.mlp.experts.0.up_proj.weight": "model-00018-of-00019.safetensors",
756
+ "model.layers.30.mlp.experts.1.down_proj.weight": "model-00018-of-00019.safetensors",
757
+ "model.layers.30.mlp.experts.1.gate_proj.weight": "model-00018-of-00019.safetensors",
758
+ "model.layers.30.mlp.experts.1.up_proj.weight": "model-00018-of-00019.safetensors",
759
+ "model.layers.30.mlp.experts.2.down_proj.weight": "model-00018-of-00019.safetensors",
760
+ "model.layers.30.mlp.experts.2.gate_proj.weight": "model-00018-of-00019.safetensors",
761
+ "model.layers.30.mlp.experts.2.up_proj.weight": "model-00018-of-00019.safetensors",
762
+ "model.layers.30.mlp.experts.3.down_proj.weight": "model-00018-of-00019.safetensors",
763
+ "model.layers.30.mlp.experts.3.gate_proj.weight": "model-00018-of-00019.safetensors",
764
+ "model.layers.30.mlp.experts.3.up_proj.weight": "model-00018-of-00019.safetensors",
765
+ "model.layers.30.mlp.experts.4.down_proj.weight": "model-00018-of-00019.safetensors",
766
+ "model.layers.30.mlp.experts.4.gate_proj.weight": "model-00018-of-00019.safetensors",
767
+ "model.layers.30.mlp.experts.4.up_proj.weight": "model-00018-of-00019.safetensors",
768
+ "model.layers.30.mlp.experts.5.down_proj.weight": "model-00019-of-00019.safetensors",
769
+ "model.layers.30.mlp.experts.5.gate_proj.weight": "model-00019-of-00019.safetensors",
770
+ "model.layers.30.mlp.experts.5.up_proj.weight": "model-00019-of-00019.safetensors",
771
+ "model.layers.30.mlp.experts.6.down_proj.weight": "model-00019-of-00019.safetensors",
772
+ "model.layers.30.mlp.experts.6.gate_proj.weight": "model-00019-of-00019.safetensors",
773
+ "model.layers.30.mlp.experts.6.up_proj.weight": "model-00019-of-00019.safetensors",
774
+ "model.layers.30.mlp.experts.7.down_proj.weight": "model-00019-of-00019.safetensors",
775
+ "model.layers.30.mlp.experts.7.gate_proj.weight": "model-00019-of-00019.safetensors",
776
+ "model.layers.30.mlp.experts.7.up_proj.weight": "model-00019-of-00019.safetensors",
777
+ "model.layers.30.mlp.gate.weight": "model-00019-of-00019.safetensors",
778
+ "model.layers.30.post_attention_layernorm.weight": "model-00019-of-00019.safetensors",
779
+ "model.layers.30.self_attn.k_proj.weight": "model-00018-of-00019.safetensors",
780
+ "model.layers.30.self_attn.o_proj.weight": "model-00018-of-00019.safetensors",
781
+ "model.layers.30.self_attn.q_proj.weight": "model-00018-of-00019.safetensors",
782
+ "model.layers.30.self_attn.v_proj.weight": "model-00018-of-00019.safetensors",
783
+ "model.layers.31.input_layernorm.weight": "model-00019-of-00019.safetensors",
784
+ "model.layers.31.mlp.experts.0.down_proj.weight": "model-00019-of-00019.safetensors",
785
+ "model.layers.31.mlp.experts.0.gate_proj.weight": "model-00019-of-00019.safetensors",
786
+ "model.layers.31.mlp.experts.0.up_proj.weight": "model-00019-of-00019.safetensors",
787
+ "model.layers.31.mlp.experts.1.down_proj.weight": "model-00019-of-00019.safetensors",
788
+ "model.layers.31.mlp.experts.1.gate_proj.weight": "model-00019-of-00019.safetensors",
789
+ "model.layers.31.mlp.experts.1.up_proj.weight": "model-00019-of-00019.safetensors",
790
+ "model.layers.31.mlp.experts.2.down_proj.weight": "model-00019-of-00019.safetensors",
791
+ "model.layers.31.mlp.experts.2.gate_proj.weight": "model-00019-of-00019.safetensors",
792
+ "model.layers.31.mlp.experts.2.up_proj.weight": "model-00019-of-00019.safetensors",
793
+ "model.layers.31.mlp.experts.3.down_proj.weight": "model-00019-of-00019.safetensors",
794
+ "model.layers.31.mlp.experts.3.gate_proj.weight": "model-00019-of-00019.safetensors",
795
+ "model.layers.31.mlp.experts.3.up_proj.weight": "model-00019-of-00019.safetensors",
796
+ "model.layers.31.mlp.experts.4.down_proj.weight": "model-00019-of-00019.safetensors",
797
+ "model.layers.31.mlp.experts.4.gate_proj.weight": "model-00019-of-00019.safetensors",
798
+ "model.layers.31.mlp.experts.4.up_proj.weight": "model-00019-of-00019.safetensors",
799
+ "model.layers.31.mlp.experts.5.down_proj.weight": "model-00019-of-00019.safetensors",
800
+ "model.layers.31.mlp.experts.5.gate_proj.weight": "model-00019-of-00019.safetensors",
801
+ "model.layers.31.mlp.experts.5.up_proj.weight": "model-00019-of-00019.safetensors",
802
+ "model.layers.31.mlp.experts.6.down_proj.weight": "model-00019-of-00019.safetensors",
803
+ "model.layers.31.mlp.experts.6.gate_proj.weight": "model-00019-of-00019.safetensors",
804
+ "model.layers.31.mlp.experts.6.up_proj.weight": "model-00019-of-00019.safetensors",
805
+ "model.layers.31.mlp.experts.7.down_proj.weight": "model-00019-of-00019.safetensors",
806
+ "model.layers.31.mlp.experts.7.gate_proj.weight": "model-00019-of-00019.safetensors",
807
+ "model.layers.31.mlp.experts.7.up_proj.weight": "model-00019-of-00019.safetensors",
808
+ "model.layers.31.mlp.gate.weight": "model-00019-of-00019.safetensors",
809
+ "model.layers.31.post_attention_layernorm.weight": "model-00019-of-00019.safetensors",
810
+ "model.layers.31.self_attn.k_proj.weight": "model-00019-of-00019.safetensors",
811
+ "model.layers.31.self_attn.o_proj.weight": "model-00019-of-00019.safetensors",
812
+ "model.layers.31.self_attn.q_proj.weight": "model-00019-of-00019.safetensors",
813
+ "model.layers.31.self_attn.v_proj.weight": "model-00019-of-00019.safetensors",
814
+ "model.layers.4.input_layernorm.weight": "model-00003-of-00019.safetensors",
815
+ "model.layers.4.mlp.experts.0.down_proj.weight": "model-00003-of-00019.safetensors",
816
+ "model.layers.4.mlp.experts.0.gate_proj.weight": "model-00003-of-00019.safetensors",
817
+ "model.layers.4.mlp.experts.0.up_proj.weight": "model-00003-of-00019.safetensors",
818
+ "model.layers.4.mlp.experts.1.down_proj.weight": "model-00003-of-00019.safetensors",
819
+ "model.layers.4.mlp.experts.1.gate_proj.weight": "model-00003-of-00019.safetensors",
820
+ "model.layers.4.mlp.experts.1.up_proj.weight": "model-00003-of-00019.safetensors",
821
+ "model.layers.4.mlp.experts.2.down_proj.weight": "model-00003-of-00019.safetensors",
822
+ "model.layers.4.mlp.experts.2.gate_proj.weight": "model-00003-of-00019.safetensors",
823
+ "model.layers.4.mlp.experts.2.up_proj.weight": "model-00003-of-00019.safetensors",
824
+ "model.layers.4.mlp.experts.3.down_proj.weight": "model-00003-of-00019.safetensors",
825
+ "model.layers.4.mlp.experts.3.gate_proj.weight": "model-00003-of-00019.safetensors",
826
+ "model.layers.4.mlp.experts.3.up_proj.weight": "model-00003-of-00019.safetensors",
827
+ "model.layers.4.mlp.experts.4.down_proj.weight": "model-00003-of-00019.safetensors",
828
+ "model.layers.4.mlp.experts.4.gate_proj.weight": "model-00003-of-00019.safetensors",
829
+ "model.layers.4.mlp.experts.4.up_proj.weight": "model-00003-of-00019.safetensors",
830
+ "model.layers.4.mlp.experts.5.down_proj.weight": "model-00003-of-00019.safetensors",
831
+ "model.layers.4.mlp.experts.5.gate_proj.weight": "model-00003-of-00019.safetensors",
832
+ "model.layers.4.mlp.experts.5.up_proj.weight": "model-00003-of-00019.safetensors",
833
+ "model.layers.4.mlp.experts.6.down_proj.weight": "model-00003-of-00019.safetensors",
834
+ "model.layers.4.mlp.experts.6.gate_proj.weight": "model-00003-of-00019.safetensors",
835
+ "model.layers.4.mlp.experts.6.up_proj.weight": "model-00003-of-00019.safetensors",
836
+ "model.layers.4.mlp.experts.7.down_proj.weight": "model-00003-of-00019.safetensors",
837
+ "model.layers.4.mlp.experts.7.gate_proj.weight": "model-00003-of-00019.safetensors",
838
+ "model.layers.4.mlp.experts.7.up_proj.weight": "model-00003-of-00019.safetensors",
839
+ "model.layers.4.mlp.gate.weight": "model-00003-of-00019.safetensors",
840
+ "model.layers.4.post_attention_layernorm.weight": "model-00003-of-00019.safetensors",
841
+ "model.layers.4.self_attn.k_proj.weight": "model-00003-of-00019.safetensors",
842
+ "model.layers.4.self_attn.o_proj.weight": "model-00003-of-00019.safetensors",
843
+ "model.layers.4.self_attn.q_proj.weight": "model-00003-of-00019.safetensors",
844
+ "model.layers.4.self_attn.v_proj.weight": "model-00003-of-00019.safetensors",
845
+ "model.layers.5.input_layernorm.weight": "model-00004-of-00019.safetensors",
846
+ "model.layers.5.mlp.experts.0.down_proj.weight": "model-00004-of-00019.safetensors",
847
+ "model.layers.5.mlp.experts.0.gate_proj.weight": "model-00004-of-00019.safetensors",
848
+ "model.layers.5.mlp.experts.0.up_proj.weight": "model-00004-of-00019.safetensors",
849
+ "model.layers.5.mlp.experts.1.down_proj.weight": "model-00004-of-00019.safetensors",
850
+ "model.layers.5.mlp.experts.1.gate_proj.weight": "model-00004-of-00019.safetensors",
851
+ "model.layers.5.mlp.experts.1.up_proj.weight": "model-00004-of-00019.safetensors",
852
+ "model.layers.5.mlp.experts.2.down_proj.weight": "model-00004-of-00019.safetensors",
853
+ "model.layers.5.mlp.experts.2.gate_proj.weight": "model-00004-of-00019.safetensors",
854
+ "model.layers.5.mlp.experts.2.up_proj.weight": "model-00004-of-00019.safetensors",
855
+ "model.layers.5.mlp.experts.3.down_proj.weight": "model-00004-of-00019.safetensors",
856
+ "model.layers.5.mlp.experts.3.gate_proj.weight": "model-00004-of-00019.safetensors",
857
+ "model.layers.5.mlp.experts.3.up_proj.weight": "model-00004-of-00019.safetensors",
858
+ "model.layers.5.mlp.experts.4.down_proj.weight": "model-00004-of-00019.safetensors",
859
+ "model.layers.5.mlp.experts.4.gate_proj.weight": "model-00004-of-00019.safetensors",
860
+ "model.layers.5.mlp.experts.4.up_proj.weight": "model-00004-of-00019.safetensors",
861
+ "model.layers.5.mlp.experts.5.down_proj.weight": "model-00004-of-00019.safetensors",
862
+ "model.layers.5.mlp.experts.5.gate_proj.weight": "model-00004-of-00019.safetensors",
863
+ "model.layers.5.mlp.experts.5.up_proj.weight": "model-00004-of-00019.safetensors",
864
+ "model.layers.5.mlp.experts.6.down_proj.weight": "model-00004-of-00019.safetensors",
865
+ "model.layers.5.mlp.experts.6.gate_proj.weight": "model-00004-of-00019.safetensors",
866
+ "model.layers.5.mlp.experts.6.up_proj.weight": "model-00004-of-00019.safetensors",
867
+ "model.layers.5.mlp.experts.7.down_proj.weight": "model-00004-of-00019.safetensors",
868
+ "model.layers.5.mlp.experts.7.gate_proj.weight": "model-00004-of-00019.safetensors",
869
+ "model.layers.5.mlp.experts.7.up_proj.weight": "model-00004-of-00019.safetensors",
870
+ "model.layers.5.mlp.gate.weight": "model-00004-of-00019.safetensors",
871
+ "model.layers.5.post_attention_layernorm.weight": "model-00004-of-00019.safetensors",
872
+ "model.layers.5.self_attn.k_proj.weight": "model-00003-of-00019.safetensors",
873
+ "model.layers.5.self_attn.o_proj.weight": "model-00003-of-00019.safetensors",
874
+ "model.layers.5.self_attn.q_proj.weight": "model-00003-of-00019.safetensors",
875
+ "model.layers.5.self_attn.v_proj.weight": "model-00003-of-00019.safetensors",
876
+ "model.layers.6.input_layernorm.weight": "model-00005-of-00019.safetensors",
877
+ "model.layers.6.mlp.experts.0.down_proj.weight": "model-00004-of-00019.safetensors",
878
+ "model.layers.6.mlp.experts.0.gate_proj.weight": "model-00004-of-00019.safetensors",
879
+ "model.layers.6.mlp.experts.0.up_proj.weight": "model-00004-of-00019.safetensors",
880
+ "model.layers.6.mlp.experts.1.down_proj.weight": "model-00004-of-00019.safetensors",
881
+ "model.layers.6.mlp.experts.1.gate_proj.weight": "model-00004-of-00019.safetensors",
882
+ "model.layers.6.mlp.experts.1.up_proj.weight": "model-00004-of-00019.safetensors",
883
+ "model.layers.6.mlp.experts.2.down_proj.weight": "model-00004-of-00019.safetensors",
884
+ "model.layers.6.mlp.experts.2.gate_proj.weight": "model-00004-of-00019.safetensors",
885
+ "model.layers.6.mlp.experts.2.up_proj.weight": "model-00004-of-00019.safetensors",
886
+ "model.layers.6.mlp.experts.3.down_proj.weight": "model-00004-of-00019.safetensors",
887
+ "model.layers.6.mlp.experts.3.gate_proj.weight": "model-00004-of-00019.safetensors",
888
+ "model.layers.6.mlp.experts.3.up_proj.weight": "model-00004-of-00019.safetensors",
889
+ "model.layers.6.mlp.experts.4.down_proj.weight": "model-00004-of-00019.safetensors",
890
+ "model.layers.6.mlp.experts.4.gate_proj.weight": "model-00004-of-00019.safetensors",
891
+ "model.layers.6.mlp.experts.4.up_proj.weight": "model-00004-of-00019.safetensors",
892
+ "model.layers.6.mlp.experts.5.down_proj.weight": "model-00005-of-00019.safetensors",
893
+ "model.layers.6.mlp.experts.5.gate_proj.weight": "model-00004-of-00019.safetensors",
894
+ "model.layers.6.mlp.experts.5.up_proj.weight": "model-00004-of-00019.safetensors",
895
+ "model.layers.6.mlp.experts.6.down_proj.weight": "model-00005-of-00019.safetensors",
896
+ "model.layers.6.mlp.experts.6.gate_proj.weight": "model-00005-of-00019.safetensors",
897
+ "model.layers.6.mlp.experts.6.up_proj.weight": "model-00005-of-00019.safetensors",
898
+ "model.layers.6.mlp.experts.7.down_proj.weight": "model-00005-of-00019.safetensors",
899
+ "model.layers.6.mlp.experts.7.gate_proj.weight": "model-00005-of-00019.safetensors",
900
+ "model.layers.6.mlp.experts.7.up_proj.weight": "model-00005-of-00019.safetensors",
901
+ "model.layers.6.mlp.gate.weight": "model-00005-of-00019.safetensors",
902
+ "model.layers.6.post_attention_layernorm.weight": "model-00005-of-00019.safetensors",
903
+ "model.layers.6.self_attn.k_proj.weight": "model-00004-of-00019.safetensors",
904
+ "model.layers.6.self_attn.o_proj.weight": "model-00004-of-00019.safetensors",
905
+ "model.layers.6.self_attn.q_proj.weight": "model-00004-of-00019.safetensors",
906
+ "model.layers.6.self_attn.v_proj.weight": "model-00004-of-00019.safetensors",
907
+ "model.layers.7.input_layernorm.weight": "model-00005-of-00019.safetensors",
908
+ "model.layers.7.mlp.experts.0.down_proj.weight": "model-00005-of-00019.safetensors",
909
+ "model.layers.7.mlp.experts.0.gate_proj.weight": "model-00005-of-00019.safetensors",
910
+ "model.layers.7.mlp.experts.0.up_proj.weight": "model-00005-of-00019.safetensors",
911
+ "model.layers.7.mlp.experts.1.down_proj.weight": "model-00005-of-00019.safetensors",
912
+ "model.layers.7.mlp.experts.1.gate_proj.weight": "model-00005-of-00019.safetensors",
913
+ "model.layers.7.mlp.experts.1.up_proj.weight": "model-00005-of-00019.safetensors",
914
+ "model.layers.7.mlp.experts.2.down_proj.weight": "model-00005-of-00019.safetensors",
915
+ "model.layers.7.mlp.experts.2.gate_proj.weight": "model-00005-of-00019.safetensors",
916
+ "model.layers.7.mlp.experts.2.up_proj.weight": "model-00005-of-00019.safetensors",
917
+ "model.layers.7.mlp.experts.3.down_proj.weight": "model-00005-of-00019.safetensors",
918
+ "model.layers.7.mlp.experts.3.gate_proj.weight": "model-00005-of-00019.safetensors",
919
+ "model.layers.7.mlp.experts.3.up_proj.weight": "model-00005-of-00019.safetensors",
920
+ "model.layers.7.mlp.experts.4.down_proj.weight": "model-00005-of-00019.safetensors",
921
+ "model.layers.7.mlp.experts.4.gate_proj.weight": "model-00005-of-00019.safetensors",
922
+ "model.layers.7.mlp.experts.4.up_proj.weight": "model-00005-of-00019.safetensors",
923
+ "model.layers.7.mlp.experts.5.down_proj.weight": "model-00005-of-00019.safetensors",
924
+ "model.layers.7.mlp.experts.5.gate_proj.weight": "model-00005-of-00019.safetensors",
925
+ "model.layers.7.mlp.experts.5.up_proj.weight": "model-00005-of-00019.safetensors",
926
+ "model.layers.7.mlp.experts.6.down_proj.weight": "model-00005-of-00019.safetensors",
927
+ "model.layers.7.mlp.experts.6.gate_proj.weight": "model-00005-of-00019.safetensors",
928
+ "model.layers.7.mlp.experts.6.up_proj.weight": "model-00005-of-00019.safetensors",
929
+ "model.layers.7.mlp.experts.7.down_proj.weight": "model-00005-of-00019.safetensors",
930
+ "model.layers.7.mlp.experts.7.gate_proj.weight": "model-00005-of-00019.safetensors",
931
+ "model.layers.7.mlp.experts.7.up_proj.weight": "model-00005-of-00019.safetensors",
932
+ "model.layers.7.mlp.gate.weight": "model-00005-of-00019.safetensors",
933
+ "model.layers.7.post_attention_layernorm.weight": "model-00005-of-00019.safetensors",
934
+ "model.layers.7.self_attn.k_proj.weight": "model-00005-of-00019.safetensors",
935
+ "model.layers.7.self_attn.o_proj.weight": "model-00005-of-00019.safetensors",
936
+ "model.layers.7.self_attn.q_proj.weight": "model-00005-of-00019.safetensors",
937
+ "model.layers.7.self_attn.v_proj.weight": "model-00005-of-00019.safetensors",
938
+ "model.layers.8.input_layernorm.weight": "model-00006-of-00019.safetensors",
939
+ "model.layers.8.mlp.experts.0.down_proj.weight": "model-00005-of-00019.safetensors",
940
+ "model.layers.8.mlp.experts.0.gate_proj.weight": "model-00005-of-00019.safetensors",
941
+ "model.layers.8.mlp.experts.0.up_proj.weight": "model-00005-of-00019.safetensors",
942
+ "model.layers.8.mlp.experts.1.down_proj.weight": "model-00005-of-00019.safetensors",
943
+ "model.layers.8.mlp.experts.1.gate_proj.weight": "model-00005-of-00019.safetensors",
944
+ "model.layers.8.mlp.experts.1.up_proj.weight": "model-00005-of-00019.safetensors",
945
+ "model.layers.8.mlp.experts.2.down_proj.weight": "model-00005-of-00019.safetensors",
946
+ "model.layers.8.mlp.experts.2.gate_proj.weight": "model-00005-of-00019.safetensors",
947
+ "model.layers.8.mlp.experts.2.up_proj.weight": "model-00005-of-00019.safetensors",
948
+ "model.layers.8.mlp.experts.3.down_proj.weight": "model-00006-of-00019.safetensors",
949
+ "model.layers.8.mlp.experts.3.gate_proj.weight": "model-00005-of-00019.safetensors",
950
+ "model.layers.8.mlp.experts.3.up_proj.weight": "model-00006-of-00019.safetensors",
951
+ "model.layers.8.mlp.experts.4.down_proj.weight": "model-00006-of-00019.safetensors",
952
+ "model.layers.8.mlp.experts.4.gate_proj.weight": "model-00006-of-00019.safetensors",
953
+ "model.layers.8.mlp.experts.4.up_proj.weight": "model-00006-of-00019.safetensors",
954
+ "model.layers.8.mlp.experts.5.down_proj.weight": "model-00006-of-00019.safetensors",
955
+ "model.layers.8.mlp.experts.5.gate_proj.weight": "model-00006-of-00019.safetensors",
956
+ "model.layers.8.mlp.experts.5.up_proj.weight": "model-00006-of-00019.safetensors",
957
+ "model.layers.8.mlp.experts.6.down_proj.weight": "model-00006-of-00019.safetensors",
958
+ "model.layers.8.mlp.experts.6.gate_proj.weight": "model-00006-of-00019.safetensors",
959
+ "model.layers.8.mlp.experts.6.up_proj.weight": "model-00006-of-00019.safetensors",
960
+ "model.layers.8.mlp.experts.7.down_proj.weight": "model-00006-of-00019.safetensors",
961
+ "model.layers.8.mlp.experts.7.gate_proj.weight": "model-00006-of-00019.safetensors",
962
+ "model.layers.8.mlp.experts.7.up_proj.weight": "model-00006-of-00019.safetensors",
963
+ "model.layers.8.mlp.gate.weight": "model-00006-of-00019.safetensors",
964
+ "model.layers.8.post_attention_layernorm.weight": "model-00006-of-00019.safetensors",
965
+ "model.layers.8.self_attn.k_proj.weight": "model-00005-of-00019.safetensors",
966
+ "model.layers.8.self_attn.o_proj.weight": "model-00005-of-00019.safetensors",
967
+ "model.layers.8.self_attn.q_proj.weight": "model-00005-of-00019.safetensors",
968
+ "model.layers.8.self_attn.v_proj.weight": "model-00005-of-00019.safetensors",
969
+ "model.layers.9.input_layernorm.weight": "model-00006-of-00019.safetensors",
970
+ "model.layers.9.mlp.experts.0.down_proj.weight": "model-00006-of-00019.safetensors",
971
+ "model.layers.9.mlp.experts.0.gate_proj.weight": "model-00006-of-00019.safetensors",
972
+ "model.layers.9.mlp.experts.0.up_proj.weight": "model-00006-of-00019.safetensors",
973
+ "model.layers.9.mlp.experts.1.down_proj.weight": "model-00006-of-00019.safetensors",
974
+ "model.layers.9.mlp.experts.1.gate_proj.weight": "model-00006-of-00019.safetensors",
975
+ "model.layers.9.mlp.experts.1.up_proj.weight": "model-00006-of-00019.safetensors",
976
+ "model.layers.9.mlp.experts.2.down_proj.weight": "model-00006-of-00019.safetensors",
977
+ "model.layers.9.mlp.experts.2.gate_proj.weight": "model-00006-of-00019.safetensors",
978
+ "model.layers.9.mlp.experts.2.up_proj.weight": "model-00006-of-00019.safetensors",
979
+ "model.layers.9.mlp.experts.3.down_proj.weight": "model-00006-of-00019.safetensors",
980
+ "model.layers.9.mlp.experts.3.gate_proj.weight": "model-00006-of-00019.safetensors",
981
+ "model.layers.9.mlp.experts.3.up_proj.weight": "model-00006-of-00019.safetensors",
982
+ "model.layers.9.mlp.experts.4.down_proj.weight": "model-00006-of-00019.safetensors",
983
+ "model.layers.9.mlp.experts.4.gate_proj.weight": "model-00006-of-00019.safetensors",
984
+ "model.layers.9.mlp.experts.4.up_proj.weight": "model-00006-of-00019.safetensors",
985
+ "model.layers.9.mlp.experts.5.down_proj.weight": "model-00006-of-00019.safetensors",
986
+ "model.layers.9.mlp.experts.5.gate_proj.weight": "model-00006-of-00019.safetensors",
987
+ "model.layers.9.mlp.experts.5.up_proj.weight": "model-00006-of-00019.safetensors",
988
+ "model.layers.9.mlp.experts.6.down_proj.weight": "model-00006-of-00019.safetensors",
989
+ "model.layers.9.mlp.experts.6.gate_proj.weight": "model-00006-of-00019.safetensors",
990
+ "model.layers.9.mlp.experts.6.up_proj.weight": "model-00006-of-00019.safetensors",
991
+ "model.layers.9.mlp.experts.7.down_proj.weight": "model-00006-of-00019.safetensors",
992
+ "model.layers.9.mlp.experts.7.gate_proj.weight": "model-00006-of-00019.safetensors",
993
+ "model.layers.9.mlp.experts.7.up_proj.weight": "model-00006-of-00019.safetensors",
994
+ "model.layers.9.mlp.gate.weight": "model-00006-of-00019.safetensors",
995
+ "model.layers.9.post_attention_layernorm.weight": "model-00006-of-00019.safetensors",
996
+ "model.layers.9.self_attn.k_proj.weight": "model-00006-of-00019.safetensors",
997
+ "model.layers.9.self_attn.o_proj.weight": "model-00006-of-00019.safetensors",
998
+ "model.layers.9.self_attn.q_proj.weight": "model-00006-of-00019.safetensors",
999
+ "model.layers.9.self_attn.v_proj.weight": "model-00006-of-00019.safetensors",
1000
+ "model.norm.weight": "model-00019-of-00019.safetensors"
1001
+ }
1002
+ }
modeling_deepseek.py ADDED
@@ -0,0 +1,1535 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023 DeepSeek-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 DeepSeek model."""
21
+ import math
22
+ import warnings
23
+ from typing import List, Optional, Tuple, Union
24
+
25
+ import torch
26
+ import torch.nn.functional as F
27
+ import torch.utils.checkpoint
28
+ from torch import nn
29
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
30
+
31
+ from transformers.activations import ACT2FN
32
+ from transformers.cache_utils import Cache, DynamicCache
33
+ from transformers.modeling_attn_mask_utils import (
34
+ AttentionMaskConverter,
35
+ _prepare_4d_attention_mask,
36
+ _prepare_4d_causal_attention_mask,
37
+ _prepare_4d_causal_attention_mask_for_sdpa,
38
+ )
39
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
40
+ from transformers.modeling_utils import PreTrainedModel
41
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13
42
+ from transformers.utils import (
43
+ add_start_docstrings,
44
+ add_start_docstrings_to_model_forward,
45
+ is_flash_attn_2_available,
46
+ is_flash_attn_greater_or_equal_2_10,
47
+ logging,
48
+ replace_return_docstrings,
49
+ )
50
+ from transformers.utils.import_utils import is_torch_fx_available
51
+ from .configuration_deepseek import DeepseekConfig
52
+
53
+
54
+ if is_flash_attn_2_available():
55
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
56
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
57
+
58
+
59
+ # This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
60
+ # It means that the function will not be traced through and simply appear as a node in the graph.
61
+ if is_torch_fx_available():
62
+ if not is_torch_greater_or_equal_than_1_13:
63
+ import torch.fx
64
+
65
+ _prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
66
+
67
+
68
+ logger = logging.get_logger(__name__)
69
+
70
+ _CONFIG_FOR_DOC = "DeepseekConfig"
71
+
72
+
73
+ def _get_unpad_data(attention_mask):
74
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
75
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
76
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
77
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
78
+ return (
79
+ indices,
80
+ cu_seqlens,
81
+ max_seqlen_in_batch,
82
+ )
83
+
84
+
85
+ def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
86
+ warnings.warn(
87
+ "Calling `transformers.models.Deepseek.modeling_Deepseek._prepare_4d_attention_mask` is deprecated and will be removed in v4.37. Use `transformers.modeling_attn_mask_utils._prepare_4d_attention_mask"
88
+ )
89
+ return _prepare_4d_attention_mask(mask=mask, dtype=dtype, tgt_len=tgt_len)
90
+
91
+
92
+ def _make_causal_mask(
93
+ input_ids_shape: torch.Size, dtype: torch.dtype, device: torch.device, past_key_values_length: int = 0
94
+ ):
95
+ warnings.warn(
96
+ "Calling `transformers.models.Deepseek.modeling_Deepseek._make_causal_mask` is deprecated and will be removed in v4.37. Use `transformers.models.Deepseek.modeling_Deepseek.AttentionMaskConverter._make_causal_mask"
97
+ )
98
+ return AttentionMaskConverter._make_causal_mask(
99
+ input_ids_shape=input_ids_shape, dtype=dtype, device=device, past_key_values_length=past_key_values_length
100
+ )
101
+
102
+
103
+ class DeepseekRMSNorm(nn.Module):
104
+ def __init__(self, hidden_size, eps=1e-6):
105
+ """
106
+ DeepseekRMSNorm is equivalent to T5LayerNorm
107
+ """
108
+ super().__init__()
109
+ self.weight = nn.Parameter(torch.ones(hidden_size))
110
+ self.variance_epsilon = eps
111
+
112
+ def forward(self, hidden_states):
113
+ input_dtype = hidden_states.dtype
114
+ hidden_states = hidden_states.to(torch.float32)
115
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
116
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
117
+ return self.weight * hidden_states.to(input_dtype)
118
+
119
+
120
+ ALL_LAYERNORM_LAYERS.append(DeepseekRMSNorm)
121
+
122
+
123
+ class DeepseekRotaryEmbedding(nn.Module):
124
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
125
+ super().__init__()
126
+
127
+ self.dim = dim
128
+ self.max_position_embeddings = max_position_embeddings
129
+ self.base = base
130
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
131
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
132
+
133
+ # Build here to make `torch.jit.trace` work.
134
+ self._set_cos_sin_cache(
135
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
136
+ )
137
+ self.max_seq_len_cached = None
138
+
139
+
140
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
141
+ self.max_seq_len_cached = seq_len
142
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
143
+
144
+ freqs = torch.outer(t, self.inv_freq.to(t.device))
145
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
146
+ emb = torch.cat((freqs, freqs), dim=-1)
147
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
148
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
149
+
150
+ def forward(self, x, seq_len=None):
151
+ # x: [bs, num_attention_heads, seq_len, head_size]
152
+ if self.max_seq_len_cached is None or seq_len > self.max_seq_len_cached:
153
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
154
+
155
+ return (
156
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
157
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
158
+ )
159
+
160
+
161
+ # Copied from transformers.models.llama.modeling_llama.LlamaLinearScalingRotaryEmbedding with Llama->Deepseek
162
+ class DeepseekLinearScalingRotaryEmbedding(DeepseekRotaryEmbedding):
163
+ """DeepseekRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
164
+
165
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
166
+ self.scaling_factor = scaling_factor
167
+ super().__init__(dim, max_position_embeddings, base, device)
168
+
169
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
170
+ self.max_seq_len_cached = seq_len
171
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
172
+ t = t / self.scaling_factor
173
+
174
+ freqs = torch.outer(t, self.inv_freq)
175
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
176
+ emb = torch.cat((freqs, freqs), dim=-1)
177
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
178
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
179
+
180
+
181
+ # Copied from transformers.models.llama.modeling_llama.LlamaDynamicNTKScalingRotaryEmbedding with Llama->Deepseek
182
+ class DeepseekDynamicNTKScalingRotaryEmbedding(DeepseekRotaryEmbedding):
183
+ """DeepseekRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
184
+
185
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
186
+ self.scaling_factor = scaling_factor
187
+ super().__init__(dim, max_position_embeddings, base, device)
188
+
189
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
190
+ self.max_seq_len_cached = seq_len
191
+
192
+ if seq_len > self.max_position_embeddings:
193
+ base = self.base * (
194
+ (self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
195
+ ) ** (self.dim / (self.dim - 2))
196
+ inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
197
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
198
+
199
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
200
+
201
+ freqs = torch.outer(t, self.inv_freq)
202
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
203
+ emb = torch.cat((freqs, freqs), dim=-1)
204
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
205
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
206
+
207
+
208
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
209
+ def rotate_half(x):
210
+ """Rotates half the hidden dims of the input."""
211
+ x1 = x[..., : x.shape[-1] // 2]
212
+ x2 = x[..., x.shape[-1] // 2 :]
213
+ return torch.cat((-x2, x1), dim=-1)
214
+
215
+
216
+ # Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
217
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
218
+ """Applies Rotary Position Embedding to the query and key tensors.
219
+ Args:
220
+ q (`torch.Tensor`): The query tensor.
221
+ k (`torch.Tensor`): The key tensor.
222
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
223
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
224
+ position_ids (`torch.Tensor`):
225
+ The position indices of the tokens corresponding to the query and key tensors. For example, this can be
226
+ used to pass offsetted position ids when working with a KV-cache.
227
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
228
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
229
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
230
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
231
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
232
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
233
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
234
+ Returns:
235
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
236
+ """
237
+ cos = cos[position_ids].unsqueeze(unsqueeze_dim)
238
+ sin = sin[position_ids].unsqueeze(unsqueeze_dim)
239
+ q_embed = (q * cos) + (rotate_half(q) * sin)
240
+ k_embed = (k * cos) + (rotate_half(k) * sin)
241
+ return q_embed, k_embed
242
+
243
+
244
+ class DeepseekMLP(nn.Module):
245
+ def __init__(self, config, hidden_size = None, intermediate_size = None):
246
+ super().__init__()
247
+ self.config = config
248
+ self.hidden_size = config.hidden_size if hidden_size is None else hidden_size
249
+ self.intermediate_size = config.intermediate_size if intermediate_size is None else intermediate_size
250
+
251
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
252
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
253
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
254
+ self.act_fn = ACT2FN[config.hidden_act]
255
+
256
+ def forward(self, x):
257
+ if self.config.pretraining_tp > 1:
258
+ slice = self.intermediate_size // self.config.pretraining_tp
259
+ gate_proj_slices = self.gate_proj.weight.split(slice, dim=0)
260
+ up_proj_slices = self.up_proj.weight.split(slice, dim=0)
261
+ down_proj_slices = self.down_proj.weight.split(slice, dim=1)
262
+
263
+ gate_proj = torch.cat(
264
+ [F.linear(x, gate_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1
265
+ )
266
+ up_proj = torch.cat([F.linear(x, up_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
267
+
268
+ intermediate_states = (self.act_fn(gate_proj) * up_proj).split(slice, dim=2)
269
+ down_proj = [
270
+ F.linear(intermediate_states[i], down_proj_slices[i]) for i in range(self.config.pretraining_tp)
271
+ ]
272
+ down_proj = sum(down_proj)
273
+ else:
274
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
275
+
276
+ return down_proj
277
+
278
+
279
+ class MoEGate(nn.Module):
280
+ def __init__(self, config):
281
+ super().__init__()
282
+ self.config = config
283
+ self.top_k = config.num_experts_per_tok
284
+ self.n_routed_experts = config.n_routed_experts
285
+
286
+ self.scoring_func = config.scoring_func
287
+ self.alpha = config.aux_loss_alpha
288
+ self.seq_aux = config.seq_aux
289
+
290
+ # topk selection algorithm
291
+ self.norm_topk_prob = config.norm_topk_prob
292
+ self.gating_dim = config.hidden_size
293
+ self.weight = nn.Parameter(torch.empty((self.n_routed_experts, self.gating_dim)))
294
+ self.reset_parameters()
295
+
296
+ def reset_parameters(self) -> None:
297
+ import torch.nn.init as init
298
+ init.kaiming_uniform_(self.weight, a=math.sqrt(5))
299
+
300
+ def forward(self, hidden_states):
301
+ bsz, seq_len, h = hidden_states.shape
302
+ ### compute gating score
303
+ hidden_states = hidden_states.view(-1, h)
304
+ logits = F.linear(hidden_states, self.weight, None)
305
+ if self.scoring_func == 'softmax':
306
+ scores = logits.softmax(dim=-1)
307
+ else:
308
+ raise NotImplementedError(f'insupportable scoring function for MoE gating: {self.scoring_func}')
309
+
310
+ ### select top-k experts
311
+ topk_weight, topk_idx = torch.topk(scores, k=self.top_k, dim=-1, sorted=False)
312
+
313
+ ### norm gate to sum 1
314
+ if self.top_k > 1 and self.norm_topk_prob:
315
+ denominator = topk_weight.sum(dim=-1, keepdim=True) + 1e-20
316
+ topk_weight = topk_weight / denominator
317
+
318
+ ### expert-level computation auxiliary loss
319
+ if self.training and self.alpha > 0.0:
320
+ scores_for_aux = scores
321
+ aux_topk = self.top_k
322
+ # always compute aux loss based on the naive greedy topk method
323
+ topk_idx_for_aux_loss = topk_idx.view(bsz, -1)
324
+ if self.seq_aux:
325
+ scores_for_seq_aux = scores_for_aux.view(bsz, seq_len, -1)
326
+ ce = torch.zeros(bsz, self.n_routed_experts, device=hidden_states.device)
327
+ ce.scatter_add_(1, topk_idx_for_aux_loss, torch.ones(bsz, seq_len * aux_topk, device=hidden_states.device)).div_(seq_len * aux_topk / self.n_routed_experts)
328
+ aux_loss = (ce * scores_for_seq_aux.mean(dim = 1)).sum(dim = 1).mean() * self.alpha
329
+ else:
330
+ mask_ce = F.one_hot(topk_idx_for_aux_loss.view(-1), num_classes=self.n_routed_experts)
331
+ ce = mask_ce.float().mean(0)
332
+ Pi = scores_for_aux.mean(0)
333
+ fi = ce * self.n_routed_experts
334
+ aux_loss = (Pi * fi).sum() * self.alpha
335
+ else:
336
+ aux_loss = None
337
+ return topk_idx, topk_weight, aux_loss
338
+
339
+
340
+ class AddAuxiliaryLoss(torch.autograd.Function):
341
+ """
342
+ The trick function of adding auxiliary (aux) loss,
343
+ which includes the gradient of the aux loss during backpropagation.
344
+ """
345
+ @staticmethod
346
+ def forward(ctx, x, loss):
347
+ assert loss.numel() == 1
348
+ ctx.dtype = loss.dtype
349
+ ctx.required_aux_loss = loss.requires_grad
350
+ return x
351
+
352
+ @staticmethod
353
+ def backward(ctx, grad_output):
354
+ grad_loss = None
355
+ if ctx.required_aux_loss:
356
+ grad_loss = torch.ones(1, dtype=ctx.dtype, device=grad_output.device)
357
+ return grad_output, grad_loss
358
+
359
+
360
+ class DeepseekMoE(nn.Module):
361
+ """
362
+ A mixed expert module containing shared experts.
363
+ """
364
+ def __init__(self, config):
365
+ super().__init__()
366
+ self.config = config
367
+ self.num_experts_per_tok = config.num_experts_per_tok
368
+ self.experts = nn.ModuleList([DeepseekMLP(config, intermediate_size = config.moe_intermediate_size) for i in range(config.n_routed_experts)])
369
+ self.gate = MoEGate(config)
370
+ if config.n_shared_experts is not None:
371
+ intermediate_size = config.moe_intermediate_size * config.n_shared_experts
372
+ self.shared_experts = DeepseekMLP(config=config, intermediate_size = intermediate_size)
373
+
374
+ def forward(self, hidden_states):
375
+ identity = hidden_states
376
+ orig_shape = hidden_states.shape
377
+ topk_idx, topk_weight, aux_loss = self.gate(hidden_states)
378
+ hidden_states = hidden_states.view(-1, hidden_states.shape[-1])
379
+ flat_topk_idx = topk_idx.view(-1)
380
+ if self.training:
381
+ hidden_states = hidden_states.repeat_interleave(self.num_experts_per_tok, dim=0)
382
+ y = torch.empty_like(hidden_states)
383
+ for i, expert in enumerate(self.experts):
384
+ y[flat_topk_idx == i] = expert(hidden_states[flat_topk_idx == i])
385
+ y = (y.view(*topk_weight.shape, -1) * topk_weight.unsqueeze(-1)).sum(dim=1)
386
+ y = y.view(*orig_shape)
387
+ y = AddAuxiliaryLoss.apply(y, aux_loss)
388
+ else:
389
+ y = self.moe_infer(hidden_states, flat_topk_idx, topk_weight.view(-1, 1)).view(*orig_shape)
390
+ if self.config.n_shared_experts is not None:
391
+ y = y + self.shared_experts(identity)
392
+ return y
393
+
394
+ @torch.no_grad()
395
+ def moe_infer(self, x, flat_expert_indices, flat_expert_weights):
396
+ expert_cache = torch.zeros_like(x)
397
+ idxs = flat_expert_indices.argsort()
398
+ tokens_per_expert = flat_expert_indices.bincount().cpu().numpy().cumsum(0)
399
+ token_idxs = idxs // self.num_experts_per_tok
400
+ for i, end_idx in enumerate(tokens_per_expert):
401
+ start_idx = 0 if i == 0 else tokens_per_expert[i-1]
402
+ if start_idx == end_idx:
403
+ continue
404
+ expert = self.experts[i]
405
+ exp_token_idx = token_idxs[start_idx:end_idx]
406
+ expert_tokens = x[exp_token_idx]
407
+ expert_out = expert(expert_tokens)
408
+ expert_out.mul_(flat_expert_weights[idxs[start_idx:end_idx]])
409
+ expert_cache.scatter_reduce_(0, exp_token_idx.view(-1, 1).repeat(1, x.shape[-1]), expert_out, reduce='sum')
410
+ return expert_cache
411
+
412
+
413
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv
414
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
415
+ """
416
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
417
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
418
+ """
419
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
420
+ if n_rep == 1:
421
+ return hidden_states
422
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
423
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
424
+
425
+
426
+ # Copied from transformers.models.llama.modeling_llama.LlamaAttention with Llama->Deepseek
427
+ class DeepseekAttention(nn.Module):
428
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
429
+
430
+ def __init__(self, config: DeepseekConfig, layer_idx: Optional[int] = None):
431
+ super().__init__()
432
+ self.config = config
433
+ self.layer_idx = layer_idx
434
+ if layer_idx is None:
435
+ logger.warning_once(
436
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
437
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
438
+ "when creating this class."
439
+ )
440
+
441
+ self.attention_dropout = config.attention_dropout
442
+ self.hidden_size = config.hidden_size
443
+ self.num_heads = config.num_attention_heads
444
+ self.head_dim = self.hidden_size // self.num_heads
445
+ self.num_key_value_heads = config.num_key_value_heads
446
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
447
+ self.max_position_embeddings = config.max_position_embeddings
448
+ self.rope_theta = config.rope_theta
449
+ self.is_causal = True
450
+
451
+ if (self.head_dim * self.num_heads) != self.hidden_size:
452
+ raise ValueError(
453
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
454
+ f" and `num_heads`: {self.num_heads})."
455
+ )
456
+
457
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
458
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
459
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
460
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
461
+ self._init_rope()
462
+
463
+ def _init_rope(self):
464
+ if self.config.rope_scaling is None:
465
+ self.rotary_emb = DeepseekRotaryEmbedding(
466
+ self.head_dim,
467
+ max_position_embeddings=self.max_position_embeddings,
468
+ base=self.rope_theta,
469
+ )
470
+ else:
471
+ scaling_type = self.config.rope_scaling["type"]
472
+ scaling_factor = self.config.rope_scaling["factor"]
473
+ if scaling_type == "linear":
474
+ self.rotary_emb = DeepseekLinearScalingRotaryEmbedding(
475
+ self.head_dim,
476
+ max_position_embeddings=self.max_position_embeddings,
477
+ scaling_factor=scaling_factor,
478
+ base=self.rope_theta,
479
+ )
480
+ elif scaling_type == "dynamic":
481
+ self.rotary_emb = DeepseekDynamicNTKScalingRotaryEmbedding(
482
+ self.head_dim,
483
+ max_position_embeddings=self.max_position_embeddings,
484
+ scaling_factor=scaling_factor,
485
+ base=self.rope_theta,
486
+ )
487
+ else:
488
+ raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
489
+
490
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
491
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
492
+
493
+ def forward(
494
+ self,
495
+ hidden_states: torch.Tensor,
496
+ attention_mask: Optional[torch.Tensor] = None,
497
+ position_ids: Optional[torch.LongTensor] = None,
498
+ past_key_value: Optional[Cache] = None,
499
+ output_attentions: bool = False,
500
+ use_cache: bool = False,
501
+ **kwargs,
502
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
503
+ if "padding_mask" in kwargs:
504
+ warnings.warn(
505
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
506
+ )
507
+
508
+ bsz, q_len, _ = hidden_states.size()
509
+
510
+ if self.config.pretraining_tp > 1:
511
+ key_value_slicing = (self.num_key_value_heads * self.head_dim) // self.config.pretraining_tp
512
+ query_slices = self.q_proj.weight.split(
513
+ (self.num_heads * self.head_dim) // self.config.pretraining_tp, dim=0
514
+ )
515
+ key_slices = self.k_proj.weight.split(key_value_slicing, dim=0)
516
+ value_slices = self.v_proj.weight.split(key_value_slicing, dim=0)
517
+
518
+ query_states = [F.linear(hidden_states, query_slices[i]) for i in range(self.config.pretraining_tp)]
519
+ query_states = torch.cat(query_states, dim=-1)
520
+
521
+ key_states = [F.linear(hidden_states, key_slices[i]) for i in range(self.config.pretraining_tp)]
522
+ key_states = torch.cat(key_states, dim=-1)
523
+
524
+ value_states = [F.linear(hidden_states, value_slices[i]) for i in range(self.config.pretraining_tp)]
525
+ value_states = torch.cat(value_states, dim=-1)
526
+
527
+ else:
528
+ query_states = self.q_proj(hidden_states)
529
+ key_states = self.k_proj(hidden_states)
530
+ value_states = self.v_proj(hidden_states)
531
+
532
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
533
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
534
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
535
+
536
+ kv_seq_len = key_states.shape[-2]
537
+ if past_key_value is not None:
538
+ if self.layer_idx is None:
539
+ raise ValueError(
540
+ f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
541
+ "for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
542
+ "with a layer index."
543
+ )
544
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
545
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
546
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
547
+
548
+ if past_key_value is not None:
549
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
550
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
551
+
552
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
553
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
554
+
555
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
556
+
557
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
558
+ raise ValueError(
559
+ f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
560
+ f" {attn_weights.size()}"
561
+ )
562
+
563
+ if attention_mask is not None:
564
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
565
+ raise ValueError(
566
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
567
+ )
568
+ attn_weights = attn_weights + attention_mask
569
+
570
+ # upcast attention to fp32
571
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
572
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
573
+ attn_output = torch.matmul(attn_weights, value_states)
574
+
575
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
576
+ raise ValueError(
577
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
578
+ f" {attn_output.size()}"
579
+ )
580
+
581
+ attn_output = attn_output.transpose(1, 2).contiguous()
582
+
583
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
584
+
585
+ if self.config.pretraining_tp > 1:
586
+ attn_output = attn_output.split(self.hidden_size // self.config.pretraining_tp, dim=2)
587
+ o_proj_slices = self.o_proj.weight.split(self.hidden_size // self.config.pretraining_tp, dim=1)
588
+ attn_output = sum([F.linear(attn_output[i], o_proj_slices[i]) for i in range(self.config.pretraining_tp)])
589
+ else:
590
+ attn_output = self.o_proj(attn_output)
591
+
592
+ if not output_attentions:
593
+ attn_weights = None
594
+
595
+ return attn_output, attn_weights, past_key_value
596
+
597
+
598
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2 with Llama->Deepseek
599
+ class DeepseekFlashAttention2(DeepseekAttention):
600
+ """
601
+ Deepseek flash attention module. This module inherits from `DeepseekAttention` as the weights of the module stays
602
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
603
+ flash attention and deal with padding tokens in case the input contains any of them.
604
+ """
605
+
606
+ def __init__(self, *args, **kwargs):
607
+ super().__init__(*args, **kwargs)
608
+
609
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
610
+ # 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.
611
+ # 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).
612
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
613
+
614
+ def forward(
615
+ self,
616
+ hidden_states: torch.Tensor,
617
+ attention_mask: Optional[torch.LongTensor] = None,
618
+ position_ids: Optional[torch.LongTensor] = None,
619
+ past_key_value: Optional[Cache] = None,
620
+ output_attentions: bool = False,
621
+ use_cache: bool = False,
622
+ **kwargs,
623
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
624
+ # DeepseekFlashAttention2 attention does not support output_attentions
625
+ if "padding_mask" in kwargs:
626
+ warnings.warn(
627
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
628
+ )
629
+
630
+ # overwrite attention_mask with padding_mask
631
+ attention_mask = kwargs.pop("padding_mask")
632
+
633
+ output_attentions = False
634
+
635
+ bsz, q_len, _ = hidden_states.size()
636
+
637
+ query_states = self.q_proj(hidden_states)
638
+ key_states = self.k_proj(hidden_states)
639
+ value_states = self.v_proj(hidden_states)
640
+
641
+ # Flash attention requires the input to have the shape
642
+ # batch_size x seq_length x head_dim x hidden_dim
643
+ # therefore we just need to keep the original shape
644
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
645
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
646
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
647
+
648
+ kv_seq_len = key_states.shape[-2]
649
+ if past_key_value is not None:
650
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
651
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
652
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
653
+
654
+ if past_key_value is not None:
655
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
656
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
657
+
658
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
659
+ # to be able to avoid many of these transpose/reshape/view.
660
+ query_states = query_states.transpose(1, 2)
661
+ key_states = key_states.transpose(1, 2)
662
+ value_states = value_states.transpose(1, 2)
663
+
664
+ dropout_rate = self.attention_dropout if self.training else 0.0
665
+
666
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
667
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
668
+ # cast them back in the correct dtype just to be sure everything works as expected.
669
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
670
+ # in fp32. (DeepseekRMSNorm handles it correctly)
671
+
672
+ input_dtype = query_states.dtype
673
+ if input_dtype == torch.float32:
674
+ # Handle the case where the model is quantized
675
+ if hasattr(self.config, "_pre_quantization_dtype"):
676
+ target_dtype = self.config._pre_quantization_dtype
677
+ elif torch.is_autocast_enabled():
678
+ target_dtype = torch.get_autocast_gpu_dtype()
679
+ else:
680
+ target_dtype = self.q_proj.weight.dtype
681
+
682
+ logger.warning_once(
683
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
684
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
685
+ f" {target_dtype}."
686
+ )
687
+
688
+ query_states = query_states.to(target_dtype)
689
+ key_states = key_states.to(target_dtype)
690
+ value_states = value_states.to(target_dtype)
691
+
692
+ attn_output = self._flash_attention_forward(
693
+ query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
694
+ )
695
+
696
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
697
+ attn_output = self.o_proj(attn_output)
698
+
699
+ if not output_attentions:
700
+ attn_weights = None
701
+
702
+ return attn_output, attn_weights, past_key_value
703
+
704
+ def _flash_attention_forward(
705
+ self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
706
+ ):
707
+ """
708
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
709
+ first unpad the input, then computes the attention scores and pad the final attention scores.
710
+ Args:
711
+ query_states (`torch.Tensor`):
712
+ Input query states to be passed to Flash Attention API
713
+ key_states (`torch.Tensor`):
714
+ Input key states to be passed to Flash Attention API
715
+ value_states (`torch.Tensor`):
716
+ Input value states to be passed to Flash Attention API
717
+ attention_mask (`torch.Tensor`):
718
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
719
+ position of padding tokens and 1 for the position of non-padding tokens.
720
+ dropout (`int`, *optional*):
721
+ Attention dropout
722
+ softmax_scale (`float`, *optional*):
723
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
724
+ """
725
+ if not self._flash_attn_uses_top_left_mask:
726
+ causal = self.is_causal
727
+ else:
728
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in DeepseekFlashAttention2 __init__.
729
+ causal = self.is_causal and query_length != 1
730
+
731
+ # Contains at least one padding token in the sequence
732
+ if attention_mask is not None:
733
+ batch_size = query_states.shape[0]
734
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
735
+ query_states, key_states, value_states, attention_mask, query_length
736
+ )
737
+
738
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
739
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
740
+
741
+ attn_output_unpad = flash_attn_varlen_func(
742
+ query_states,
743
+ key_states,
744
+ value_states,
745
+ cu_seqlens_q=cu_seqlens_q,
746
+ cu_seqlens_k=cu_seqlens_k,
747
+ max_seqlen_q=max_seqlen_in_batch_q,
748
+ max_seqlen_k=max_seqlen_in_batch_k,
749
+ dropout_p=dropout,
750
+ softmax_scale=softmax_scale,
751
+ causal=causal,
752
+ )
753
+
754
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
755
+ else:
756
+ attn_output = flash_attn_func(
757
+ query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
758
+ )
759
+
760
+ return attn_output
761
+
762
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
763
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
764
+ batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
765
+
766
+ key_layer = index_first_axis(
767
+ key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
768
+ )
769
+ value_layer = index_first_axis(
770
+ value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
771
+ )
772
+ if query_length == kv_seq_len:
773
+ query_layer = index_first_axis(
774
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
775
+ )
776
+ cu_seqlens_q = cu_seqlens_k
777
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
778
+ indices_q = indices_k
779
+ elif query_length == 1:
780
+ max_seqlen_in_batch_q = 1
781
+ cu_seqlens_q = torch.arange(
782
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
783
+ ) # There is a memcpy here, that is very bad.
784
+ indices_q = cu_seqlens_q[:-1]
785
+ query_layer = query_layer.squeeze(1)
786
+ else:
787
+ # The -q_len: slice assumes left padding.
788
+ attention_mask = attention_mask[:, -query_length:]
789
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
790
+
791
+ return (
792
+ query_layer,
793
+ key_layer,
794
+ value_layer,
795
+ indices_q,
796
+ (cu_seqlens_q, cu_seqlens_k),
797
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
798
+ )
799
+
800
+
801
+ # Copied from transformers.models.llama.modeling_llama.LlamaSdpaAttention with Llama->Deepseek
802
+ class DeepseekSdpaAttention(DeepseekAttention):
803
+ """
804
+ Deepseek attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
805
+ `DeepseekAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
806
+ SDPA API.
807
+ """
808
+
809
+ # Adapted from DeepseekAttention.forward
810
+ def forward(
811
+ self,
812
+ hidden_states: torch.Tensor,
813
+ attention_mask: Optional[torch.Tensor] = None,
814
+ position_ids: Optional[torch.LongTensor] = None,
815
+ past_key_value: Optional[Cache] = None,
816
+ output_attentions: bool = False,
817
+ use_cache: bool = False,
818
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
819
+ if output_attentions:
820
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
821
+ logger.warning_once(
822
+ "DeepseekModel is using DeepseekSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
823
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
824
+ )
825
+ return super().forward(
826
+ hidden_states=hidden_states,
827
+ attention_mask=attention_mask,
828
+ position_ids=position_ids,
829
+ past_key_value=past_key_value,
830
+ output_attentions=output_attentions,
831
+ use_cache=use_cache,
832
+ )
833
+
834
+ bsz, q_len, _ = hidden_states.size()
835
+
836
+ query_states = self.q_proj(hidden_states)
837
+ key_states = self.k_proj(hidden_states)
838
+ value_states = self.v_proj(hidden_states)
839
+
840
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
841
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
842
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
843
+
844
+ kv_seq_len = key_states.shape[-2]
845
+ if past_key_value is not None:
846
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
847
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
848
+
849
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
850
+
851
+ if past_key_value is not None:
852
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
853
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
854
+
855
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
856
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
857
+
858
+ if attention_mask is not None:
859
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
860
+ raise ValueError(
861
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
862
+ )
863
+
864
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
865
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
866
+ if query_states.device.type == "cuda" and attention_mask is not None:
867
+ query_states = query_states.contiguous()
868
+ key_states = key_states.contiguous()
869
+ value_states = value_states.contiguous()
870
+
871
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
872
+ query_states,
873
+ key_states,
874
+ value_states,
875
+ attn_mask=attention_mask,
876
+ dropout_p=self.attention_dropout if self.training else 0.0,
877
+ # The q_len > 1 is necessary to match with AttentionMaskConverter.to_causal_4d that does not create a causal mask in case q_len == 1.
878
+ is_causal=self.is_causal and attention_mask is None and q_len > 1,
879
+ )
880
+
881
+ attn_output = attn_output.transpose(1, 2).contiguous()
882
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
883
+
884
+ attn_output = self.o_proj(attn_output)
885
+
886
+ return attn_output, None, past_key_value
887
+
888
+
889
+ Deepseek_ATTENTION_CLASSES = {
890
+ "eager": DeepseekAttention,
891
+ "flash_attention_2": DeepseekFlashAttention2,
892
+ "sdpa": DeepseekSdpaAttention,
893
+ }
894
+
895
+
896
+ class DeepseekDecoderLayer(nn.Module):
897
+ def __init__(self, config: DeepseekConfig, layer_idx: int):
898
+ super().__init__()
899
+ self.hidden_size = config.hidden_size
900
+
901
+ self.self_attn = Deepseek_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx)
902
+
903
+ self.mlp = DeepseekMoE(config) if (config.n_routed_experts is not None and \
904
+ layer_idx >= config.first_k_dense_replace and layer_idx % config.moe_layer_freq == 0) \
905
+ else DeepseekMLP(config)
906
+ self.input_layernorm = DeepseekRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
907
+ self.post_attention_layernorm = DeepseekRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
908
+
909
+ def forward(
910
+ self,
911
+ hidden_states: torch.Tensor,
912
+ attention_mask: Optional[torch.Tensor] = None,
913
+ position_ids: Optional[torch.LongTensor] = None,
914
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
915
+ output_attentions: Optional[bool] = False,
916
+ use_cache: Optional[bool] = False,
917
+ **kwargs,
918
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
919
+ """
920
+ Args:
921
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
922
+ attention_mask (`torch.FloatTensor`, *optional*):
923
+ attention mask of size `(batch_size, sequence_length)` if flash attention is used or `(batch_size, 1,
924
+ query_sequence_length, key_sequence_length)` if default attention is used.
925
+ output_attentions (`bool`, *optional*):
926
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
927
+ returned tensors for more detail.
928
+ use_cache (`bool`, *optional*):
929
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
930
+ (see `past_key_values`).
931
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
932
+ """
933
+ if "padding_mask" in kwargs:
934
+ warnings.warn(
935
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
936
+ )
937
+ residual = hidden_states
938
+
939
+ hidden_states = self.input_layernorm(hidden_states)
940
+
941
+ # Self Attention
942
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
943
+ hidden_states=hidden_states,
944
+ attention_mask=attention_mask,
945
+ position_ids=position_ids,
946
+ past_key_value=past_key_value,
947
+ output_attentions=output_attentions,
948
+ use_cache=use_cache,
949
+ **kwargs,
950
+ )
951
+ hidden_states = residual + hidden_states
952
+
953
+ # Fully Connected
954
+ residual = hidden_states
955
+ hidden_states = self.post_attention_layernorm(hidden_states)
956
+ hidden_states = self.mlp(hidden_states)
957
+ hidden_states = residual + hidden_states
958
+
959
+ outputs = (hidden_states,)
960
+
961
+ if output_attentions:
962
+ outputs += (self_attn_weights,)
963
+
964
+ if use_cache:
965
+ outputs += (present_key_value,)
966
+
967
+ return outputs
968
+
969
+
970
+ Deepseek_START_DOCSTRING = r"""
971
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
972
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
973
+ etc.)
974
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
975
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
976
+ and behavior.
977
+ Parameters:
978
+ config ([`DeepseekConfig`]):
979
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
980
+ load the weights associated with the model, only the configuration. Check out the
981
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
982
+ """
983
+
984
+
985
+ @add_start_docstrings(
986
+ "The bare Deepseek Model outputting raw hidden-states without any specific head on top.",
987
+ Deepseek_START_DOCSTRING,
988
+ )
989
+ class DeepseekPreTrainedModel(PreTrainedModel):
990
+ config_class = DeepseekConfig
991
+ base_model_prefix = "model"
992
+ supports_gradient_checkpointing = True
993
+ _no_split_modules = ["DeepseekDecoderLayer"]
994
+ _skip_keys_device_placement = "past_key_values"
995
+ _supports_flash_attn_2 = True
996
+ _supports_sdpa = True
997
+ _supports_cache_class = True
998
+
999
+ def _init_weights(self, module):
1000
+ std = self.config.initializer_range
1001
+ if isinstance(module, nn.Linear):
1002
+ module.weight.data.normal_(mean=0.0, std=std)
1003
+ if module.bias is not None:
1004
+ module.bias.data.zero_()
1005
+ elif isinstance(module, nn.Embedding):
1006
+ module.weight.data.normal_(mean=0.0, std=std)
1007
+ if module.padding_idx is not None:
1008
+ module.weight.data[module.padding_idx].zero_()
1009
+
1010
+
1011
+ Deepseek_INPUTS_DOCSTRING = r"""
1012
+ Args:
1013
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
1014
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
1015
+ it.
1016
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
1017
+ [`PreTrainedTokenizer.__call__`] for details.
1018
+ [What are input IDs?](../glossary#input-ids)
1019
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
1020
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
1021
+ - 1 for tokens that are **not masked**,
1022
+ - 0 for tokens that are **masked**.
1023
+ [What are attention masks?](../glossary#attention-mask)
1024
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
1025
+ [`PreTrainedTokenizer.__call__`] for details.
1026
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
1027
+ `past_key_values`).
1028
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
1029
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
1030
+ information on the default strategy.
1031
+ - 1 indicates the head is **not masked**,
1032
+ - 0 indicates the head is **masked**.
1033
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1034
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
1035
+ config.n_positions - 1]`.
1036
+ [What are position IDs?](../glossary#position-ids)
1037
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
1038
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
1039
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
1040
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
1041
+ Two formats are allowed:
1042
+ - a [`~cache_utils.Cache`] instance;
1043
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
1044
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
1045
+ cache format.
1046
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
1047
+ legacy cache format will be returned.
1048
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
1049
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
1050
+ of shape `(batch_size, sequence_length)`.
1051
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
1052
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
1053
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
1054
+ model's internal embedding lookup matrix.
1055
+ use_cache (`bool`, *optional*):
1056
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
1057
+ `past_key_values`).
1058
+ output_attentions (`bool`, *optional*):
1059
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
1060
+ tensors for more detail.
1061
+ output_hidden_states (`bool`, *optional*):
1062
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
1063
+ more detail.
1064
+ return_dict (`bool`, *optional*):
1065
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
1066
+ """
1067
+
1068
+
1069
+ @add_start_docstrings(
1070
+ "The bare Deepseek Model outputting raw hidden-states without any specific head on top.",
1071
+ Deepseek_START_DOCSTRING,
1072
+ )
1073
+ class DeepseekModel(DeepseekPreTrainedModel):
1074
+ """
1075
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`DeepseekDecoderLayer`]
1076
+ Args:
1077
+ config: DeepseekConfig
1078
+ """
1079
+
1080
+ def __init__(self, config: DeepseekConfig):
1081
+ super().__init__(config)
1082
+ self.padding_idx = config.pad_token_id
1083
+ self.vocab_size = config.vocab_size
1084
+
1085
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
1086
+ self.layers = nn.ModuleList(
1087
+ [DeepseekDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
1088
+ )
1089
+ self._use_sdpa = config._attn_implementation == "sdpa"
1090
+ self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
1091
+ self.norm = DeepseekRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
1092
+
1093
+ self.gradient_checkpointing = False
1094
+ # Initialize weights and apply final processing
1095
+ self.post_init()
1096
+
1097
+ def get_input_embeddings(self):
1098
+ return self.embed_tokens
1099
+
1100
+ def set_input_embeddings(self, value):
1101
+ self.embed_tokens = value
1102
+
1103
+ @add_start_docstrings_to_model_forward(Deepseek_INPUTS_DOCSTRING)
1104
+ def forward(
1105
+ self,
1106
+ input_ids: torch.LongTensor = None,
1107
+ attention_mask: Optional[torch.Tensor] = None,
1108
+ position_ids: Optional[torch.LongTensor] = None,
1109
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1110
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1111
+ use_cache: Optional[bool] = None,
1112
+ output_attentions: Optional[bool] = None,
1113
+ output_hidden_states: Optional[bool] = None,
1114
+ return_dict: Optional[bool] = None,
1115
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
1116
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1117
+ output_hidden_states = (
1118
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1119
+ )
1120
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
1121
+
1122
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1123
+
1124
+ # retrieve input_ids and inputs_embeds
1125
+ if input_ids is not None and inputs_embeds is not None:
1126
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
1127
+ elif input_ids is not None:
1128
+ batch_size, seq_length = input_ids.shape[:2]
1129
+ elif inputs_embeds is not None:
1130
+ batch_size, seq_length = inputs_embeds.shape[:2]
1131
+ else:
1132
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
1133
+
1134
+ if self.gradient_checkpointing and self.training:
1135
+ if use_cache:
1136
+ logger.warning_once(
1137
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`transformers."
1138
+ )
1139
+ use_cache = False
1140
+
1141
+ past_key_values_length = 0
1142
+ if use_cache:
1143
+ use_legacy_cache = not isinstance(past_key_values, Cache)
1144
+ if use_legacy_cache:
1145
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
1146
+ past_key_values_length = past_key_values.get_usable_length(seq_length)
1147
+
1148
+ if position_ids is None:
1149
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
1150
+ position_ids = torch.arange(
1151
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
1152
+ )
1153
+ position_ids = position_ids.unsqueeze(0)
1154
+
1155
+ if inputs_embeds is None:
1156
+ inputs_embeds = self.embed_tokens(input_ids)
1157
+
1158
+ if self._use_flash_attention_2:
1159
+ # 2d mask is passed through the layers
1160
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
1161
+ elif self._use_sdpa and not output_attentions:
1162
+ # output_attentions=True can not be supported when using SDPA, and we fall back on
1163
+ # the manual implementation that requires a 4D causal mask in all cases.
1164
+ attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(
1165
+ attention_mask,
1166
+ (batch_size, seq_length),
1167
+ inputs_embeds,
1168
+ past_key_values_length,
1169
+ )
1170
+ else:
1171
+ # 4d mask is passed through the layers
1172
+ attention_mask = _prepare_4d_causal_attention_mask(
1173
+ attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length
1174
+ )
1175
+
1176
+ # embed positions
1177
+ hidden_states = inputs_embeds
1178
+
1179
+ # decoder layers
1180
+ all_hidden_states = () if output_hidden_states else None
1181
+ all_self_attns = () if output_attentions else None
1182
+ next_decoder_cache = None
1183
+
1184
+ for decoder_layer in self.layers:
1185
+ if output_hidden_states:
1186
+ all_hidden_states += (hidden_states,)
1187
+
1188
+ if self.gradient_checkpointing and self.training:
1189
+ layer_outputs = self._gradient_checkpointing_func(
1190
+ decoder_layer.__call__,
1191
+ hidden_states,
1192
+ attention_mask,
1193
+ position_ids,
1194
+ past_key_values,
1195
+ output_attentions,
1196
+ use_cache,
1197
+ )
1198
+ else:
1199
+ layer_outputs = decoder_layer(
1200
+ hidden_states,
1201
+ attention_mask=attention_mask,
1202
+ position_ids=position_ids,
1203
+ past_key_value=past_key_values,
1204
+ output_attentions=output_attentions,
1205
+ use_cache=use_cache,
1206
+ )
1207
+
1208
+ hidden_states = layer_outputs[0]
1209
+
1210
+ if use_cache:
1211
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1212
+
1213
+ if output_attentions:
1214
+ all_self_attns += (layer_outputs[1],)
1215
+
1216
+ hidden_states = self.norm(hidden_states)
1217
+
1218
+ # add hidden states from the last decoder layer
1219
+ if output_hidden_states:
1220
+ all_hidden_states += (hidden_states,)
1221
+
1222
+ next_cache = None
1223
+ if use_cache:
1224
+ next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
1225
+ if not return_dict:
1226
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
1227
+ return BaseModelOutputWithPast(
1228
+ last_hidden_state=hidden_states,
1229
+ past_key_values=next_cache,
1230
+ hidden_states=all_hidden_states,
1231
+ attentions=all_self_attns,
1232
+ )
1233
+
1234
+
1235
+ class DeepseekForCausalLM(DeepseekPreTrainedModel):
1236
+ _tied_weights_keys = ["lm_head.weight"]
1237
+
1238
+ def __init__(self, config):
1239
+ super().__init__(config)
1240
+ self.model = DeepseekModel(config)
1241
+ self.vocab_size = config.vocab_size
1242
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1243
+
1244
+ # Initialize weights and apply final processing
1245
+ self.post_init()
1246
+
1247
+ def get_input_embeddings(self):
1248
+ return self.model.embed_tokens
1249
+
1250
+ def set_input_embeddings(self, value):
1251
+ self.model.embed_tokens = value
1252
+
1253
+ def get_output_embeddings(self):
1254
+ return self.lm_head
1255
+
1256
+ def set_output_embeddings(self, new_embeddings):
1257
+ self.lm_head = new_embeddings
1258
+
1259
+ def set_decoder(self, decoder):
1260
+ self.model = decoder
1261
+
1262
+ def get_decoder(self):
1263
+ return self.model
1264
+
1265
+ @add_start_docstrings_to_model_forward(Deepseek_INPUTS_DOCSTRING)
1266
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1267
+ def forward(
1268
+ self,
1269
+ input_ids: torch.LongTensor = None,
1270
+ attention_mask: Optional[torch.Tensor] = None,
1271
+ position_ids: Optional[torch.LongTensor] = None,
1272
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1273
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1274
+ labels: Optional[torch.LongTensor] = None,
1275
+ use_cache: Optional[bool] = None,
1276
+ output_attentions: Optional[bool] = None,
1277
+ output_hidden_states: Optional[bool] = None,
1278
+ return_dict: Optional[bool] = None,
1279
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1280
+ r"""
1281
+ Args:
1282
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1283
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, transformers.,
1284
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1285
+ (masked), the loss is only computed for the tokens with labels in `[0, transformers., config.vocab_size]`.
1286
+ Returns:
1287
+ Example:
1288
+ ```python
1289
+ >>> from transformers import AutoTokenizer, DeepseekForCausalLM
1290
+ >>> model = DeepseekForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
1291
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
1292
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1293
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1294
+ >>> # Generate
1295
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1296
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1297
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1298
+ ```"""
1299
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1300
+ output_hidden_states = (
1301
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1302
+ )
1303
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1304
+
1305
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1306
+ outputs = self.model(
1307
+ input_ids=input_ids,
1308
+ attention_mask=attention_mask,
1309
+ position_ids=position_ids,
1310
+ past_key_values=past_key_values,
1311
+ inputs_embeds=inputs_embeds,
1312
+ use_cache=use_cache,
1313
+ output_attentions=output_attentions,
1314
+ output_hidden_states=output_hidden_states,
1315
+ return_dict=return_dict,
1316
+ )
1317
+
1318
+ hidden_states = outputs[0]
1319
+ if self.config.pretraining_tp > 1:
1320
+ lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
1321
+ logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
1322
+ logits = torch.cat(logits, dim=-1)
1323
+ else:
1324
+ logits = self.lm_head(hidden_states)
1325
+ logits = logits.float()
1326
+
1327
+ loss = None
1328
+ if labels is not None:
1329
+ # Shift so that tokens < n predict n
1330
+ shift_logits = logits[..., :-1, :].contiguous()
1331
+ shift_labels = labels[..., 1:].contiguous()
1332
+ # Flatten the tokens
1333
+ loss_fct = CrossEntropyLoss()
1334
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1335
+ shift_labels = shift_labels.view(-1)
1336
+ # Enable model parallelism
1337
+ shift_labels = shift_labels.to(shift_logits.device)
1338
+ loss = loss_fct(shift_logits, shift_labels)
1339
+
1340
+ if not return_dict:
1341
+ output = (logits,) + outputs[1:]
1342
+ return (loss,) + output if loss is not None else output
1343
+
1344
+ return CausalLMOutputWithPast(
1345
+ loss=loss,
1346
+ logits=logits,
1347
+ past_key_values=outputs.past_key_values,
1348
+ hidden_states=outputs.hidden_states,
1349
+ attentions=outputs.attentions,
1350
+ )
1351
+
1352
+ def prepare_inputs_for_generation(
1353
+ self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
1354
+ ):
1355
+ if past_key_values is not None:
1356
+ if isinstance(past_key_values, Cache):
1357
+ cache_length = past_key_values.get_seq_length()
1358
+ past_length = past_key_values.seen_tokens
1359
+ max_cache_length = past_key_values.get_max_length()
1360
+ else:
1361
+ cache_length = past_length = past_key_values[0][0].shape[2]
1362
+ max_cache_length = None
1363
+
1364
+ # Keep only the unprocessed tokens:
1365
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
1366
+ # some of the inputs are exclusivelly passed as part of the cache (e.g. when passing input_embeds as
1367
+ # input)
1368
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
1369
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
1370
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
1371
+ # input_ids based on the past_length.
1372
+ elif past_length < input_ids.shape[1]:
1373
+ input_ids = input_ids[:, past_length:]
1374
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
1375
+
1376
+ # If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
1377
+ if (
1378
+ max_cache_length is not None
1379
+ and attention_mask is not None
1380
+ and cache_length + input_ids.shape[1] > max_cache_length
1381
+ ):
1382
+ attention_mask = attention_mask[:, -max_cache_length:]
1383
+
1384
+ position_ids = kwargs.get("position_ids", None)
1385
+ if attention_mask is not None and position_ids is None:
1386
+ # create position_ids on the fly for batch generation
1387
+ position_ids = attention_mask.long().cumsum(-1) - 1
1388
+ position_ids.masked_fill_(attention_mask == 0, 1)
1389
+ if past_key_values:
1390
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1391
+
1392
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1393
+ if inputs_embeds is not None and past_key_values is None:
1394
+ model_inputs = {"inputs_embeds": inputs_embeds}
1395
+ else:
1396
+ model_inputs = {"input_ids": input_ids}
1397
+
1398
+ model_inputs.update(
1399
+ {
1400
+ "position_ids": position_ids,
1401
+ "past_key_values": past_key_values,
1402
+ "use_cache": kwargs.get("use_cache"),
1403
+ "attention_mask": attention_mask,
1404
+ }
1405
+ )
1406
+ return model_inputs
1407
+
1408
+ @staticmethod
1409
+ def _reorder_cache(past_key_values, beam_idx):
1410
+ reordered_past = ()
1411
+ for layer_past in past_key_values:
1412
+ reordered_past += (
1413
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
1414
+ )
1415
+ return reordered_past
1416
+
1417
+
1418
+ @add_start_docstrings(
1419
+ """
1420
+ The Deepseek Model transformer with a sequence classification head on top (linear layer).
1421
+ [`DeepseekForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1422
+ (e.g. GPT-2) do.
1423
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1424
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1425
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1426
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1427
+ each row of the batch).
1428
+ """,
1429
+ Deepseek_START_DOCSTRING,
1430
+ )
1431
+ class DeepseekForSequenceClassification(DeepseekPreTrainedModel):
1432
+ def __init__(self, config):
1433
+ super().__init__(config)
1434
+ self.num_labels = config.num_labels
1435
+ self.model = DeepseekModel(config)
1436
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1437
+
1438
+ # Initialize weights and apply final processing
1439
+ self.post_init()
1440
+
1441
+ def get_input_embeddings(self):
1442
+ return self.model.embed_tokens
1443
+
1444
+ def set_input_embeddings(self, value):
1445
+ self.model.embed_tokens = value
1446
+
1447
+ @add_start_docstrings_to_model_forward(Deepseek_INPUTS_DOCSTRING)
1448
+ def forward(
1449
+ self,
1450
+ input_ids: torch.LongTensor = None,
1451
+ attention_mask: Optional[torch.Tensor] = None,
1452
+ position_ids: Optional[torch.LongTensor] = None,
1453
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1454
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1455
+ labels: Optional[torch.LongTensor] = None,
1456
+ use_cache: Optional[bool] = None,
1457
+ output_attentions: Optional[bool] = None,
1458
+ output_hidden_states: Optional[bool] = None,
1459
+ return_dict: Optional[bool] = None,
1460
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1461
+ r"""
1462
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1463
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, transformers.,
1464
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1465
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1466
+ """
1467
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1468
+
1469
+ transformer_outputs = self.model(
1470
+ input_ids,
1471
+ attention_mask=attention_mask,
1472
+ position_ids=position_ids,
1473
+ past_key_values=past_key_values,
1474
+ inputs_embeds=inputs_embeds,
1475
+ use_cache=use_cache,
1476
+ output_attentions=output_attentions,
1477
+ output_hidden_states=output_hidden_states,
1478
+ return_dict=return_dict,
1479
+ )
1480
+ hidden_states = transformer_outputs[0]
1481
+ logits = self.score(hidden_states)
1482
+
1483
+ if input_ids is not None:
1484
+ batch_size = input_ids.shape[0]
1485
+ else:
1486
+ batch_size = inputs_embeds.shape[0]
1487
+
1488
+ if self.config.pad_token_id is None and batch_size != 1:
1489
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1490
+ if self.config.pad_token_id is None:
1491
+ sequence_lengths = -1
1492
+ else:
1493
+ if input_ids is not None:
1494
+ sequence_lengths = (torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1).to(
1495
+ logits.device
1496
+ )
1497
+ else:
1498
+ sequence_lengths = -1
1499
+
1500
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1501
+
1502
+ loss = None
1503
+ if labels is not None:
1504
+ labels = labels.to(logits.device)
1505
+ if self.config.problem_type is None:
1506
+ if self.num_labels == 1:
1507
+ self.config.problem_type = "regression"
1508
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1509
+ self.config.problem_type = "single_label_classification"
1510
+ else:
1511
+ self.config.problem_type = "multi_label_classification"
1512
+
1513
+ if self.config.problem_type == "regression":
1514
+ loss_fct = MSELoss()
1515
+ if self.num_labels == 1:
1516
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1517
+ else:
1518
+ loss = loss_fct(pooled_logits, labels)
1519
+ elif self.config.problem_type == "single_label_classification":
1520
+ loss_fct = CrossEntropyLoss()
1521
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1522
+ elif self.config.problem_type == "multi_label_classification":
1523
+ loss_fct = BCEWithLogitsLoss()
1524
+ loss = loss_fct(pooled_logits, labels)
1525
+ if not return_dict:
1526
+ output = (pooled_logits,) + transformer_outputs[1:]
1527
+ return ((loss,) + output) if loss is not None else output
1528
+
1529
+ return SequenceClassifierOutputWithPast(
1530
+ loss=loss,
1531
+ logits=pooled_logits,
1532
+ past_key_values=transformer_outputs.past_key_values,
1533
+ hidden_states=transformer_outputs.hidden_states,
1534
+ attentions=transformer_outputs.attentions,
1535
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ },
30
+ "additional_special_tokens": [],
31
+ "bos_token": "<s>",
32
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}",
33
+ "clean_up_tokenization_spaces": false,
34
+ "eos_token": "</s>",
35
+ "legacy": true,
36
+ "model_max_length": 1000000000000000019884624838656,
37
+ "pad_token": null,
38
+ "sp_model_kwargs": {},
39
+ "spaces_between_special_tokens": false,
40
+ "tokenizer_class": "LlamaTokenizer",
41
+ "unk_token": "<unk>",
42
+ "use_default_system_prompt": false
43
+ }