Daniel Hesslow commited on
Commit
e7950c4
1 Parent(s): faeeeb3

Upload RWForCausalLM

Browse files
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alibi": false,
3
+ "apply_residual_connection_post_layernorm": false,
4
+ "architectures": [
5
+ "RWForCausalLM"
6
+ ],
7
+ "attention_dropout": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_RW.RWConfig",
10
+ "AutoModelForCausalLM": "modelling_RW.RWForCausalLM"
11
+ },
12
+ "bias": false,
13
+ "bos_token_id": 1,
14
+ "eos_token_id": 2,
15
+ "hidden_dropout": 0.0,
16
+ "hidden_size": 8192,
17
+ "initializer_range": 0.02,
18
+ "layer_norm_epsilon": 1e-05,
19
+ "model_type": "RefinedWeb",
20
+ "n_head": 128,
21
+ "n_head_kv": 8,
22
+ "n_layer": 60,
23
+ "parallel_attn": true,
24
+ "torch_dtype": "bfloat16",
25
+ "transformers_version": "4.27.4",
26
+ "use_cache": true,
27
+ "vocab_size": 65024
28
+ }
configuration_RW.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 the Big Science Workshop and HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """ Bloom configuration"""
16
+ from transformers.configuration_utils import PretrainedConfig
17
+ from transformers.utils import logging
18
+
19
+
20
+ logger = logging.get_logger(__name__)
21
+
22
+
23
+ class RWConfig(PretrainedConfig):
24
+ model_type = "RefinedWeb"
25
+ keys_to_ignore_at_inference = ["past_key_values"]
26
+ attribute_map = {
27
+ "num_hidden_layers": "n_layer",
28
+ "num_attention_heads": "n_head",
29
+ }
30
+
31
+ def __init__(
32
+ self,
33
+ vocab_size=250880,
34
+ hidden_size=64,
35
+ n_layer=2,
36
+ n_head=8,
37
+ layer_norm_epsilon=1e-5,
38
+ initializer_range=0.02,
39
+ use_cache=True,
40
+ bos_token_id=1,
41
+ eos_token_id=2,
42
+ apply_residual_connection_post_layernorm=False,
43
+ hidden_dropout=0.0,
44
+ attention_dropout=0.0,
45
+ n_head_kv=None,
46
+ alibi=False,
47
+ **kwargs,
48
+ ):
49
+ self.vocab_size = vocab_size
50
+ # Backward compatibility with n_embed kwarg
51
+ n_embed = kwargs.pop("n_embed", None)
52
+ self.hidden_size = hidden_size if n_embed is None else n_embed
53
+ self.n_layer = n_layer
54
+ self.n_head = n_head
55
+ self.layer_norm_epsilon = layer_norm_epsilon
56
+ self.initializer_range = initializer_range
57
+ self.use_cache = use_cache
58
+ self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm
59
+ self.hidden_dropout = hidden_dropout
60
+ self.attention_dropout = attention_dropout
61
+
62
+ self.bos_token_id = bos_token_id
63
+ self.eos_token_id = eos_token_id
64
+ self.n_head_kv = n_head if n_head_kv is None else n_head_kv
65
+ self.alibi = alibi
66
+
67
+ super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, **kwargs)
68
+
69
+ @property
70
+ def head_dim(self):
71
+ return self.hidden_size // self.n_head
72
+
73
+ @property
74
+ def rotary(self):
75
+ return not self.alibi
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.27.4"
6
+ }
modelling_RW.py ADDED
@@ -0,0 +1,1111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # port of models described in RW
2
+ # We use the bloom model as a starting point for these model.
3
+ # Please refer to the bloom models for usage instructions.
4
+
5
+ import math
6
+ import warnings
7
+ from typing import Optional, Tuple, Union
8
+
9
+ import torch
10
+ import torch.utils.checkpoint
11
+ from torch import nn
12
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
13
+ from torch.nn import functional as F
14
+
15
+ from transformers.modeling_outputs import (
16
+ BaseModelOutputWithPastAndCrossAttentions,
17
+ CausalLMOutputWithCrossAttentions,
18
+ QuestionAnsweringModelOutput,
19
+ SequenceClassifierOutputWithPast,
20
+ TokenClassifierOutput,
21
+ )
22
+ from transformers.modeling_utils import PreTrainedModel
23
+ from transformers.utils import logging
24
+ from configuration_RW import RWConfig
25
+
26
+ logger = logging.get_logger(__name__)
27
+
28
+ # NOTE(Hesslow): Unfortunately we did not fuse matmul and bias during training, this means that there's one additional quantization to bfloat16 between the operations.
29
+ # In order not to degrade the quality of our HF-port, we keep these characteristics in the final model.
30
+ class Linear(nn.Linear):
31
+ def forward(self, input: torch.Tensor) -> torch.Tensor:
32
+ ret = input @ self.weight.T
33
+ if self.bias is None:
34
+ return ret
35
+ else:
36
+ return ret + self.bias
37
+
38
+
39
+ from einops import rearrange
40
+
41
+ # rotary pos emb helpers (torch.jit.script does not seem to support staticmethod...)
42
+ def rotate_half(x):
43
+ x1, x2 = x[..., : x.shape[-1] // 2], x[..., x.shape[-1] // 2 :]
44
+ return torch.cat((-x2, x1), dim=x1.ndim - 1) # dim=-1 triggers a bug in torch < 1.8.0
45
+
46
+
47
+ class RotaryEmbedding(torch.nn.Module):
48
+ """Implementation of RotaryEmbedding from GPT-NeoX.
49
+ This implementation is design to operate on queries and keys that are compatible with
50
+ [batch_size, n_heads_per_partition, seq_len, head_dim] (e.g. MinGPTAttention format).
51
+ """
52
+
53
+ def __init__(
54
+ self,
55
+ head_dim: int,
56
+ base=10000,
57
+ ):
58
+ super().__init__()
59
+ inv_freq = 1.0 / (base ** (torch.arange(0, head_dim, 2).float() / head_dim))
60
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
61
+ self.head_dim = head_dim
62
+ self.seq_len_cached = None
63
+ self.batch_size_cached = None
64
+ self.cos_cached: torch.Tensor | None = None
65
+ self.sin_cached: torch.Tensor | None = None
66
+
67
+ def cos_sin(
68
+ self,
69
+ seq_len: int,
70
+ device="cuda",
71
+ dtype=torch.bfloat16,
72
+ ) -> torch.Tensor:
73
+ if seq_len != self.seq_len_cached:
74
+ self.seq_len_cached = seq_len
75
+ t = torch.arange(seq_len, device=device).type_as(self.inv_freq)
76
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
77
+ emb = torch.cat((freqs, freqs), dim=-1).to(device)
78
+
79
+ if dtype in [torch.float16, torch.bfloat16]:
80
+ emb = emb.float()
81
+
82
+ self.cos_cached = emb.cos()[None, :, :]
83
+ self.sin_cached = emb.sin()[None, :, :]
84
+
85
+ self.cos_cached = self.cos_cached.type(dtype)
86
+ self.sin_cached = self.sin_cached.type(dtype)
87
+
88
+ return self.cos_cached, self.sin_cached
89
+
90
+ def forward(self, q, k):
91
+ batch, seq_len, head_dim = q.shape
92
+ cos, sin = self.cos_sin(seq_len, q.device)
93
+ return (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
94
+
95
+
96
+ def _make_causal_mask(
97
+ input_ids_shape: torch.Size, device: torch.device, past_key_values_length: int
98
+ ) -> torch.BoolTensor:
99
+ batch_size, target_length = input_ids_shape
100
+ mask = torch.empty((target_length, target_length + past_key_values_length), dtype=torch.bool, device=device)
101
+ # ONNX doesn't support `torch.Tensor.triu` properly, thus we use this workaround
102
+ seq_ids = torch.arange(target_length, device=device)
103
+ mask[:, past_key_values_length:] = seq_ids[:, None] < seq_ids[None, :]
104
+
105
+ if past_key_values_length > 0:
106
+ mask[:, :past_key_values_length] = False
107
+
108
+ expanded_mask = mask[None, None, :, :].expand(batch_size, 1, target_length, target_length + past_key_values_length)
109
+ return expanded_mask
110
+
111
+
112
+ def _expand_mask(mask: torch.Tensor, tgt_length: int) -> torch.BoolTensor:
113
+ batch_size, src_length = mask.shape
114
+ tgt_length = tgt_length if tgt_length is not None else src_length
115
+
116
+ expanded_mask = ~(mask[:, None, None, :].to(torch.bool))
117
+ return expanded_mask.expand(batch_size, 1, tgt_length, src_length)
118
+
119
+
120
+ def build_alibi_tensor(attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype) -> torch.Tensor:
121
+ batch_size, seq_length = attention_mask.shape
122
+ closest_power_of_2 = 2 ** math.floor(math.log2(num_heads))
123
+ base = torch.tensor(
124
+ 2 ** (-(2 ** -(math.log2(closest_power_of_2) - 3))), device=attention_mask.device, dtype=torch.float32
125
+ )
126
+ powers = torch.arange(1, 1 + closest_power_of_2, device=attention_mask.device, dtype=torch.int32)
127
+ slopes = torch.pow(base, powers)
128
+
129
+ if closest_power_of_2 != num_heads:
130
+ extra_base = torch.tensor(
131
+ 2 ** (-(2 ** -(math.log2(2 * closest_power_of_2) - 3))), device=attention_mask.device, dtype=torch.float32
132
+ )
133
+ num_remaining_heads = min(closest_power_of_2, num_heads - closest_power_of_2)
134
+ extra_powers = torch.arange(1, 1 + 2 * num_remaining_heads, 2, device=attention_mask.device, dtype=torch.int32)
135
+ slopes = torch.cat([slopes, torch.pow(extra_base, extra_powers)], dim=0)
136
+
137
+ # Note: alibi will added to the attention bias that will be applied to the query, key product of attention
138
+ # => therefore alibi will have to be of shape (batch_size, num_heads, query_length, key_length)
139
+ # => here we set (batch_size=1, num_heads=num_heads, query_length=1, key_length=max_length)
140
+ # => the query_length dimension will then be broadcasted correctly
141
+ # This is more or less identical to T5's relative position bias:
142
+ # https://github.com/huggingface/transformers/blob/f681437203baa7671de3174b0fa583c349d9d5e1/src/transformers/models/t5/modeling_t5.py#L527
143
+ arange_tensor = ((attention_mask.cumsum(dim=-1) - 1) * attention_mask)[:, None, :]
144
+ alibi = slopes[..., None].bfloat16() * arange_tensor
145
+ return alibi.reshape(batch_size * num_heads, 1, seq_length).to(dtype)
146
+
147
+
148
+ def dropout_add(x: torch.Tensor, residual: torch.Tensor, prob: float, training: bool) -> torch.Tensor:
149
+ out = F.dropout(x, p=prob, training=training)
150
+ out = residual + out
151
+ return out
152
+
153
+
154
+ class Attention(nn.Module):
155
+ def __init__(self, config: RWConfig):
156
+ super().__init__()
157
+
158
+ self.hidden_size = config.hidden_size
159
+ self.num_heads = config.n_head
160
+ self.head_dim = self.hidden_size // self.num_heads
161
+ self.split_size = self.hidden_size
162
+ self.hidden_dropout = config.hidden_dropout
163
+
164
+ if self.head_dim * self.num_heads != self.hidden_size:
165
+ raise ValueError(
166
+ f"`hidden_size` must be divisible by num_heads (got `hidden_size`: {self.hidden_size} and `num_heads`:"
167
+ f" {self.num_heads})."
168
+ )
169
+
170
+ self.maybe_rotary = RotaryEmbedding(config.head_dim) if config.rotary else lambda q, k: (q, k)
171
+
172
+ # Layer-wise attention scaling
173
+ self.inv_norm_factor = 1.0 / math.sqrt(self.head_dim)
174
+ self.beta = self.inv_norm_factor
175
+
176
+ self.query_key_value = Linear(
177
+ self.hidden_size,
178
+ (config.n_head_kv * 2 + config.n_head) * self.head_dim,
179
+ bias=config.bias,
180
+ )
181
+ self.dense = Linear(self.hidden_size, self.hidden_size, bias=config.bias)
182
+ self.attention_dropout = nn.Dropout(config.attention_dropout)
183
+ self.num_kv = config.n_head_kv
184
+
185
+ def _split_heads(self, fused_qkv: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
186
+ """
187
+ Split the last dimension into (num_heads, head_dim), results share same memory
188
+ storage as `fused_qkv`
189
+
190
+ Args:
191
+ fused_qkv (`torch.tensor`, *required*): [batch_size, seq_length, num_heads * 3 * head_dim]
192
+
193
+ Returns:
194
+ query: [batch_size, seq_length, num_heads, head_dim]
195
+ key: [batch_size, seq_length, num_heads, head_dim]
196
+ value: [batch_size, seq_length, num_heads, head_dim]
197
+ """
198
+ batch, seq_len, _ = fused_qkv.shape
199
+ qkv = fused_qkv.view(batch, seq_len, -1, self.num_heads // self.num_kv + 2, 64)
200
+ q = qkv[:, :, :, :-2]
201
+ k = qkv[:, :, :, [-2]]
202
+ v = qkv[:, :, :, [-1]]
203
+ k = torch.broadcast_to(k, q.shape)
204
+ v = torch.broadcast_to(v, q.shape)
205
+
206
+ q, k, v = [
207
+ rearrange(
208
+ x,
209
+ "batch seq_len group num_heads head_dim ->\
210
+ batch seq_len (group num_heads) head_dim",
211
+ head_dim=self.head_dim,
212
+ )
213
+ for x in [q, k, v]
214
+ ]
215
+ return q, k, v
216
+
217
+ def _merge_heads(self, x: torch.Tensor) -> torch.Tensor:
218
+ """
219
+ Merge heads together over the last dimenstion
220
+
221
+ Args:
222
+ x: (`torch.tensor`, *required*): [batch_size * num_heads, seq_length, head_dim]
223
+
224
+ Returns:
225
+ torch.tensor: [batch_size, seq_length, num_heads * head_dim]
226
+ """
227
+ # What we want to achieve is:
228
+ # batch_size * num_heads, seq_length, head_dim -> batch_size, seq_length, num_heads * head_dim
229
+ batch_size_and_num_heads, seq_length, _ = x.shape
230
+ batch_size = batch_size_and_num_heads // self.num_heads
231
+
232
+ # First view to decompose the batch size
233
+ # batch_size * num_heads, seq_length, head_dim -> batch_size, num_heads, seq_length, head_dim
234
+ x = x.view(batch_size, self.num_heads, seq_length, self.head_dim)
235
+
236
+ # batch_size, num_heads, seq_length, head_dim -> batch_size, seq_length, num_heads, head_dim
237
+ x = x.permute(0, 2, 1, 3)
238
+
239
+ # batch_size, seq_length, num_heads, head_dim -> batch_size, seq_length, num_heads * head_dim
240
+ return x.reshape(batch_size, seq_length, self.num_heads * self.head_dim)
241
+
242
+ def forward(
243
+ self,
244
+ hidden_states: torch.Tensor,
245
+ alibi: torch.Tensor,
246
+ attention_mask: torch.Tensor,
247
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
248
+ head_mask: Optional[torch.Tensor] = None,
249
+ use_cache: bool = False,
250
+ output_attentions: bool = False,
251
+ ):
252
+ fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
253
+
254
+ # 3 x [batch_size, seq_length, num_heads, head_dim]
255
+ (query_layer, key_layer, value_layer) = self._split_heads(fused_qkv)
256
+
257
+ batch_size, q_length, _, _ = query_layer.shape
258
+
259
+ query_layer = query_layer.transpose(1, 2).reshape(batch_size * self.num_heads, q_length, self.head_dim)
260
+ key_layer = key_layer.transpose(1, 2).reshape(
261
+ batch_size * self.num_heads,
262
+ q_length,
263
+ self.head_dim,
264
+ )
265
+ value_layer = value_layer.transpose(1, 2).reshape(batch_size * self.num_heads, q_length, self.head_dim)
266
+
267
+ query_layer, key_layer = self.maybe_rotary(query_layer, key_layer)
268
+
269
+ if layer_past is not None:
270
+ past_key, past_value = layer_past
271
+ # concatenate along seq_length dimension:
272
+ # - key: [batch_size * self.num_heads, head_dim, kv_length]
273
+ # - value: [batch_size * self.num_heads, kv_length, head_dim]
274
+ key_layer = torch.cat((past_key, key_layer), dim=1)
275
+ value_layer = torch.cat((past_value, value_layer), dim=1)
276
+
277
+ _, kv_length, _ = key_layer.shape
278
+
279
+ if use_cache is True:
280
+ present = (key_layer, value_layer)
281
+ else:
282
+ present = None
283
+
284
+ if alibi is None:
285
+ query_layer_ = query_layer.reshape(batch_size, self.num_heads, -1, self.head_dim)
286
+ key_layer_ = key_layer.reshape(batch_size, self.num_heads, -1, self.head_dim)
287
+ value_layer_ = value_layer.reshape(batch_size, self.num_heads, -1, self.head_dim)
288
+
289
+ attn_output = F.scaled_dot_product_attention(
290
+ query_layer_, key_layer_, value_layer_, None, 0.0, is_causal=True
291
+ )
292
+
293
+ x = attn_output.view(batch_size, self.num_heads, q_length, self.head_dim)
294
+ x = x.permute(0, 2, 1, 3)
295
+ attn_output = x.reshape(batch_size, q_length, self.num_heads * self.head_dim)
296
+
297
+ output_tensor = self.dense(attn_output)
298
+
299
+ outputs = (output_tensor, present)
300
+ assert not output_attentions # not supported.
301
+ return outputs
302
+ else:
303
+ attention_mask_float = (attention_mask * 1.0).masked_fill(attention_mask, -1e9).to(torch.bfloat16)
304
+ matmul_result = query_layer @ key_layer.transpose(-1, -2)
305
+
306
+ # change view to [batch_size, num_heads, q_length, kv_length]
307
+ attention_scores = matmul_result.view(batch_size, self.num_heads, q_length, kv_length)
308
+
309
+ # cast attention scores to fp32, compute scaled softmax and cast back to initial dtype - [batch_size, num_heads, q_length, kv_length]
310
+ input_dtype = attention_scores.dtype
311
+ # `float16` has a minimum value of -65504.0, whereas `bfloat16` and `float32` have a minimum value of `-3.4e+38`
312
+ if input_dtype == torch.float16 or input_dtype == torch.bfloat16:
313
+ attention_scores = attention_scores.to(torch.float32)
314
+ # attn_weights = torch.masked_fill(attention_scores, attention_mask, torch.finfo(attention_scores.dtype).min)
315
+ attention_probs = F.softmax(
316
+ (attention_scores + alibi.view(batch_size, self.num_heads, 1, -1)) * self.inv_norm_factor
317
+ + attention_mask_float,
318
+ dim=-1,
319
+ dtype=hidden_states.dtype,
320
+ )
321
+ # [batch_size, num_heads, q_length, kv_length]
322
+ attention_probs = self.attention_dropout(attention_probs)
323
+
324
+ if head_mask is not None:
325
+ attention_probs = attention_probs * head_mask
326
+
327
+ # change view [batch_size x num_heads, q_length, kv_length]
328
+ attention_probs_reshaped = attention_probs.view(batch_size * self.num_heads, q_length, kv_length)
329
+
330
+ # matmul: [batch_size * num_heads, q_length, head_dim]
331
+ context_layer = attention_probs_reshaped @ value_layer
332
+
333
+ # change view [batch_size, num_heads, q_length, head_dim]
334
+ context_layer = self._merge_heads(context_layer)
335
+
336
+ output_tensor = self.dense(context_layer)
337
+
338
+ outputs = (output_tensor, present)
339
+ if output_attentions:
340
+ outputs += (attention_probs,)
341
+
342
+ return outputs
343
+
344
+
345
+ class MLP(nn.Module):
346
+ def __init__(self, config: RWConfig):
347
+ super().__init__()
348
+ hidden_size = config.hidden_size
349
+
350
+ self.dense_h_to_4h = Linear(hidden_size, 4 * hidden_size, bias=config.bias)
351
+ self.act = nn.GELU()
352
+ self.dense_4h_to_h = Linear(4 * hidden_size, hidden_size, bias=config.bias)
353
+ self.hidden_dropout = config.hidden_dropout
354
+
355
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
356
+ x = self.act(self.dense_h_to_4h(x))
357
+ x = self.dense_4h_to_h(x)
358
+ return x
359
+
360
+
361
+ class DecoderLayer(nn.Module):
362
+ def __init__(self, config: RWConfig):
363
+ super().__init__()
364
+ hidden_size = config.hidden_size
365
+
366
+ self.input_layernorm = LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
367
+ self.num_heads = config.n_head
368
+ self.self_attention = Attention(config)
369
+
370
+ if not config.parallel_attn:
371
+ # unused if parallel attn
372
+ self.post_attention_layernorm = LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
373
+
374
+ self.mlp = MLP(config)
375
+
376
+ self.apply_residual_connection_post_layernorm = config.apply_residual_connection_post_layernorm
377
+ self.hidden_dropout = config.hidden_dropout
378
+
379
+ self.config = config
380
+
381
+ def forward(
382
+ self,
383
+ hidden_states: torch.Tensor,
384
+ alibi: torch.Tensor,
385
+ attention_mask: torch.Tensor,
386
+ layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
387
+ head_mask: Optional[torch.Tensor] = None,
388
+ use_cache: bool = False,
389
+ output_attentions: bool = False,
390
+ ):
391
+
392
+ layernorm_output = self.input_layernorm(hidden_states)
393
+ residual = hidden_states
394
+
395
+ # Self attention.
396
+ attn_outputs = self.self_attention(
397
+ layernorm_output,
398
+ layer_past=layer_past,
399
+ attention_mask=attention_mask,
400
+ alibi=alibi,
401
+ head_mask=head_mask,
402
+ use_cache=use_cache,
403
+ output_attentions=output_attentions,
404
+ )
405
+
406
+ attention_output = attn_outputs[0]
407
+
408
+ if not self.config.parallel_attn:
409
+ residual = dropout_add(attention_output, residual, self.config.attention_dropout, training=self.training)
410
+ layernorm_output = self.post_attention_layernorm(residual)
411
+
412
+ outputs = attn_outputs[1:]
413
+
414
+ # MLP.
415
+ mlp_output = self.mlp(layernorm_output)
416
+
417
+ if self.config.parallel_attn:
418
+ mlp_output += attention_output
419
+
420
+ output = dropout_add(mlp_output, residual, self.config.hidden_dropout, training=self.training)
421
+
422
+ if use_cache:
423
+ outputs = (output,) + outputs
424
+ else:
425
+ outputs = (output,) + outputs[1:]
426
+
427
+ return outputs # hidden_states, present, attentions
428
+
429
+
430
+ class RWPreTrainedModel(PreTrainedModel):
431
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
432
+ """
433
+ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
434
+ models.
435
+ """
436
+
437
+ config_class = RWConfig
438
+ base_model_prefix = "transformer"
439
+ supports_gradient_checkpointing = True
440
+ _no_split_modules = ["DecoderLayer"]
441
+
442
+ def __init__(self, *inputs, **kwargs):
443
+ super().__init__(*inputs, **kwargs)
444
+
445
+ def _init_weights(self, module: nn.Module):
446
+ """Initialize the weights."""
447
+ if isinstance(module, nn.Linear) or isinstance(module, Linear):
448
+ # Slightly different from the TF version which uses truncated_normal for initialization
449
+ # cf https://github.com/pytorch/pytorch/pull/5617
450
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
451
+ if module.bias is not None:
452
+ module.bias.data.zero_()
453
+ elif isinstance(module, nn.Embedding):
454
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
455
+ if module.padding_idx is not None:
456
+ module.weight.data[module.padding_idx].zero_()
457
+ elif isinstance(module, LayerNorm):
458
+ module.bias.data.zero_()
459
+ module.weight.data.fill_(1.0)
460
+
461
+ def _set_gradient_checkpointing(self, module: nn.Module, value: bool = False):
462
+ if isinstance(module, RWModel):
463
+ module.gradient_checkpointing = value
464
+
465
+ @staticmethod
466
+ def _convert_to_standard_cache(
467
+ past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]], batch_size: int
468
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
469
+ """
470
+ Standardizes the format of the cache so as to match most implementations, i.e. to tuple(tuple([batch_size,
471
+ num_heads, ...]))
472
+ """
473
+ batch_size_times_num_heads, head_dim, seq_length = past_key_value[0][0].shape
474
+ num_heads = batch_size_times_num_heads // batch_size
475
+ # key: [batch_size * num_heads, head_dim, seq_length] -> [batch_size, num_heads, head_dim, seq_length]
476
+ # value: [batch_size * num_heads, seq_length, head_dim] -> [batch_size, num_heads, seq_length, head_dim]
477
+ return tuple(
478
+ (
479
+ layer_past[0].view(batch_size, num_heads, head_dim, seq_length),
480
+ layer_past[1].view(batch_size, num_heads, seq_length, head_dim),
481
+ )
482
+ for layer_past in past_key_value
483
+ )
484
+
485
+ @staticmethod
486
+ def _convert_to_rw_cache(
487
+ past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]]
488
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
489
+ batch_size, num_heads, head_dim, seq_length = past_key_value[0][0].shape
490
+ batch_size_times_num_heads = batch_size * num_heads
491
+ # key: [batch_size, num_heads, head_dim, seq_length] -> [batch_size * num_heads, head_dim, seq_length]
492
+ # value: [batch_size, num_heads, seq_length, head_dim] -> [batch_size * num_heads, seq_length, head_dim]
493
+ return tuple(
494
+ (
495
+ layer_past[0].view(batch_size_times_num_heads, head_dim, seq_length),
496
+ layer_past[1].view(batch_size_times_num_heads, seq_length, head_dim),
497
+ )
498
+ for layer_past in past_key_value
499
+ )
500
+
501
+
502
+ class RWModel(RWPreTrainedModel):
503
+ def __init__(self, config: RWConfig):
504
+ super().__init__(config)
505
+
506
+ self.embed_dim = config.hidden_size
507
+ self.num_heads = config.n_head
508
+ self.alibi = config.alibi
509
+
510
+ # Embedding + LN Embedding
511
+ self.word_embeddings = nn.Embedding(config.vocab_size, self.embed_dim)
512
+
513
+ # Transformer blocks
514
+ self.h = nn.ModuleList([DecoderLayer(config) for _ in range(config.num_hidden_layers)])
515
+
516
+ # Final Layer Norm
517
+ self.ln_f = LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)
518
+
519
+ self.gradient_checkpointing = False
520
+
521
+ # Initialize weights and apply final processing
522
+ self.post_init()
523
+
524
+ def get_input_embeddings(self):
525
+ return self.word_embeddings
526
+
527
+ def _prepare_attn_mask(
528
+ self, attention_mask: torch.Tensor, input_shape: Tuple[int, int], past_key_values_length: int
529
+ ) -> torch.BoolTensor:
530
+ # create causal mask
531
+ # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length]
532
+ combined_attention_mask = None
533
+ device = attention_mask.device
534
+ _, src_length = input_shape
535
+
536
+ if src_length > 1:
537
+ combined_attention_mask = _make_causal_mask(
538
+ input_shape, device=device, past_key_values_length=past_key_values_length
539
+ )
540
+
541
+ # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length]
542
+ expanded_attn_mask = _expand_mask(attention_mask, tgt_length=src_length)
543
+ combined_attention_mask = (
544
+ expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask | combined_attention_mask
545
+ )
546
+
547
+ return combined_attention_mask
548
+
549
+ def set_input_embeddings(self, new_embeddings: torch.Tensor):
550
+ self.word_embeddings = new_embeddings
551
+
552
+ def forward(
553
+ self,
554
+ input_ids: Optional[torch.LongTensor] = None,
555
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
556
+ attention_mask: Optional[torch.Tensor] = None,
557
+ head_mask: Optional[torch.LongTensor] = None,
558
+ inputs_embeds: Optional[torch.LongTensor] = None,
559
+ use_cache: Optional[bool] = None,
560
+ output_attentions: Optional[bool] = None,
561
+ output_hidden_states: Optional[bool] = None,
562
+ return_dict: Optional[bool] = None,
563
+ **deprecated_arguments,
564
+ ) -> Union[Tuple[torch.Tensor, ...], BaseModelOutputWithPastAndCrossAttentions]:
565
+ if deprecated_arguments.pop("position_ids", False) is not False:
566
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
567
+ warnings.warn(
568
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
569
+ " passing `position_ids`.",
570
+ FutureWarning,
571
+ )
572
+ if len(deprecated_arguments) > 0:
573
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
574
+
575
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
576
+ output_hidden_states = (
577
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
578
+ )
579
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
580
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
581
+
582
+ if input_ids is not None and inputs_embeds is not None:
583
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
584
+ elif input_ids is not None:
585
+ batch_size, seq_length = input_ids.shape
586
+ elif inputs_embeds is not None:
587
+ batch_size, seq_length, _ = inputs_embeds.shape
588
+ else:
589
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
590
+
591
+ if past_key_values is None:
592
+ past_key_values = tuple([None] * len(self.h))
593
+
594
+ # Prepare head mask if needed
595
+ # 1.0 in head_mask indicate we keep the head
596
+ # attention_probs has shape batch_size x num_heads x N x N
597
+ # head_mask has shape n_layer x batch x num_heads x N x N
598
+ head_mask = self.get_head_mask(head_mask, self.config.n_layer)
599
+
600
+ if inputs_embeds is None:
601
+ inputs_embeds = self.word_embeddings(input_ids)
602
+
603
+ hidden_states = inputs_embeds
604
+
605
+ presents = () if use_cache else None
606
+ all_self_attentions = () if output_attentions else None
607
+ all_hidden_states = () if output_hidden_states else None
608
+
609
+ # Compute alibi tensor: check build_alibi_tensor documentation
610
+ seq_length_with_past = seq_length
611
+ past_key_values_length = 0
612
+ if past_key_values[0] is not None:
613
+ past_key_values_length = past_key_values[0][0].shape[2]
614
+ seq_length_with_past = seq_length_with_past + past_key_values_length
615
+ if attention_mask is None:
616
+ attention_mask = torch.ones((batch_size, seq_length_with_past), device=hidden_states.device)
617
+ else:
618
+ attention_mask = attention_mask.to(hidden_states.device)
619
+
620
+ if self.alibi:
621
+ alibi = build_alibi_tensor(attention_mask, self.num_heads, dtype=hidden_states.dtype)
622
+ else:
623
+ alibi = None
624
+
625
+ causal_mask = self._prepare_attn_mask(
626
+ attention_mask,
627
+ input_shape=(batch_size, seq_length),
628
+ past_key_values_length=past_key_values_length,
629
+ )
630
+
631
+ for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
632
+
633
+ if output_hidden_states:
634
+ all_hidden_states = all_hidden_states + (hidden_states,)
635
+
636
+ if self.gradient_checkpointing and self.training:
637
+
638
+ if use_cache:
639
+ logger.warning(
640
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
641
+ )
642
+ use_cache = False
643
+
644
+ def create_custom_forward(module):
645
+ def custom_forward(*inputs):
646
+ # None for past_key_value
647
+ return module(*inputs, use_cache=use_cache, output_attentions=output_attentions)
648
+
649
+ return custom_forward
650
+
651
+ outputs = torch.utils.checkpoint.checkpoint(
652
+ create_custom_forward(block),
653
+ hidden_states,
654
+ alibi,
655
+ causal_mask,
656
+ head_mask[i],
657
+ )
658
+ else:
659
+ outputs = block(
660
+ hidden_states,
661
+ layer_past=layer_past,
662
+ attention_mask=causal_mask,
663
+ head_mask=head_mask[i],
664
+ use_cache=use_cache,
665
+ output_attentions=output_attentions,
666
+ alibi=alibi,
667
+ )
668
+
669
+ hidden_states = outputs[0]
670
+ if use_cache is True:
671
+ presents = presents + (outputs[1],)
672
+
673
+ if output_attentions:
674
+ all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
675
+
676
+ # Add last hidden state
677
+ hidden_states = self.ln_f(hidden_states)
678
+
679
+ if output_hidden_states:
680
+ all_hidden_states = all_hidden_states + (hidden_states,)
681
+
682
+ if not return_dict:
683
+ return tuple(v for v in [hidden_states, presents, all_hidden_states, all_self_attentions] if v is not None)
684
+
685
+ return BaseModelOutputWithPastAndCrossAttentions(
686
+ last_hidden_state=hidden_states,
687
+ past_key_values=presents,
688
+ hidden_states=all_hidden_states,
689
+ attentions=all_self_attentions,
690
+ )
691
+
692
+
693
+ class RWForCausalLM(RWPreTrainedModel):
694
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
695
+
696
+ def __init__(self, config: RWConfig):
697
+ super().__init__(config)
698
+ self.transformer = RWModel(config)
699
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
700
+
701
+ # Initialize weights and apply final processing
702
+ self.post_init()
703
+
704
+ def get_output_embeddings(self):
705
+ return self.lm_head
706
+
707
+ def set_output_embeddings(self, new_embeddings: torch.Tensor):
708
+ self.lm_head = new_embeddings
709
+
710
+ def prepare_inputs_for_generation(
711
+ self,
712
+ input_ids: torch.LongTensor,
713
+ past: Optional[torch.Tensor] = None,
714
+ attention_mask: Optional[torch.Tensor] = None,
715
+ **kwargs,
716
+ ) -> dict:
717
+ # only last token for input_ids if past is not None
718
+ if past:
719
+ input_ids = input_ids[:, -1].unsqueeze(-1)
720
+
721
+ # the cache may be in the stardard format (e.g. in contrastive search), convert to our's format if needed
722
+ if past[0][0].shape[0] == input_ids.shape[0]:
723
+ past = self._convert_to_rw_cache(past)
724
+
725
+ return {
726
+ "input_ids": input_ids,
727
+ "past_key_values": past,
728
+ "use_cache": kwargs.get("use_cache"),
729
+ "attention_mask": attention_mask,
730
+ }
731
+
732
+ def forward(
733
+ self,
734
+ input_ids: Optional[torch.LongTensor] = None,
735
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
736
+ attention_mask: Optional[torch.Tensor] = None,
737
+ head_mask: Optional[torch.Tensor] = None,
738
+ inputs_embeds: Optional[torch.Tensor] = None,
739
+ labels: Optional[torch.Tensor] = None,
740
+ use_cache: Optional[bool] = None,
741
+ output_attentions: Optional[bool] = None,
742
+ output_hidden_states: Optional[bool] = None,
743
+ return_dict: Optional[bool] = None,
744
+ **deprecated_arguments,
745
+ ) -> Union[Tuple[torch.Tensor], CausalLMOutputWithCrossAttentions]:
746
+ r"""
747
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
748
+ Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
749
+ `labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
750
+ are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
751
+ """
752
+ if deprecated_arguments.pop("position_ids", False) is not False:
753
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
754
+ warnings.warn(
755
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
756
+ " passing `position_ids`.",
757
+ FutureWarning,
758
+ )
759
+ if len(deprecated_arguments) > 0:
760
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
761
+
762
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
763
+
764
+ transformer_outputs = self.transformer(
765
+ input_ids,
766
+ past_key_values=past_key_values,
767
+ attention_mask=attention_mask,
768
+ head_mask=head_mask,
769
+ inputs_embeds=inputs_embeds,
770
+ use_cache=use_cache,
771
+ output_attentions=output_attentions,
772
+ output_hidden_states=output_hidden_states,
773
+ return_dict=return_dict,
774
+ )
775
+ hidden_states = transformer_outputs[0]
776
+
777
+ lm_logits = self.lm_head(hidden_states)
778
+
779
+ loss = None
780
+ if labels is not None:
781
+ # Shift so that tokens < n predict n
782
+ shift_logits = lm_logits[..., :-1, :].contiguous()
783
+ shift_labels = labels[..., 1:].contiguous()
784
+ batch_size, seq_length, vocab_size = shift_logits.shape
785
+ # Flatten the tokens
786
+ loss_fct = CrossEntropyLoss()
787
+ loss = loss_fct(
788
+ shift_logits.view(batch_size * seq_length, vocab_size), shift_labels.view(batch_size * seq_length)
789
+ )
790
+
791
+ if not return_dict:
792
+ output = (lm_logits,) + transformer_outputs[1:]
793
+ return ((loss,) + output) if loss is not None else output
794
+
795
+ return CausalLMOutputWithCrossAttentions(
796
+ loss=loss,
797
+ logits=lm_logits,
798
+ past_key_values=transformer_outputs.past_key_values,
799
+ hidden_states=transformer_outputs.hidden_states,
800
+ attentions=transformer_outputs.attentions,
801
+ )
802
+
803
+ def _reorder_cache(
804
+ self, past: Tuple[Tuple[torch.Tensor, torch.Tensor], ...], beam_idx: torch.LongTensor
805
+ ) -> Tuple[Tuple[torch.Tensor, torch.Tensor], ...]:
806
+ """
807
+ This function is used to re-order the `past_key_values` cache if [`~PreTrainedModel.beam_search`] or
808
+ [`~PreTrainedModel.beam_sample`] is called. This is required to match `past_key_values` with the correct
809
+ beam_idx at every generation step.
810
+
811
+ Output shares the same memory storage as `past`.
812
+ """
813
+ standardized_past = self._convert_to_standard_cache(past, batch_size=len(beam_idx))
814
+
815
+ # Get a copy of `beam_idx` on all the devices where we need those indices.
816
+ device_to_beam_idx = {
817
+ past_state.device: beam_idx.to(past_state.device) for layer_past in past for past_state in layer_past
818
+ }
819
+ reordered_past = tuple(
820
+ (
821
+ layer_past[0].index_select(0, device_to_beam_idx[layer_past[0].device]),
822
+ layer_past[1].index_select(0, device_to_beam_idx[layer_past[0].device]),
823
+ )
824
+ for layer_past in standardized_past
825
+ )
826
+ return self._convert_to_rw_cache(reordered_past)
827
+
828
+
829
+ class RWForSequenceClassification(RWPreTrainedModel):
830
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
831
+
832
+ def __init__(self, config: RWConfig):
833
+ super().__init__(config)
834
+ self.num_labels = config.num_labels
835
+ self.transformer = RWModel(config)
836
+ self.score = nn.Linear(config.hidden_size, config.num_labels, bias=False)
837
+
838
+ # Initialize weights and apply final processing
839
+ self.post_init()
840
+
841
+ def forward(
842
+ self,
843
+ input_ids: Optional[torch.LongTensor] = None,
844
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
845
+ attention_mask: Optional[torch.Tensor] = None,
846
+ head_mask: Optional[torch.Tensor] = None,
847
+ inputs_embeds: Optional[torch.Tensor] = None,
848
+ labels: Optional[torch.Tensor] = None,
849
+ use_cache: Optional[bool] = None,
850
+ output_attentions: Optional[bool] = None,
851
+ output_hidden_states: Optional[bool] = None,
852
+ return_dict: Optional[bool] = None,
853
+ **deprecated_arguments,
854
+ ) -> Union[Tuple[torch.Tensor], SequenceClassifierOutputWithPast]:
855
+ r"""
856
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
857
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
858
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
859
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
860
+ """
861
+ if deprecated_arguments.pop("position_ids", False) is not False:
862
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
863
+ warnings.warn(
864
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
865
+ " passing `position_ids`.",
866
+ FutureWarning,
867
+ )
868
+ if len(deprecated_arguments) > 0:
869
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
870
+
871
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
872
+
873
+ transformer_outputs = self.transformer(
874
+ input_ids,
875
+ past_key_values=past_key_values,
876
+ attention_mask=attention_mask,
877
+ head_mask=head_mask,
878
+ inputs_embeds=inputs_embeds,
879
+ use_cache=use_cache,
880
+ output_attentions=output_attentions,
881
+ output_hidden_states=output_hidden_states,
882
+ return_dict=return_dict,
883
+ )
884
+
885
+ hidden_states = transformer_outputs[0]
886
+ logits = self.score(hidden_states)
887
+
888
+ if input_ids is not None:
889
+ batch_size = input_ids.shape[0]
890
+ else:
891
+ batch_size = inputs_embeds.shape[0]
892
+
893
+ if self.config.pad_token_id is None and batch_size != 1:
894
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
895
+ if self.config.pad_token_id is None:
896
+ sequence_lengths = -1
897
+ else:
898
+ if input_ids is not None:
899
+ sequence_lengths = torch.ne(input_ids, self.config.pad_token_id).sum(dim=-1) - 1
900
+ else:
901
+ sequence_lengths = -1
902
+ logger.warning(
903
+ f"{self.__class__.__name__} will not detect padding tokens in `inputs_embeds`. Results may be "
904
+ "unexpected if using padding tokens in conjunction with `inputs_embeds.`"
905
+ )
906
+
907
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
908
+
909
+ loss = None
910
+ if labels is not None:
911
+ if self.config.problem_type is None:
912
+ if self.num_labels == 1:
913
+ self.config.problem_type = "regression"
914
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
915
+ self.config.problem_type = "single_label_classification"
916
+ else:
917
+ self.config.problem_type = "multi_label_classification"
918
+
919
+ if self.config.problem_type == "regression":
920
+ loss_fct = MSELoss()
921
+ if self.num_labels == 1:
922
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
923
+ else:
924
+ loss = loss_fct(pooled_logits, labels)
925
+ elif self.config.problem_type == "single_label_classification":
926
+ loss_fct = CrossEntropyLoss()
927
+ loss = loss_fct(pooled_logits, labels)
928
+ elif self.config.problem_type == "multi_label_classification":
929
+ loss_fct = BCEWithLogitsLoss()
930
+ loss = loss_fct(pooled_logits, labels)
931
+ if not return_dict:
932
+ output = (pooled_logits,) + transformer_outputs[1:]
933
+ return ((loss,) + output) if loss is not None else output
934
+
935
+ return SequenceClassifierOutputWithPast(
936
+ loss=loss,
937
+ logits=pooled_logits,
938
+ past_key_values=transformer_outputs.past_key_values,
939
+ hidden_states=transformer_outputs.hidden_states,
940
+ attentions=transformer_outputs.attentions,
941
+ )
942
+
943
+
944
+ class RWForTokenClassification(RWPreTrainedModel):
945
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
946
+
947
+ def __init__(self, config: RWConfig):
948
+ super().__init__(config)
949
+ self.num_labels = config.num_labels
950
+
951
+ self.transformer = RWModel(config)
952
+ if hasattr(config, "classifier_dropout") and config.classifier_dropout is not None:
953
+ classifier_dropout = config.classifier_dropout
954
+ elif hasattr(config, "hidden_dropout") and config.hidden_dropout is not None:
955
+ classifier_dropout = config.hidden_dropout
956
+ else:
957
+ classifier_dropout = 0.1
958
+ self.dropout = nn.Dropout(classifier_dropout)
959
+ self.classifier = nn.Linear(config.hidden_size, config.num_labels)
960
+
961
+ # Initialize weights and apply final processing
962
+ self.post_init()
963
+
964
+ def forward(
965
+ self,
966
+ input_ids: Optional[torch.LongTensor] = None,
967
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
968
+ attention_mask: Optional[torch.Tensor] = None,
969
+ head_mask: Optional[torch.Tensor] = None,
970
+ inputs_embeds: Optional[torch.Tensor] = None,
971
+ labels: Optional[torch.Tensor] = None,
972
+ use_cache: Optional[bool] = None,
973
+ output_attentions: Optional[bool] = None,
974
+ output_hidden_states: Optional[bool] = None,
975
+ return_dict: Optional[bool] = None,
976
+ **deprecated_arguments,
977
+ ) -> Union[Tuple[torch.Tensor], TokenClassifierOutput]:
978
+ r"""
979
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
980
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
981
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
982
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
983
+ """
984
+ if deprecated_arguments.pop("position_ids", False) is not False:
985
+ # `position_ids` could have been `torch.Tensor` or `None` so defaulting pop to `False` allows to detect if users were passing explicitly `None`
986
+ warnings.warn(
987
+ "`position_ids` have no functionality in BLOOM and will be removed in v5.0.0. You can safely ignore"
988
+ " passing `position_ids`.",
989
+ FutureWarning,
990
+ )
991
+ if len(deprecated_arguments) > 0:
992
+ raise ValueError(f"Got unexpected arguments: {deprecated_arguments}")
993
+
994
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
995
+
996
+ transformer_outputs = self.transformer(
997
+ input_ids,
998
+ past_key_values=past_key_values,
999
+ attention_mask=attention_mask,
1000
+ head_mask=head_mask,
1001
+ inputs_embeds=inputs_embeds,
1002
+ use_cache=use_cache,
1003
+ output_attentions=output_attentions,
1004
+ output_hidden_states=output_hidden_states,
1005
+ return_dict=return_dict,
1006
+ )
1007
+
1008
+ hidden_states = transformer_outputs[0]
1009
+ hidden_states = self.dropout(hidden_states)
1010
+ logits = self.classifier(hidden_states)
1011
+
1012
+ loss = None
1013
+ if labels is not None:
1014
+ batch_size, seq_length = labels.shape
1015
+ loss_fct = CrossEntropyLoss()
1016
+ loss = loss_fct(logits.view(batch_size * seq_length, self.num_labels), labels.view(batch_size * seq_length))
1017
+
1018
+ if not return_dict:
1019
+ output = (logits,) + transformer_outputs[2:]
1020
+ return ((loss,) + output) if loss is not None else output
1021
+
1022
+ return TokenClassifierOutput(
1023
+ loss=loss,
1024
+ logits=logits,
1025
+ hidden_states=transformer_outputs.hidden_states,
1026
+ attentions=transformer_outputs.attentions,
1027
+ )
1028
+
1029
+
1030
+ class RWForQuestionAnswering(RWPreTrainedModel):
1031
+ _keys_to_ignore_on_load_missing = [r"h.*.self_attention.scale_mask_softmax.causal_mask", r"lm_head.weight"]
1032
+
1033
+ def __init__(self, config):
1034
+ super().__init__(config)
1035
+ self.transformer = RWModel(config)
1036
+ self.qa_outputs = nn.Linear(config.hidden_size, 2)
1037
+
1038
+ # Initialize weights and apply final processing
1039
+ self.post_init()
1040
+
1041
+ def forward(
1042
+ self,
1043
+ input_ids: Optional[torch.LongTensor] = None,
1044
+ attention_mask: Optional[torch.FloatTensor] = None,
1045
+ position_ids: Optional[torch.LongTensor] = None,
1046
+ head_mask: Optional[torch.FloatTensor] = None,
1047
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1048
+ start_positions: Optional[torch.LongTensor] = None,
1049
+ end_positions: Optional[torch.LongTensor] = None,
1050
+ output_attentions: Optional[bool] = None,
1051
+ output_hidden_states: Optional[bool] = None,
1052
+ return_dict: Optional[bool] = None,
1053
+ ) -> Union[Tuple, QuestionAnsweringModelOutput]:
1054
+ r"""
1055
+ start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1056
+ Labels for position (index) of the start of the labelled span for computing the token classification loss.
1057
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1058
+ are not taken into account for computing the loss.
1059
+ end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1060
+ Labels for position (index) of the end of the labelled span for computing the token classification loss.
1061
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1062
+ are not taken into account for computing the loss.
1063
+ """
1064
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1065
+
1066
+ outputs = self.transformer(
1067
+ input_ids,
1068
+ attention_mask=attention_mask,
1069
+ position_ids=position_ids,
1070
+ head_mask=head_mask,
1071
+ inputs_embeds=inputs_embeds,
1072
+ output_attentions=output_attentions,
1073
+ output_hidden_states=output_hidden_states,
1074
+ return_dict=return_dict,
1075
+ )
1076
+
1077
+ sequence_output = outputs[0]
1078
+
1079
+ logits = self.qa_outputs(sequence_output)
1080
+ start_logits, end_logits = logits.split(1, dim=-1)
1081
+ start_logits = start_logits.squeeze(-1).contiguous()
1082
+ end_logits = end_logits.squeeze(-1).contiguous()
1083
+
1084
+ total_loss = None
1085
+ if start_positions is not None and end_positions is not None:
1086
+ # If we are on multi-GPU, split add a dimension
1087
+ if len(start_positions.size()) > 1:
1088
+ start_positions = start_positions.squeeze(-1)
1089
+ if len(end_positions.size()) > 1:
1090
+ end_positions = end_positions.squeeze(-1)
1091
+ # sometimes the start/end positions are outside our model inputs, we ignore these terms
1092
+ ignored_index = start_logits.size(1)
1093
+ start_positions = start_positions.clamp(0, ignored_index)
1094
+ end_positions = end_positions.clamp(0, ignored_index)
1095
+
1096
+ loss_fct = CrossEntropyLoss(ignore_index=ignored_index)
1097
+ start_loss = loss_fct(start_logits, start_positions)
1098
+ end_loss = loss_fct(end_logits, end_positions)
1099
+ total_loss = (start_loss + end_loss) / 2
1100
+
1101
+ if not return_dict:
1102
+ output = (start_logits, end_logits) + outputs[2:]
1103
+ return ((total_loss,) + output) if total_loss is not None else output
1104
+
1105
+ return QuestionAnsweringModelOutput(
1106
+ loss=total_loss,
1107
+ start_logits=start_logits,
1108
+ end_logits=end_logits,
1109
+ hidden_states=outputs.hidden_states,
1110
+ attentions=outputs.attentions,
1111
+ )
pytorch_model-00001-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf8d79dce91486c166640f2dbde437985109617072c8747abc875ff7b35f4937
3
+ size 9504536357
pytorch_model-00002-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2bda814cd53c53b6e7c9c168dce4e48371714fcbbe1ee273b6a35173867942a
3
+ size 9512925303
pytorch_model-00003-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29ea68447ced396b92bae50150340fffcb55166ee72835b8e0fb7c0a6002d0a7
3
+ size 9512925367
pytorch_model-00004-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e99fbdaf8f48474b55c23cbaea749790bedf0d52e0d1d7a522f9b4bceed6a4c3
3
+ size 9512925367
pytorch_model-00005-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9398b3a9b7b758f333073f15db1d3ab958c9c9d30556221c0e51a07afa167ca
3
+ size 9512925367
pytorch_model-00006-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f158d1250afe86b2e455cdba83a5ba183c7329a5b9f82c53d418878bf6e4b53
3
+ size 9512925367
pytorch_model-00007-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72b644f83bf1b351942b6801cb1da27933cd16c9d4bea0b009d48ca8b864bce2
3
+ size 9512925367
pytorch_model-00008-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bc35d185c86958ac48722c41434bc9bd4b268e15a17e91b9f24d3cb1f4f2eb1
3
+ size 9512925367
pytorch_model-00009-of-00009.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:063b41bbd55c371cac7d7cd5a5a93bb1709f54a661c6e4703a2849fc836069b1
3
+ size 7575086769
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 83669975040
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00009-of-00009.bin",
7
+ "transformer.h.0.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
8
+ "transformer.h.0.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
9
+ "transformer.h.0.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
10
+ "transformer.h.0.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
11
+ "transformer.h.0.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
12
+ "transformer.h.0.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
13
+ "transformer.h.1.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
14
+ "transformer.h.1.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
15
+ "transformer.h.1.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
16
+ "transformer.h.1.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
17
+ "transformer.h.1.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
18
+ "transformer.h.1.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
19
+ "transformer.h.10.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
20
+ "transformer.h.10.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
21
+ "transformer.h.10.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
22
+ "transformer.h.10.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
23
+ "transformer.h.10.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
24
+ "transformer.h.10.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
25
+ "transformer.h.11.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
26
+ "transformer.h.11.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
27
+ "transformer.h.11.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
28
+ "transformer.h.11.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
29
+ "transformer.h.11.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
30
+ "transformer.h.11.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
31
+ "transformer.h.12.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
32
+ "transformer.h.12.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
33
+ "transformer.h.12.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
34
+ "transformer.h.12.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
35
+ "transformer.h.12.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
36
+ "transformer.h.12.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
37
+ "transformer.h.13.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
38
+ "transformer.h.13.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
39
+ "transformer.h.13.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
40
+ "transformer.h.13.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
41
+ "transformer.h.13.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
42
+ "transformer.h.13.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
43
+ "transformer.h.14.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
44
+ "transformer.h.14.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
45
+ "transformer.h.14.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
46
+ "transformer.h.14.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
47
+ "transformer.h.14.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
48
+ "transformer.h.14.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
49
+ "transformer.h.15.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
50
+ "transformer.h.15.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
51
+ "transformer.h.15.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
52
+ "transformer.h.15.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
53
+ "transformer.h.15.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
54
+ "transformer.h.15.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
55
+ "transformer.h.16.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
56
+ "transformer.h.16.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
57
+ "transformer.h.16.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
58
+ "transformer.h.16.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
59
+ "transformer.h.16.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
60
+ "transformer.h.16.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
61
+ "transformer.h.17.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
62
+ "transformer.h.17.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
63
+ "transformer.h.17.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
64
+ "transformer.h.17.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
65
+ "transformer.h.17.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
66
+ "transformer.h.17.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
67
+ "transformer.h.18.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
68
+ "transformer.h.18.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
69
+ "transformer.h.18.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
70
+ "transformer.h.18.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
71
+ "transformer.h.18.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
72
+ "transformer.h.18.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
73
+ "transformer.h.19.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
74
+ "transformer.h.19.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
75
+ "transformer.h.19.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00009.bin",
76
+ "transformer.h.19.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00009.bin",
77
+ "transformer.h.19.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
78
+ "transformer.h.19.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
79
+ "transformer.h.2.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
80
+ "transformer.h.2.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
81
+ "transformer.h.2.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
82
+ "transformer.h.2.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
83
+ "transformer.h.2.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
84
+ "transformer.h.2.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
85
+ "transformer.h.20.input_layernorm.bias": "pytorch_model-00003-of-00009.bin",
86
+ "transformer.h.20.input_layernorm.weight": "pytorch_model-00003-of-00009.bin",
87
+ "transformer.h.20.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
88
+ "transformer.h.20.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
89
+ "transformer.h.20.self_attention.dense.weight": "pytorch_model-00003-of-00009.bin",
90
+ "transformer.h.20.self_attention.query_key_value.weight": "pytorch_model-00003-of-00009.bin",
91
+ "transformer.h.21.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
92
+ "transformer.h.21.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
93
+ "transformer.h.21.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
94
+ "transformer.h.21.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
95
+ "transformer.h.21.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
96
+ "transformer.h.21.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
97
+ "transformer.h.22.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
98
+ "transformer.h.22.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
99
+ "transformer.h.22.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
100
+ "transformer.h.22.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
101
+ "transformer.h.22.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
102
+ "transformer.h.22.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
103
+ "transformer.h.23.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
104
+ "transformer.h.23.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
105
+ "transformer.h.23.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
106
+ "transformer.h.23.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
107
+ "transformer.h.23.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
108
+ "transformer.h.23.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
109
+ "transformer.h.24.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
110
+ "transformer.h.24.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
111
+ "transformer.h.24.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
112
+ "transformer.h.24.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
113
+ "transformer.h.24.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
114
+ "transformer.h.24.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
115
+ "transformer.h.25.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
116
+ "transformer.h.25.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
117
+ "transformer.h.25.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
118
+ "transformer.h.25.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
119
+ "transformer.h.25.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
120
+ "transformer.h.25.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
121
+ "transformer.h.26.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
122
+ "transformer.h.26.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
123
+ "transformer.h.26.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00009.bin",
124
+ "transformer.h.26.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00009.bin",
125
+ "transformer.h.26.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
126
+ "transformer.h.26.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
127
+ "transformer.h.27.input_layernorm.bias": "pytorch_model-00004-of-00009.bin",
128
+ "transformer.h.27.input_layernorm.weight": "pytorch_model-00004-of-00009.bin",
129
+ "transformer.h.27.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
130
+ "transformer.h.27.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
131
+ "transformer.h.27.self_attention.dense.weight": "pytorch_model-00004-of-00009.bin",
132
+ "transformer.h.27.self_attention.query_key_value.weight": "pytorch_model-00004-of-00009.bin",
133
+ "transformer.h.28.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
134
+ "transformer.h.28.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
135
+ "transformer.h.28.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
136
+ "transformer.h.28.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
137
+ "transformer.h.28.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
138
+ "transformer.h.28.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
139
+ "transformer.h.29.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
140
+ "transformer.h.29.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
141
+ "transformer.h.29.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
142
+ "transformer.h.29.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
143
+ "transformer.h.29.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
144
+ "transformer.h.29.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
145
+ "transformer.h.3.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
146
+ "transformer.h.3.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
147
+ "transformer.h.3.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
148
+ "transformer.h.3.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
149
+ "transformer.h.3.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
150
+ "transformer.h.3.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
151
+ "transformer.h.30.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
152
+ "transformer.h.30.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
153
+ "transformer.h.30.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
154
+ "transformer.h.30.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
155
+ "transformer.h.30.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
156
+ "transformer.h.30.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
157
+ "transformer.h.31.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
158
+ "transformer.h.31.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
159
+ "transformer.h.31.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
160
+ "transformer.h.31.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
161
+ "transformer.h.31.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
162
+ "transformer.h.31.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
163
+ "transformer.h.32.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
164
+ "transformer.h.32.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
165
+ "transformer.h.32.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
166
+ "transformer.h.32.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
167
+ "transformer.h.32.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
168
+ "transformer.h.32.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
169
+ "transformer.h.33.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
170
+ "transformer.h.33.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
171
+ "transformer.h.33.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00009.bin",
172
+ "transformer.h.33.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00009.bin",
173
+ "transformer.h.33.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
174
+ "transformer.h.33.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
175
+ "transformer.h.34.input_layernorm.bias": "pytorch_model-00005-of-00009.bin",
176
+ "transformer.h.34.input_layernorm.weight": "pytorch_model-00005-of-00009.bin",
177
+ "transformer.h.34.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
178
+ "transformer.h.34.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
179
+ "transformer.h.34.self_attention.dense.weight": "pytorch_model-00005-of-00009.bin",
180
+ "transformer.h.34.self_attention.query_key_value.weight": "pytorch_model-00005-of-00009.bin",
181
+ "transformer.h.35.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
182
+ "transformer.h.35.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
183
+ "transformer.h.35.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
184
+ "transformer.h.35.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
185
+ "transformer.h.35.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
186
+ "transformer.h.35.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
187
+ "transformer.h.36.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
188
+ "transformer.h.36.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
189
+ "transformer.h.36.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
190
+ "transformer.h.36.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
191
+ "transformer.h.36.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
192
+ "transformer.h.36.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
193
+ "transformer.h.37.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
194
+ "transformer.h.37.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
195
+ "transformer.h.37.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
196
+ "transformer.h.37.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
197
+ "transformer.h.37.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
198
+ "transformer.h.37.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
199
+ "transformer.h.38.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
200
+ "transformer.h.38.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
201
+ "transformer.h.38.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
202
+ "transformer.h.38.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
203
+ "transformer.h.38.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
204
+ "transformer.h.38.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
205
+ "transformer.h.39.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
206
+ "transformer.h.39.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
207
+ "transformer.h.39.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
208
+ "transformer.h.39.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
209
+ "transformer.h.39.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
210
+ "transformer.h.39.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
211
+ "transformer.h.4.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
212
+ "transformer.h.4.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
213
+ "transformer.h.4.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
214
+ "transformer.h.4.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
215
+ "transformer.h.4.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
216
+ "transformer.h.4.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
217
+ "transformer.h.40.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
218
+ "transformer.h.40.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
219
+ "transformer.h.40.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00009.bin",
220
+ "transformer.h.40.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00009.bin",
221
+ "transformer.h.40.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
222
+ "transformer.h.40.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
223
+ "transformer.h.41.input_layernorm.bias": "pytorch_model-00006-of-00009.bin",
224
+ "transformer.h.41.input_layernorm.weight": "pytorch_model-00006-of-00009.bin",
225
+ "transformer.h.41.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
226
+ "transformer.h.41.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
227
+ "transformer.h.41.self_attention.dense.weight": "pytorch_model-00006-of-00009.bin",
228
+ "transformer.h.41.self_attention.query_key_value.weight": "pytorch_model-00006-of-00009.bin",
229
+ "transformer.h.42.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
230
+ "transformer.h.42.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
231
+ "transformer.h.42.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
232
+ "transformer.h.42.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
233
+ "transformer.h.42.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
234
+ "transformer.h.42.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
235
+ "transformer.h.43.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
236
+ "transformer.h.43.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
237
+ "transformer.h.43.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
238
+ "transformer.h.43.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
239
+ "transformer.h.43.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
240
+ "transformer.h.43.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
241
+ "transformer.h.44.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
242
+ "transformer.h.44.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
243
+ "transformer.h.44.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
244
+ "transformer.h.44.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
245
+ "transformer.h.44.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
246
+ "transformer.h.44.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
247
+ "transformer.h.45.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
248
+ "transformer.h.45.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
249
+ "transformer.h.45.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
250
+ "transformer.h.45.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
251
+ "transformer.h.45.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
252
+ "transformer.h.45.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
253
+ "transformer.h.46.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
254
+ "transformer.h.46.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
255
+ "transformer.h.46.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
256
+ "transformer.h.46.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
257
+ "transformer.h.46.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
258
+ "transformer.h.46.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
259
+ "transformer.h.47.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
260
+ "transformer.h.47.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
261
+ "transformer.h.47.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00009.bin",
262
+ "transformer.h.47.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00009.bin",
263
+ "transformer.h.47.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
264
+ "transformer.h.47.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
265
+ "transformer.h.48.input_layernorm.bias": "pytorch_model-00007-of-00009.bin",
266
+ "transformer.h.48.input_layernorm.weight": "pytorch_model-00007-of-00009.bin",
267
+ "transformer.h.48.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
268
+ "transformer.h.48.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
269
+ "transformer.h.48.self_attention.dense.weight": "pytorch_model-00007-of-00009.bin",
270
+ "transformer.h.48.self_attention.query_key_value.weight": "pytorch_model-00007-of-00009.bin",
271
+ "transformer.h.49.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
272
+ "transformer.h.49.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
273
+ "transformer.h.49.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
274
+ "transformer.h.49.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
275
+ "transformer.h.49.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
276
+ "transformer.h.49.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
277
+ "transformer.h.5.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
278
+ "transformer.h.5.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
279
+ "transformer.h.5.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00009.bin",
280
+ "transformer.h.5.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00009.bin",
281
+ "transformer.h.5.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
282
+ "transformer.h.5.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
283
+ "transformer.h.50.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
284
+ "transformer.h.50.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
285
+ "transformer.h.50.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
286
+ "transformer.h.50.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
287
+ "transformer.h.50.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
288
+ "transformer.h.50.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
289
+ "transformer.h.51.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
290
+ "transformer.h.51.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
291
+ "transformer.h.51.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
292
+ "transformer.h.51.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
293
+ "transformer.h.51.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
294
+ "transformer.h.51.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
295
+ "transformer.h.52.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
296
+ "transformer.h.52.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
297
+ "transformer.h.52.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
298
+ "transformer.h.52.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
299
+ "transformer.h.52.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
300
+ "transformer.h.52.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
301
+ "transformer.h.53.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
302
+ "transformer.h.53.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
303
+ "transformer.h.53.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
304
+ "transformer.h.53.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
305
+ "transformer.h.53.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
306
+ "transformer.h.53.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
307
+ "transformer.h.54.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
308
+ "transformer.h.54.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
309
+ "transformer.h.54.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00009.bin",
310
+ "transformer.h.54.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00009.bin",
311
+ "transformer.h.54.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
312
+ "transformer.h.54.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
313
+ "transformer.h.55.input_layernorm.bias": "pytorch_model-00008-of-00009.bin",
314
+ "transformer.h.55.input_layernorm.weight": "pytorch_model-00008-of-00009.bin",
315
+ "transformer.h.55.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00009.bin",
316
+ "transformer.h.55.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00009.bin",
317
+ "transformer.h.55.self_attention.dense.weight": "pytorch_model-00008-of-00009.bin",
318
+ "transformer.h.55.self_attention.query_key_value.weight": "pytorch_model-00008-of-00009.bin",
319
+ "transformer.h.56.input_layernorm.bias": "pytorch_model-00009-of-00009.bin",
320
+ "transformer.h.56.input_layernorm.weight": "pytorch_model-00009-of-00009.bin",
321
+ "transformer.h.56.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00009.bin",
322
+ "transformer.h.56.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00009.bin",
323
+ "transformer.h.56.self_attention.dense.weight": "pytorch_model-00009-of-00009.bin",
324
+ "transformer.h.56.self_attention.query_key_value.weight": "pytorch_model-00009-of-00009.bin",
325
+ "transformer.h.57.input_layernorm.bias": "pytorch_model-00009-of-00009.bin",
326
+ "transformer.h.57.input_layernorm.weight": "pytorch_model-00009-of-00009.bin",
327
+ "transformer.h.57.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00009.bin",
328
+ "transformer.h.57.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00009.bin",
329
+ "transformer.h.57.self_attention.dense.weight": "pytorch_model-00009-of-00009.bin",
330
+ "transformer.h.57.self_attention.query_key_value.weight": "pytorch_model-00009-of-00009.bin",
331
+ "transformer.h.58.input_layernorm.bias": "pytorch_model-00009-of-00009.bin",
332
+ "transformer.h.58.input_layernorm.weight": "pytorch_model-00009-of-00009.bin",
333
+ "transformer.h.58.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00009.bin",
334
+ "transformer.h.58.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00009.bin",
335
+ "transformer.h.58.self_attention.dense.weight": "pytorch_model-00009-of-00009.bin",
336
+ "transformer.h.58.self_attention.query_key_value.weight": "pytorch_model-00009-of-00009.bin",
337
+ "transformer.h.59.input_layernorm.bias": "pytorch_model-00009-of-00009.bin",
338
+ "transformer.h.59.input_layernorm.weight": "pytorch_model-00009-of-00009.bin",
339
+ "transformer.h.59.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00009.bin",
340
+ "transformer.h.59.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00009.bin",
341
+ "transformer.h.59.self_attention.dense.weight": "pytorch_model-00009-of-00009.bin",
342
+ "transformer.h.59.self_attention.query_key_value.weight": "pytorch_model-00009-of-00009.bin",
343
+ "transformer.h.6.input_layernorm.bias": "pytorch_model-00001-of-00009.bin",
344
+ "transformer.h.6.input_layernorm.weight": "pytorch_model-00001-of-00009.bin",
345
+ "transformer.h.6.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
346
+ "transformer.h.6.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
347
+ "transformer.h.6.self_attention.dense.weight": "pytorch_model-00001-of-00009.bin",
348
+ "transformer.h.6.self_attention.query_key_value.weight": "pytorch_model-00001-of-00009.bin",
349
+ "transformer.h.7.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
350
+ "transformer.h.7.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
351
+ "transformer.h.7.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
352
+ "transformer.h.7.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
353
+ "transformer.h.7.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
354
+ "transformer.h.7.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
355
+ "transformer.h.8.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
356
+ "transformer.h.8.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
357
+ "transformer.h.8.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
358
+ "transformer.h.8.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
359
+ "transformer.h.8.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
360
+ "transformer.h.8.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
361
+ "transformer.h.9.input_layernorm.bias": "pytorch_model-00002-of-00009.bin",
362
+ "transformer.h.9.input_layernorm.weight": "pytorch_model-00002-of-00009.bin",
363
+ "transformer.h.9.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00009.bin",
364
+ "transformer.h.9.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00009.bin",
365
+ "transformer.h.9.self_attention.dense.weight": "pytorch_model-00002-of-00009.bin",
366
+ "transformer.h.9.self_attention.query_key_value.weight": "pytorch_model-00002-of-00009.bin",
367
+ "transformer.ln_f.bias": "pytorch_model-00009-of-00009.bin",
368
+ "transformer.ln_f.weight": "pytorch_model-00009-of-00009.bin",
369
+ "transformer.word_embeddings.weight": "pytorch_model-00001-of-00009.bin"
370
+ }
371
+ }