ssbuild commited on
Commit
855ccf2
1 Parent(s): 721a16e
added_tokens.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "\t\t": 106066,
3
+ "\t\t\t": 106065,
4
+ "\t\t\t\t": 106064,
5
+ "\t\t\t\t\t": 106063,
6
+ "\t\t\t\t\t\t": 106062,
7
+ "\t\t\t\t\t\t\t": 106061,
8
+ "\t\t\t\t\t\t\t\t": 106060,
9
+ "\t\t\t\t\t\t\t\t\t": 106059,
10
+ " ": 106058,
11
+ " ": 106057,
12
+ " ": 106056,
13
+ " ": 106055,
14
+ " ": 106054,
15
+ " ": 106053,
16
+ " ": 106052,
17
+ " ": 106051,
18
+ " ": 106050,
19
+ " ": 106049,
20
+ " ": 106048,
21
+ " ": 106047,
22
+ " ": 106046,
23
+ " ": 106045,
24
+ " ": 106044,
25
+ " ": 106043,
26
+ " ": 106042,
27
+ " ": 106041,
28
+ " ": 106040,
29
+ " ": 106039,
30
+ " ": 106038,
31
+ " ": 106037,
32
+ " ": 106036,
33
+ " ": 106035,
34
+ " ": 106034,
35
+ " ": 106033,
36
+ " ": 106032,
37
+ " ": 106031,
38
+ " ": 106030,
39
+ " ": 106029,
40
+ "<eoc>": 106070,
41
+ "<eoh>": 106067,
42
+ "<eom>": 106068,
43
+ "<eor>": 106071,
44
+ "<eot>": 106069
45
+ }
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/data/nlp/pre_models/torch/moss/moss-moon-003-sft",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "MyMossForCausalLM"
6
+ ],
7
+ "attn_pdrop": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_moss.MossConfig",
10
+ "AutoModel": "modeling_moss.MossModel",
11
+ "AutoModelForCausalLM": "modeling_moss.MossForCausalLM"
12
+ },
13
+ "bos_token_id": 106028,
14
+ "embd_pdrop": 0.0,
15
+ "eos_token_id": 106068,
16
+ "gradient_checkpointing": false,
17
+ "groupsize": 128,
18
+ "initializer_range": 0.02,
19
+ "initializer_weight": false,
20
+ "layer_norm_epsilon": 1e-05,
21
+ "model_type": "moss",
22
+ "n_ctx": 2048,
23
+ "n_embd": 6144,
24
+ "n_head": 24,
25
+ "n_inner": null,
26
+ "n_layer": 34,
27
+ "n_positions": 2048,
28
+ "quantization_bit": 4,
29
+ "resid_pdrop": 0.0,
30
+ "return_dict": false,
31
+ "rope_ratio": 1.0,
32
+ "rotary_dim": 64,
33
+ "scale_attn_weights": true,
34
+ "summary_activation": null,
35
+ "summary_first_dropout": 0.1,
36
+ "summary_proj_to_labels": true,
37
+ "summary_type": "cls_index",
38
+ "summary_use_proj": true,
39
+ "task_specific_params": {},
40
+ "tie_word_embeddings": false,
41
+ "tokenizer_class": "GPT2Tokenizer",
42
+ "torch_dtype": "float16",
43
+ "transformers_version": "4.31.0",
44
+ "use_cache": true,
45
+ "vocab_size": 107008,
46
+ "wbits": 32
47
+ }
configuration_moss.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Moss model configuration"""
2
+
3
+ from transformers.utils import logging
4
+ from transformers.configuration_utils import PretrainedConfig
5
+
6
+
7
+ logger = logging.get_logger(__name__)
8
+
9
+
10
+ class MossConfig(PretrainedConfig):
11
+ r"""
12
+ This is the configuration class to store the configuration of a [`MossModel`]. It is used to instantiate a
13
+ Moss model according to the specified arguments, defining the model architecture. Instantiating a configuration
14
+ with the defaults will yield a similar configuration to that of the Moss
15
+ [fnlp/moss-moon-003-base](https://huggingface.co/fnlp/moss-moon-003-base) architecture. Configuration objects
16
+ inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from
17
+ [`PretrainedConfig`] for more information.
18
+
19
+ Args:
20
+ vocab_size (`int`, *optional*, defaults to 107008):
21
+ Vocabulary size of the Moss model. Defines the number of different tokens that can be represented by the
22
+ `inputs_ids` passed when calling [`MossModel`].
23
+ n_positions (`int`, *optional*, defaults to 2048):
24
+ The maximum sequence length that this model might ever be used with. Typically set this to something large
25
+ just in case (e.g., 512 or 1024 or 2048).
26
+ n_embd (`int`, *optional*, defaults to 4096):
27
+ Dimensionality of the embeddings and hidden states.
28
+ n_layer (`int`, *optional*, defaults to 28):
29
+ Number of hidden layers in the Transformer encoder.
30
+ n_head (`int`, *optional*, defaults to 16):
31
+ Number of attention heads for each attention layer in the Transformer encoder.
32
+ rotary_dim (`int`, *optional*, defaults to 64):
33
+ Number of dimensions in the embedding that Rotary Position Embedding is applied to.
34
+ n_inner (`int`, *optional*, defaults to None):
35
+ Dimensionality of the inner feed-forward layers. `None` will set it to 4 times n_embd
36
+ activation_function (`str`, *optional*, defaults to `"gelu_new"`):
37
+ Activation function, to be selected in the list `["relu", "silu", "gelu", "tanh", "gelu_new"]`.
38
+ resid_pdrop (`float`, *optional*, defaults to 0.1):
39
+ The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
40
+ embd_pdrop (`int`, *optional*, defaults to 0.1):
41
+ The dropout ratio for the embeddings.
42
+ attn_pdrop (`float`, *optional*, defaults to 0.1):
43
+ The dropout ratio for the attention.
44
+ layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
45
+ The epsilon to use in the layer normalization layers.
46
+ initializer_range (`float`, *optional*, defaults to 0.02):
47
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
48
+ use_cache (`bool`, *optional*, defaults to `True`):
49
+ Whether or not the model should return the last key/values attentions (not used by all models).
50
+
51
+ Example:
52
+
53
+ ```python
54
+ >>> from modeling_moss import MossModel
55
+ >>> from configuration_moss import MossConfig
56
+
57
+ >>> # Initializing a moss-moon-003-base configuration
58
+ >>> configuration = MossConfig()
59
+
60
+ >>> # Initializing a model (with random weights) from the configuration
61
+ >>> model = MossModel(configuration)
62
+
63
+ >>> # Accessing the model configuration
64
+ >>> configuration = model.config
65
+ ```"""
66
+
67
+ model_type = "moss"
68
+ attribute_map = {
69
+ "max_position_embeddings": "n_positions",
70
+ "hidden_size": "n_embd",
71
+ "num_attention_heads": "n_head",
72
+ "num_hidden_layers": "n_layer",
73
+ }
74
+
75
+ def __init__(
76
+ self,
77
+ vocab_size=107008,
78
+ n_positions=2048,
79
+ n_ctx=2048,
80
+ n_embd=4096,
81
+ n_layer=28,
82
+ n_head=16,
83
+ rotary_dim=64,
84
+ n_inner=None,
85
+ activation_function="gelu_new",
86
+ resid_pdrop=0.0,
87
+ embd_pdrop=0.0,
88
+ attn_pdrop=0.0,
89
+ layer_norm_epsilon=1e-5,
90
+ initializer_range=0.02,
91
+ use_cache=True,
92
+ bos_token_id=106028,
93
+ eos_token_id=106068,
94
+ tie_word_embeddings=False,
95
+ **kwargs,
96
+ ):
97
+ self.vocab_size = vocab_size
98
+ self.n_ctx = n_ctx
99
+ self.n_positions = n_positions
100
+ self.n_embd = n_embd
101
+ self.n_layer = n_layer
102
+ self.n_head = n_head
103
+ self.n_inner = n_inner
104
+ self.rotary_dim = rotary_dim
105
+ self.activation_function = activation_function
106
+ self.resid_pdrop = resid_pdrop
107
+ self.embd_pdrop = embd_pdrop
108
+ self.attn_pdrop = attn_pdrop
109
+ self.layer_norm_epsilon = layer_norm_epsilon
110
+ self.initializer_range = initializer_range
111
+ self.use_cache = use_cache
112
+
113
+ self.bos_token_id = bos_token_id
114
+ self.eos_token_id = eos_token_id
115
+
116
+ super().__init__(
117
+ bos_token_id=bos_token_id, eos_token_id=eos_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs
118
+ )
119
+
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 106028,
4
+ "eos_token_id": 106068,
5
+ "transformers_version": "4.31.0"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
modeling_moss.py ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ PyTorch Moss model."""
2
+
3
+ from typing import Optional, Tuple, Union
4
+
5
+ import torch
6
+ import torch.utils.checkpoint
7
+ from torch import nn
8
+ from torch.nn import CrossEntropyLoss
9
+
10
+ from transformers.activations import ACT2FN
11
+ from transformers.modeling_utils import PreTrainedModel
12
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
13
+ from transformers.utils import (
14
+ add_code_sample_docstrings,
15
+ add_start_docstrings,
16
+ add_start_docstrings_to_model_forward,
17
+ logging
18
+ )
19
+
20
+ from .configuration_moss import MossConfig
21
+
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+ _CHECKPOINT_FOR_DOC = "fnlp/moss-moon-003-base"
26
+ _CONFIG_FOR_DOC = "MossConfig"
27
+
28
+
29
+ MOSS_PRETRAINED_MODEL_ARCHIVE_LIST = [
30
+ "fnlp/moss-moon-003-base",
31
+ "fnlp/moss-moon-003-sft",
32
+ "fnlp/moss-moon-003-sft-plugin",
33
+ ]
34
+
35
+
36
+ # Copied from transformers.models.gptj.modeling_gptj.create_sinusoidal_positions
37
+ def create_sinusoidal_positions(num_pos: int, dim: int) -> torch.Tensor:
38
+ inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2) / dim))
39
+ sinusoid_inp = torch.einsum("i , j -> i j", torch.arange(num_pos, dtype=torch.float), inv_freq).float()
40
+ return torch.cat((torch.sin(sinusoid_inp), torch.cos(sinusoid_inp)), dim=1)
41
+
42
+
43
+ # Copied from transformers.models.gptj.modeling_gptj.rotate_every_two
44
+ def rotate_every_two(x: torch.Tensor) -> torch.Tensor:
45
+ x1 = x[:, :, :, ::2]
46
+ x2 = x[:, :, :, 1::2]
47
+ x = torch.stack((-x2, x1), dim=-1)
48
+ return x.flatten(-2) # in einsum notation: rearrange(x, '... d j -> ... (d j)')
49
+
50
+
51
+ # Copied from transformers.models.gptj.modeling_gptj.apply_rotary_pos_emb
52
+ def apply_rotary_pos_emb(tensor: torch.Tensor, sin: torch.Tensor, cos: torch.Tensor) -> torch.Tensor:
53
+ sin = torch.repeat_interleave(sin[:, :, None, :], 2, 3)
54
+ cos = torch.repeat_interleave(cos[:, :, None, :], 2, 3)
55
+ return (tensor * cos) + (rotate_every_two(tensor) * sin)
56
+
57
+
58
+ class MossAttention(nn.Module):
59
+ def __init__(self, config):
60
+ super().__init__()
61
+
62
+ max_positions = config.max_position_embeddings
63
+ self.register_buffer(
64
+ "causal_mask",
65
+ torch.tril(torch.ones((max_positions, max_positions), dtype=torch.bool)).view(
66
+ 1, 1, max_positions, max_positions
67
+ ),
68
+ )
69
+
70
+ self.attn_dropout = nn.Dropout(config.attn_pdrop)
71
+ self.resid_dropout = nn.Dropout(config.resid_pdrop)
72
+
73
+ self.embed_dim = config.hidden_size
74
+ self.num_attention_heads = config.num_attention_heads
75
+ self.head_dim = self.embed_dim // self.num_attention_heads
76
+ if self.head_dim * self.num_attention_heads != self.embed_dim:
77
+ raise ValueError(
78
+ f"embed_dim must be divisible by num_attention_heads (got `embed_dim`: {self.embed_dim} and"
79
+ f" `num_attention_heads`: {self.num_attention_heads})."
80
+ )
81
+ self.scale_attn = torch.sqrt(torch.tensor(self.head_dim, dtype=torch.float32)).to(torch.get_default_dtype())
82
+ self.qkv_proj = nn.Linear(self.embed_dim, self.embed_dim * 3, bias=False)
83
+
84
+ self.out_proj = nn.Linear(self.embed_dim, self.embed_dim, bias=False)
85
+ self.rotary_dim = config.rotary_dim
86
+ pos_embd_dim = self.rotary_dim or self.embed_dim
87
+ self.embed_positions = create_sinusoidal_positions(max_positions, pos_embd_dim)
88
+
89
+ def _split_heads(self, x, n_head, dim_head, mp_num):
90
+ reshaped = x.reshape(x.shape[:-1] + (n_head // mp_num, dim_head))
91
+ reshaped = reshaped.reshape(x.shape[:-2] + (-1,) + reshaped.shape[-1:])
92
+ return reshaped
93
+
94
+ def _merge_heads(self, tensor, num_attention_heads, attn_head_size):
95
+ """
96
+ Merges attn_head_size dim and num_attn_heads dim into n_ctx
97
+ """
98
+ if len(tensor.shape) == 5:
99
+ tensor = tensor.permute(0, 1, 3, 2, 4).contiguous()
100
+ elif len(tensor.shape) == 4:
101
+ tensor = tensor.permute(0, 2, 1, 3).contiguous()
102
+ else:
103
+ raise ValueError(f"Input tensor rank should be one of [4, 5], but is: {len(tensor.shape)}")
104
+ new_shape = tensor.size()[:-2] + (num_attention_heads * attn_head_size,)
105
+ return tensor.view(new_shape)
106
+
107
+ def _attn(
108
+ self,
109
+ query,
110
+ key,
111
+ value,
112
+ attention_mask=None,
113
+ head_mask=None,
114
+ ):
115
+ # compute causal mask from causal mask buffer
116
+ query_length, key_length = query.size(-2), key.size(-2)
117
+ causal_mask = self.causal_mask[:, :, key_length - query_length : key_length, :key_length]
118
+
119
+ # Keep the attention weights computation in fp32 to avoid overflow issues
120
+ query = query.to(torch.float32)
121
+ key = key.to(torch.float32)
122
+
123
+ attn_weights = torch.matmul(query, key.transpose(-1, -2))
124
+
125
+ attn_weights = attn_weights / self.scale_attn
126
+ mask_value = torch.finfo(attn_weights.dtype).min
127
+ # Need to be a tensor, otherwise we get error: `RuntimeError: expected scalar type float but found double`.
128
+ # Need to be on the same device, otherwise `RuntimeError: ..., x and y to be on the same device`
129
+ mask_value = torch.tensor(mask_value, dtype=attn_weights.dtype).to(attn_weights.device)
130
+ attn_weights = torch.where(causal_mask, attn_weights, mask_value)
131
+
132
+ if attention_mask is not None:
133
+ # Apply the attention mask
134
+ attn_weights = attn_weights + attention_mask
135
+
136
+ attn_weights = nn.Softmax(dim=-1)(attn_weights)
137
+ attn_weights = attn_weights.to(value.dtype)
138
+ attn_weights = self.attn_dropout(attn_weights)
139
+
140
+ # Mask heads if we want to
141
+ if head_mask is not None:
142
+ attn_weights = attn_weights * head_mask
143
+
144
+ attn_output = torch.matmul(attn_weights, value)
145
+
146
+ return attn_output, attn_weights
147
+
148
+ def forward(
149
+ self,
150
+ hidden_states: Optional[torch.FloatTensor],
151
+ layer_past: Optional[Tuple[torch.Tensor]] = None,
152
+ attention_mask: Optional[torch.FloatTensor] = None,
153
+ position_ids: Optional[torch.LongTensor] = None,
154
+ head_mask: Optional[torch.FloatTensor] = None,
155
+ use_cache: Optional[bool] = False,
156
+ output_attentions: Optional[bool] = False,
157
+ ) -> Union[
158
+ Tuple[torch.Tensor, Tuple[torch.Tensor]],
159
+ Optional[Tuple[torch.Tensor, Tuple[torch.Tensor], Tuple[torch.Tensor, ...]]],
160
+ ]:
161
+ qkv = self.qkv_proj(hidden_states)
162
+ # TODO(enijkamp): factor out number of logical TPU-v4 cores or make forward pass agnostic
163
+ mp_num = 4
164
+ qkv_split = qkv.reshape(qkv.shape[:-1] + (mp_num, -1))
165
+
166
+ local_dim = self.head_dim * self.num_attention_heads // mp_num
167
+ query, value, key = torch.split(qkv_split, local_dim, dim=-1)
168
+ query = self._split_heads(query, self.num_attention_heads, self.head_dim, mp_num=mp_num)
169
+ key = self._split_heads(key, self.num_attention_heads, self.head_dim, mp_num=mp_num)
170
+
171
+ value = self._split_heads(value, self.num_attention_heads, self.head_dim, mp_num=mp_num)
172
+ value = value.permute(0, 2, 1, 3)
173
+
174
+ embed_positions = self.embed_positions
175
+ if embed_positions.device != position_ids.device:
176
+ embed_positions = embed_positions.to(position_ids.device)
177
+ self.embed_positions = embed_positions
178
+
179
+ sincos = embed_positions[position_ids]
180
+ sin, cos = torch.split(sincos, sincos.shape[-1] // 2, dim=-1)
181
+
182
+ if self.rotary_dim is not None:
183
+ k_rot = key[:, :, :, : self.rotary_dim]
184
+ k_pass = key[:, :, :, self.rotary_dim :]
185
+
186
+ q_rot = query[:, :, :, : self.rotary_dim]
187
+ q_pass = query[:, :, :, self.rotary_dim :]
188
+
189
+ k_rot = apply_rotary_pos_emb(k_rot, sin, cos)
190
+ q_rot = apply_rotary_pos_emb(q_rot, sin, cos)
191
+
192
+ key = torch.cat([k_rot, k_pass], dim=-1)
193
+ query = torch.cat([q_rot, q_pass], dim=-1)
194
+ else:
195
+ key = apply_rotary_pos_emb(key, sin, cos)
196
+ query = apply_rotary_pos_emb(query, sin, cos)
197
+
198
+ key = key.permute(0, 2, 1, 3)
199
+ query = query.permute(0, 2, 1, 3)
200
+
201
+ if layer_past is not None:
202
+ past_key = layer_past[0]
203
+ past_value = layer_past[1]
204
+ key = torch.cat((past_key, key), dim=-2)
205
+ value = torch.cat((past_value, value), dim=-2)
206
+
207
+ if use_cache is True:
208
+ present = (key, value)
209
+ else:
210
+ present = None
211
+
212
+ # compute self-attention: V x Softmax(QK^T)
213
+ attn_output, attn_weights = self._attn(query, key, value, attention_mask, head_mask)
214
+
215
+ attn_output = self._merge_heads(attn_output, self.num_attention_heads, self.head_dim)
216
+ attn_output = self.out_proj(attn_output)
217
+ attn_output = self.resid_dropout(attn_output)
218
+
219
+ outputs = (attn_output, present)
220
+ if output_attentions:
221
+ outputs += (attn_weights,)
222
+
223
+ return outputs # a, present, (attentions)
224
+
225
+
226
+ # Copied from transformers.models.gptj.modeling_gptj.GPTJMLP with GPTJ->Moss
227
+ class MossMLP(nn.Module):
228
+ def __init__(self, intermediate_size, config): # in MLP: intermediate_size= 4 * embed_dim
229
+ super().__init__()
230
+ embed_dim = config.n_embd
231
+
232
+ self.fc_in = nn.Linear(embed_dim, intermediate_size)
233
+ self.fc_out = nn.Linear(intermediate_size, embed_dim)
234
+
235
+ self.act = ACT2FN[config.activation_function]
236
+ self.dropout = nn.Dropout(config.resid_pdrop)
237
+
238
+ def forward(self, hidden_states: Optional[torch.FloatTensor]) -> torch.FloatTensor:
239
+ hidden_states = self.fc_in(hidden_states)
240
+ hidden_states = self.act(hidden_states)
241
+ hidden_states = self.fc_out(hidden_states)
242
+ hidden_states = self.dropout(hidden_states)
243
+ return hidden_states
244
+
245
+
246
+ # Copied from transformers.models.gptj.modeling_gptj.GPTJBlock with GPTJ->Moss
247
+ class MossBlock(nn.Module):
248
+ def __init__(self, config):
249
+ super().__init__()
250
+ inner_dim = config.n_inner if config.n_inner is not None else 4 * config.n_embd
251
+ self.ln_1 = nn.LayerNorm(config.n_embd, eps=config.layer_norm_epsilon)
252
+ self.attn = MossAttention(config)
253
+ self.mlp = MossMLP(inner_dim, config)
254
+
255
+ def forward(
256
+ self,
257
+ hidden_states: Optional[torch.FloatTensor],
258
+ layer_past: Optional[Tuple[torch.Tensor]] = None,
259
+ attention_mask: Optional[torch.FloatTensor] = None,
260
+ position_ids: Optional[torch.LongTensor] = None,
261
+ head_mask: Optional[torch.FloatTensor] = None,
262
+ use_cache: Optional[bool] = False,
263
+ output_attentions: Optional[bool] = False,
264
+ ) -> Union[Tuple[torch.Tensor], Optional[Tuple[torch.Tensor, Tuple[torch.FloatTensor, ...]]]]:
265
+ residual = hidden_states
266
+ hidden_states = self.ln_1(hidden_states)
267
+ attn_outputs = self.attn(
268
+ hidden_states=hidden_states,
269
+ layer_past=layer_past,
270
+ attention_mask=attention_mask,
271
+ position_ids=position_ids,
272
+ head_mask=head_mask,
273
+ use_cache=use_cache,
274
+ output_attentions=output_attentions,
275
+ )
276
+ attn_output = attn_outputs[0] # output_attn: a, present, (attentions)
277
+ outputs = attn_outputs[1:]
278
+
279
+ feed_forward_hidden_states = self.mlp(hidden_states)
280
+ hidden_states = attn_output + feed_forward_hidden_states + residual
281
+
282
+ if use_cache:
283
+ outputs = (hidden_states,) + outputs
284
+ else:
285
+ outputs = (hidden_states,) + outputs[1:]
286
+
287
+ return outputs # hidden_states, present, (attentions)
288
+
289
+
290
+ class MossPreTrainedModel(PreTrainedModel):
291
+ """
292
+ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
293
+ models.
294
+ """
295
+
296
+ config_class = MossConfig
297
+ base_model_prefix = "transformer"
298
+ supports_gradient_checkpointing = True
299
+ _no_split_modules = ["MossBlock"]
300
+
301
+ def __init__(self, *inputs, **kwargs):
302
+ super().__init__(*inputs, **kwargs)
303
+
304
+ def _init_weights(self, module):
305
+ """Initialize the weights."""
306
+ if isinstance(module, (nn.Linear,)):
307
+ # Slightly different from Mesh Transformer JAX which uses truncated_normal for initialization
308
+ # cf https://github.com/pytorch/pytorch/pull/5617
309
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
310
+ if module.bias is not None:
311
+ module.bias.data.zero_()
312
+ elif isinstance(module, nn.Embedding):
313
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
314
+ if module.padding_idx is not None:
315
+ module.weight.data[module.padding_idx].zero_()
316
+ elif isinstance(module, nn.LayerNorm):
317
+ module.bias.data.zero_()
318
+ module.weight.data.fill_(1.0)
319
+
320
+ def _set_gradient_checkpointing(self, module, value=False):
321
+ if isinstance(module, MossModel):
322
+ module.gradient_checkpointing = value
323
+
324
+
325
+ MOSS_START_DOCSTRING = r"""
326
+ This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
327
+ it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
328
+ behavior.
329
+
330
+ Parameters:
331
+ config ([`MossConfig`]): Model configuration class with all the parameters of the model.
332
+ Initializing with a config file does not load the weights associated with the model, only the
333
+ configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
334
+ """
335
+
336
+ MOSS_INPUTS_DOCSTRING = r"""
337
+ Args:
338
+ input_ids (`torch.LongTensor` of shape `({0})`):
339
+ Indices of input sequence tokens in the vocabulary.
340
+
341
+ Indices can be obtained using [`AutoProcenizer`]. See [`PreTrainedTokenizer.encode`] and
342
+ [`PreTrainedTokenizer.__call__`] for details.
343
+
344
+ [What are input IDs?](../glossary#input-ids)
345
+ attention_mask (`torch.FloatTensor` of shape `({0})`, *optional*):
346
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
347
+
348
+ - 1 for tokens that are **not masked**,
349
+ - 0 for tokens that are **masked**.
350
+
351
+ [What are attention masks?](../glossary#attention-mask)
352
+ token_type_ids (`torch.LongTensor` of shape `({0})`, *optional*):
353
+ Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
354
+ 1]`:
355
+
356
+ - 0 corresponds to a *sentence A* token,
357
+ - 1 corresponds to a *sentence B* token.
358
+
359
+ [What are token type IDs?](../glossary#token-type-ids)
360
+ position_ids (`torch.LongTensor` of shape `({0})`, *optional*):
361
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
362
+ config.n_positions - 1]`.
363
+
364
+ [What are position IDs?](../glossary#position-ids)
365
+ head_mask (`torch.FloatTensor` of shape `(num_attention_heads,)` or `(n_layer, num_attention_heads)`, *optional*):
366
+ Mask to nullify selected heads of the self-attention modules. Mask values selected in `[0, 1]`:
367
+
368
+ - 1 indicates the head is **not masked**,
369
+ - 0 indicates the head is **masked**.
370
+
371
+ inputs_embeds (`torch.FloatTensor` of shape `({0}, hidden_dim)`, *optional*):
372
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
373
+ is useful if you want more control over how to convert *input_ids* indices into associated vectors than the
374
+ model's internal embedding lookup matrix.
375
+ output_attentions (`bool`, *optional*):
376
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
377
+ tensors for more detail.
378
+ output_hidden_states (`bool`, *optional*):
379
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
380
+ more detail.
381
+ return_dict (`bool`, *optional*):
382
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
383
+ """
384
+
385
+
386
+ @add_start_docstrings(
387
+ "The bare Moss Model transformer outputting raw hidden-states without any specific head on top.",
388
+ MOSS_START_DOCSTRING,
389
+ )
390
+ class MossModel(MossPreTrainedModel):
391
+ def __init__(self, config):
392
+ super().__init__(config)
393
+
394
+ self.embed_dim = config.n_embd
395
+ self.vocab_size = config.vocab_size
396
+ self.wte = nn.Embedding(config.vocab_size, self.embed_dim)
397
+ self.drop = nn.Dropout(config.embd_pdrop)
398
+ self.h = nn.ModuleList([MossBlock(config) for _ in range(config.n_layer)])
399
+ self.ln_f = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)
400
+ self.rotary_dim = min(config.rotary_dim, config.n_ctx // config.num_attention_heads)
401
+
402
+ self.gradient_checkpointing = False
403
+
404
+ # Initialize weights and apply final processing
405
+ self.post_init()
406
+
407
+ def get_input_embeddings(self):
408
+ return self.wte
409
+
410
+ def set_input_embeddings(self, new_embeddings):
411
+ self.wte = new_embeddings
412
+
413
+ @add_start_docstrings_to_model_forward(MOSS_INPUTS_DOCSTRING.format("batch_size, sequence_length"))
414
+ @add_code_sample_docstrings(
415
+ checkpoint=_CHECKPOINT_FOR_DOC,
416
+ output_type=BaseModelOutputWithPast,
417
+ config_class=_CONFIG_FOR_DOC,
418
+ )
419
+ def forward(
420
+ self,
421
+ input_ids: Optional[torch.LongTensor] = None,
422
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
423
+ attention_mask: Optional[torch.FloatTensor] = None,
424
+ token_type_ids: Optional[torch.LongTensor] = None,
425
+ position_ids: Optional[torch.LongTensor] = None,
426
+ head_mask: Optional[torch.FloatTensor] = None,
427
+ inputs_embeds: Optional[torch.FloatTensor] = None,
428
+ use_cache: Optional[bool] = None,
429
+ output_attentions: Optional[bool] = None,
430
+ output_hidden_states: Optional[bool] = None,
431
+ return_dict: Optional[bool] = None,
432
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
433
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
434
+ output_hidden_states = (
435
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
436
+ )
437
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
438
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
439
+
440
+ if input_ids is not None and inputs_embeds is not None:
441
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
442
+ elif input_ids is not None:
443
+ input_shape = input_ids.size()
444
+ input_ids = input_ids.view(-1, input_shape[-1])
445
+ batch_size = input_ids.shape[0]
446
+ elif inputs_embeds is not None:
447
+ input_shape = inputs_embeds.size()[:-1]
448
+ batch_size = inputs_embeds.shape[0]
449
+ else:
450
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
451
+
452
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
453
+
454
+ if token_type_ids is not None:
455
+ token_type_ids = token_type_ids.view(-1, input_shape[-1])
456
+
457
+ if position_ids is not None:
458
+ position_ids = position_ids.view(-1, input_shape[-1]).long()
459
+
460
+ if past_key_values is None:
461
+ past_length = 0
462
+ past_key_values = tuple([None] * len(self.h))
463
+ else:
464
+ past_length = past_key_values[0][0].size(-2)
465
+
466
+ if position_ids is None:
467
+ position_ids = torch.arange(past_length, input_shape[-1] + past_length, dtype=torch.long, device=device)
468
+ position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
469
+
470
+ # Attention mask.
471
+ if attention_mask is not None:
472
+ if batch_size <= 0:
473
+ raise ValueError("batch_size has to be defined and > 0")
474
+ attention_mask = attention_mask.view(batch_size, -1)
475
+ # We create a 3D attention mask from a 2D tensor mask.
476
+ # Sizes are [batch_size, 1, 1, to_seq_length]
477
+ # So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length]
478
+ # this attention mask is more simple than the triangular masking of causal attention
479
+ # used in OpenAI GPT, we just need to prepare the broadcast dimension here.
480
+ attention_mask = attention_mask[:, None, None, :]
481
+
482
+ # Since attention_mask is 1.0 for positions we want to attend and 0.0 for
483
+ # masked positions, this operation will create a tensor which is 0.0 for
484
+ # positions we want to attend and the dtype's smallest value for masked positions.
485
+ # Since we are adding it to the raw scores before the softmax, this is
486
+ # effectively the same as removing these entirely.
487
+ attention_mask = attention_mask.to(dtype=self.dtype) # fp16 compatibility
488
+ attention_mask = (1.0 - attention_mask) * torch.finfo(self.dtype).min
489
+
490
+ # Prepare head mask if needed
491
+ # 1.0 in head_mask indicate we keep the head
492
+ # attention_probs has shape bsz x num_attention_heads x N x N
493
+ # head_mask has shape n_layer x batch x num_attention_heads x N x N
494
+ head_mask = self.get_head_mask(head_mask, self.config.n_layer)
495
+
496
+ if inputs_embeds is None:
497
+ inputs_embeds = self.wte(input_ids)
498
+
499
+ hidden_states = inputs_embeds
500
+
501
+ if token_type_ids is not None:
502
+ token_type_embeds = self.wte(token_type_ids)
503
+ hidden_states = hidden_states + token_type_embeds
504
+
505
+ hidden_states = self.drop(hidden_states)
506
+
507
+ output_shape = input_shape + (hidden_states.size(-1),)
508
+
509
+ if self.gradient_checkpointing and self.training:
510
+ if use_cache:
511
+ logger.warning_once(
512
+ "`use_cache=True` is incompatible with `config.gradient_checkpointing=True`. Setting "
513
+ "`use_cache=False`..."
514
+ )
515
+ use_cache = False
516
+
517
+ presents = () if use_cache else None
518
+ all_self_attentions = () if output_attentions else None
519
+ all_hidden_states = () if output_hidden_states else None
520
+ for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
521
+ if output_hidden_states:
522
+ all_hidden_states = all_hidden_states + (hidden_states,)
523
+
524
+ if self.gradient_checkpointing and self.training:
525
+
526
+ def create_custom_forward(module):
527
+ def custom_forward(*inputs):
528
+ # None for past_key_value
529
+ return module(*inputs, use_cache, output_attentions)
530
+
531
+ return custom_forward
532
+
533
+ outputs = torch.utils.checkpoint.checkpoint(
534
+ create_custom_forward(block),
535
+ hidden_states,
536
+ None,
537
+ attention_mask,
538
+ position_ids,
539
+ head_mask[i],
540
+ )
541
+ else:
542
+ outputs = block(
543
+ hidden_states=hidden_states,
544
+ layer_past=layer_past,
545
+ attention_mask=attention_mask,
546
+ position_ids=position_ids,
547
+ head_mask=head_mask[i],
548
+ use_cache=use_cache,
549
+ output_attentions=output_attentions,
550
+ )
551
+
552
+ hidden_states = outputs[0]
553
+ if use_cache is True:
554
+ presents = presents + (outputs[1],)
555
+
556
+ if output_attentions:
557
+ all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
558
+
559
+ hidden_states = self.ln_f(hidden_states)
560
+
561
+ hidden_states = hidden_states.view(output_shape)
562
+ # Add last hidden state
563
+ if output_hidden_states:
564
+ all_hidden_states = all_hidden_states + (hidden_states,)
565
+
566
+ if not return_dict:
567
+ return tuple(v for v in [hidden_states, presents, all_hidden_states, all_self_attentions] if v is not None)
568
+
569
+ return BaseModelOutputWithPast(
570
+ last_hidden_state=hidden_states,
571
+ past_key_values=presents,
572
+ hidden_states=all_hidden_states,
573
+ attentions=all_self_attentions,
574
+ )
575
+
576
+
577
+ @add_start_docstrings(
578
+ """
579
+ The Moss Model transformer with a language modeling head on top.
580
+ """,
581
+ MOSS_START_DOCSTRING,
582
+ )
583
+ class MossForCausalLM(MossPreTrainedModel):
584
+ _keys_to_ignore_on_load_missing = [r"h\.\d+\.attn\.causal_mask"]
585
+
586
+ def __init__(self, config):
587
+ super().__init__(config)
588
+ self.transformer = MossModel(config)
589
+ self.lm_head = nn.Linear(config.n_embd, config.vocab_size)
590
+
591
+ # Initialize weights and apply final processing
592
+ self.post_init()
593
+
594
+ def get_output_embeddings(self):
595
+ return self.lm_head
596
+
597
+ def set_output_embeddings(self, new_embeddings):
598
+ self.lm_head = new_embeddings
599
+
600
+ def prepare_inputs_for_generation(self, input_ids, past_key_values=None, **kwargs):
601
+ token_type_ids = kwargs.get("token_type_ids", None)
602
+ # only last token for inputs_ids if past is defined in kwargs
603
+ if past_key_values:
604
+ input_ids = input_ids[:, -1].unsqueeze(-1)
605
+ if token_type_ids is not None:
606
+ token_type_ids = token_type_ids[:, -1].unsqueeze(-1)
607
+
608
+ attention_mask = kwargs.get("attention_mask", None)
609
+ position_ids = kwargs.get("position_ids", None)
610
+
611
+ if attention_mask is not None and position_ids is None:
612
+ # create position_ids on the fly for batch generation
613
+ position_ids = attention_mask.long().cumsum(-1) - 1
614
+ position_ids.masked_fill_(attention_mask == 0, 1)
615
+ if past_key_values:
616
+ position_ids = position_ids[:, -1].unsqueeze(-1)
617
+
618
+ return {
619
+ "input_ids": input_ids,
620
+ "past_key_values": past_key_values,
621
+ "use_cache": kwargs.get("use_cache"),
622
+ "position_ids": position_ids,
623
+ "attention_mask": attention_mask,
624
+ "token_type_ids": token_type_ids,
625
+ }
626
+
627
+ @add_start_docstrings_to_model_forward(MOSS_INPUTS_DOCSTRING.format("batch_size, sequence_length"))
628
+ @add_code_sample_docstrings(
629
+ checkpoint=_CHECKPOINT_FOR_DOC,
630
+ output_type=CausalLMOutputWithPast,
631
+ config_class=_CONFIG_FOR_DOC,
632
+ )
633
+ def forward(
634
+ self,
635
+ input_ids: Optional[torch.LongTensor] = None,
636
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
637
+ attention_mask: Optional[torch.FloatTensor] = None,
638
+ token_type_ids: Optional[torch.LongTensor] = None,
639
+ position_ids: Optional[torch.LongTensor] = None,
640
+ head_mask: Optional[torch.FloatTensor] = None,
641
+ inputs_embeds: Optional[torch.FloatTensor] = None,
642
+ labels: Optional[torch.LongTensor] = None,
643
+ use_cache: Optional[bool] = None,
644
+ output_attentions: Optional[bool] = None,
645
+ output_hidden_states: Optional[bool] = None,
646
+ return_dict: Optional[bool] = None,
647
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
648
+ r"""
649
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
650
+ Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
651
+ `labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
652
+ are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
653
+ """
654
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
655
+
656
+ transformer_outputs = self.transformer(
657
+ input_ids,
658
+ past_key_values=past_key_values,
659
+ attention_mask=attention_mask,
660
+ token_type_ids=token_type_ids,
661
+ position_ids=position_ids,
662
+ head_mask=head_mask,
663
+ inputs_embeds=inputs_embeds,
664
+ use_cache=use_cache,
665
+ output_attentions=output_attentions,
666
+ output_hidden_states=output_hidden_states,
667
+ return_dict=return_dict,
668
+ )
669
+ hidden_states = transformer_outputs[0]
670
+
671
+ # make sure sampling in fp16 works correctly and
672
+ # compute loss in fp32 to match with mesh-tf version
673
+ # https://github.com/EleutherAI/gpt-neo/blob/89ce74164da2fb16179106f54e2269b5da8db333/models/gpt2/gpt2.py#L179
674
+ lm_logits = self.lm_head(hidden_states).to(torch.float32)
675
+
676
+ loss = None
677
+ if labels is not None:
678
+ # Shift so that tokens < n predict n
679
+ shift_logits = lm_logits[..., :-1, :].contiguous()
680
+ shift_labels = labels[..., 1:].contiguous()
681
+ # Flatten the tokens
682
+ loss_fct = CrossEntropyLoss()
683
+ loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
684
+
685
+ loss = loss.to(hidden_states.dtype)
686
+
687
+ if not return_dict:
688
+ output = (lm_logits,) + transformer_outputs[1:]
689
+ return ((loss,) + output) if loss is not None else output
690
+
691
+ return CausalLMOutputWithPast(
692
+ loss=loss,
693
+ logits=lm_logits,
694
+ past_key_values=transformer_outputs.past_key_values,
695
+ hidden_states=transformer_outputs.hidden_states,
696
+ attentions=transformer_outputs.attentions,
697
+ )
698
+
699
+ @staticmethod
700
+ def _reorder_cache(
701
+ past_key_values: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor
702
+ ) -> Tuple[Tuple[torch.Tensor]]:
703
+ """
704
+ This function is used to re-order the `past_key_values` cache if [`~PretrainedModel.beam_search`] or
705
+ [`~PretrainedModel.beam_sample`] is called. This is required to match `past_key_values` with the correct
706
+ beam_idx at every generation step.
707
+ """
708
+ return tuple(
709
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past)
710
+ for layer_past in past_key_values
711
+ )
pytorch_model-00001-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:702a50948073e6da944ae9548ccb6ee91c0b4a9f7816aa2af3f28b4ea97605a2
3
+ size 2842383013
pytorch_model-00002-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29923cff5109a90e2ba8db9d6e5608f924a815fdc7c4315cd45b0c105941d343
3
+ size 2744206923
pytorch_model-00003-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72a9656f24ec544e061b0213fc92f9d022eb88b73f580bce6a667dcdc00c9adf
3
+ size 2744206987
pytorch_model-00004-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08169974eba522e85d88bca1a45eb085ee7b48c1a9c5b7f4db24e418936f46f6
3
+ size 2744206987
pytorch_model-00005-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1460ab4a2754d327b6ea86210a3fb52404769aa49aae143b8fb65650081c27d
3
+ size 2744206987
pytorch_model-00006-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24dd1bbc6c4540b5462acdf2afed93671e6fcb8f1972cdd6a6ca14946ea60ec5
3
+ size 2744206987
pytorch_model-00007-of-00007.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1971b89f4991d1f88941b3da69f36e1452159fb954d673034c0228e0991e0562
3
+ size 1617157439
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 18055646336.0
4
+ },
5
+ "weight_map": {
6
+ "lm_head.bias": "pytorch_model-00007-of-00007.bin",
7
+ "lm_head.weight": "pytorch_model-00007-of-00007.bin",
8
+ "transformer.h.0.attn.causal_mask": "pytorch_model-00001-of-00007.bin",
9
+ "transformer.h.0.attn.embed_positions.inv_freq": "pytorch_model-00001-of-00007.bin",
10
+ "transformer.h.0.attn.out_proj.weight": "pytorch_model-00001-of-00007.bin",
11
+ "transformer.h.0.attn.out_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
12
+ "transformer.h.0.attn.qkv_proj.weight": "pytorch_model-00001-of-00007.bin",
13
+ "transformer.h.0.attn.qkv_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
14
+ "transformer.h.0.ln_1.bias": "pytorch_model-00001-of-00007.bin",
15
+ "transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00007.bin",
16
+ "transformer.h.0.mlp.fc_in.bias": "pytorch_model-00001-of-00007.bin",
17
+ "transformer.h.0.mlp.fc_in.weight": "pytorch_model-00001-of-00007.bin",
18
+ "transformer.h.0.mlp.fc_in.weight_scale": "pytorch_model-00001-of-00007.bin",
19
+ "transformer.h.0.mlp.fc_out.bias": "pytorch_model-00001-of-00007.bin",
20
+ "transformer.h.0.mlp.fc_out.weight": "pytorch_model-00001-of-00007.bin",
21
+ "transformer.h.1.attn.causal_mask": "pytorch_model-00001-of-00007.bin",
22
+ "transformer.h.1.attn.embed_positions.inv_freq": "pytorch_model-00001-of-00007.bin",
23
+ "transformer.h.1.attn.out_proj.weight": "pytorch_model-00001-of-00007.bin",
24
+ "transformer.h.1.attn.out_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
25
+ "transformer.h.1.attn.qkv_proj.weight": "pytorch_model-00001-of-00007.bin",
26
+ "transformer.h.1.attn.qkv_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
27
+ "transformer.h.1.ln_1.bias": "pytorch_model-00001-of-00007.bin",
28
+ "transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00007.bin",
29
+ "transformer.h.1.mlp.fc_in.bias": "pytorch_model-00001-of-00007.bin",
30
+ "transformer.h.1.mlp.fc_in.weight": "pytorch_model-00001-of-00007.bin",
31
+ "transformer.h.1.mlp.fc_in.weight_scale": "pytorch_model-00001-of-00007.bin",
32
+ "transformer.h.1.mlp.fc_out.bias": "pytorch_model-00001-of-00007.bin",
33
+ "transformer.h.1.mlp.fc_out.weight": "pytorch_model-00001-of-00007.bin",
34
+ "transformer.h.10.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
35
+ "transformer.h.10.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
36
+ "transformer.h.10.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
37
+ "transformer.h.10.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
38
+ "transformer.h.10.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
39
+ "transformer.h.10.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
40
+ "transformer.h.10.ln_1.bias": "pytorch_model-00003-of-00007.bin",
41
+ "transformer.h.10.ln_1.weight": "pytorch_model-00003-of-00007.bin",
42
+ "transformer.h.10.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
43
+ "transformer.h.10.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
44
+ "transformer.h.10.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
45
+ "transformer.h.10.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
46
+ "transformer.h.10.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
47
+ "transformer.h.11.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
48
+ "transformer.h.11.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
49
+ "transformer.h.11.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
50
+ "transformer.h.11.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
51
+ "transformer.h.11.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
52
+ "transformer.h.11.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
53
+ "transformer.h.11.ln_1.bias": "pytorch_model-00003-of-00007.bin",
54
+ "transformer.h.11.ln_1.weight": "pytorch_model-00003-of-00007.bin",
55
+ "transformer.h.11.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
56
+ "transformer.h.11.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
57
+ "transformer.h.11.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
58
+ "transformer.h.11.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
59
+ "transformer.h.11.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
60
+ "transformer.h.12.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
61
+ "transformer.h.12.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
62
+ "transformer.h.12.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
63
+ "transformer.h.12.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
64
+ "transformer.h.12.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
65
+ "transformer.h.12.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
66
+ "transformer.h.12.ln_1.bias": "pytorch_model-00003-of-00007.bin",
67
+ "transformer.h.12.ln_1.weight": "pytorch_model-00003-of-00007.bin",
68
+ "transformer.h.12.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
69
+ "transformer.h.12.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
70
+ "transformer.h.12.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
71
+ "transformer.h.12.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
72
+ "transformer.h.12.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
73
+ "transformer.h.13.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
74
+ "transformer.h.13.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
75
+ "transformer.h.13.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
76
+ "transformer.h.13.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
77
+ "transformer.h.13.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
78
+ "transformer.h.13.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
79
+ "transformer.h.13.ln_1.bias": "pytorch_model-00003-of-00007.bin",
80
+ "transformer.h.13.ln_1.weight": "pytorch_model-00003-of-00007.bin",
81
+ "transformer.h.13.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
82
+ "transformer.h.13.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
83
+ "transformer.h.13.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
84
+ "transformer.h.13.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
85
+ "transformer.h.13.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
86
+ "transformer.h.14.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
87
+ "transformer.h.14.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
88
+ "transformer.h.14.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
89
+ "transformer.h.14.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
90
+ "transformer.h.14.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
91
+ "transformer.h.14.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
92
+ "transformer.h.14.ln_1.bias": "pytorch_model-00003-of-00007.bin",
93
+ "transformer.h.14.ln_1.weight": "pytorch_model-00003-of-00007.bin",
94
+ "transformer.h.14.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
95
+ "transformer.h.14.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
96
+ "transformer.h.14.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
97
+ "transformer.h.14.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
98
+ "transformer.h.14.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
99
+ "transformer.h.15.attn.causal_mask": "pytorch_model-00003-of-00007.bin",
100
+ "transformer.h.15.attn.embed_positions.inv_freq": "pytorch_model-00003-of-00007.bin",
101
+ "transformer.h.15.attn.out_proj.weight": "pytorch_model-00003-of-00007.bin",
102
+ "transformer.h.15.attn.out_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
103
+ "transformer.h.15.attn.qkv_proj.weight": "pytorch_model-00003-of-00007.bin",
104
+ "transformer.h.15.attn.qkv_proj.weight_scale": "pytorch_model-00003-of-00007.bin",
105
+ "transformer.h.15.ln_1.bias": "pytorch_model-00003-of-00007.bin",
106
+ "transformer.h.15.ln_1.weight": "pytorch_model-00003-of-00007.bin",
107
+ "transformer.h.15.mlp.fc_in.bias": "pytorch_model-00003-of-00007.bin",
108
+ "transformer.h.15.mlp.fc_in.weight": "pytorch_model-00003-of-00007.bin",
109
+ "transformer.h.15.mlp.fc_in.weight_scale": "pytorch_model-00003-of-00007.bin",
110
+ "transformer.h.15.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
111
+ "transformer.h.15.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
112
+ "transformer.h.16.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
113
+ "transformer.h.16.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
114
+ "transformer.h.16.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
115
+ "transformer.h.16.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
116
+ "transformer.h.16.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
117
+ "transformer.h.16.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
118
+ "transformer.h.16.ln_1.bias": "pytorch_model-00004-of-00007.bin",
119
+ "transformer.h.16.ln_1.weight": "pytorch_model-00004-of-00007.bin",
120
+ "transformer.h.16.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
121
+ "transformer.h.16.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
122
+ "transformer.h.16.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
123
+ "transformer.h.16.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
124
+ "transformer.h.16.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
125
+ "transformer.h.17.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
126
+ "transformer.h.17.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
127
+ "transformer.h.17.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
128
+ "transformer.h.17.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
129
+ "transformer.h.17.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
130
+ "transformer.h.17.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
131
+ "transformer.h.17.ln_1.bias": "pytorch_model-00004-of-00007.bin",
132
+ "transformer.h.17.ln_1.weight": "pytorch_model-00004-of-00007.bin",
133
+ "transformer.h.17.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
134
+ "transformer.h.17.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
135
+ "transformer.h.17.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
136
+ "transformer.h.17.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
137
+ "transformer.h.17.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
138
+ "transformer.h.18.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
139
+ "transformer.h.18.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
140
+ "transformer.h.18.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
141
+ "transformer.h.18.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
142
+ "transformer.h.18.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
143
+ "transformer.h.18.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
144
+ "transformer.h.18.ln_1.bias": "pytorch_model-00004-of-00007.bin",
145
+ "transformer.h.18.ln_1.weight": "pytorch_model-00004-of-00007.bin",
146
+ "transformer.h.18.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
147
+ "transformer.h.18.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
148
+ "transformer.h.18.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
149
+ "transformer.h.18.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
150
+ "transformer.h.18.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
151
+ "transformer.h.19.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
152
+ "transformer.h.19.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
153
+ "transformer.h.19.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
154
+ "transformer.h.19.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
155
+ "transformer.h.19.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
156
+ "transformer.h.19.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
157
+ "transformer.h.19.ln_1.bias": "pytorch_model-00004-of-00007.bin",
158
+ "transformer.h.19.ln_1.weight": "pytorch_model-00004-of-00007.bin",
159
+ "transformer.h.19.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
160
+ "transformer.h.19.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
161
+ "transformer.h.19.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
162
+ "transformer.h.19.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
163
+ "transformer.h.19.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
164
+ "transformer.h.2.attn.causal_mask": "pytorch_model-00001-of-00007.bin",
165
+ "transformer.h.2.attn.embed_positions.inv_freq": "pytorch_model-00001-of-00007.bin",
166
+ "transformer.h.2.attn.out_proj.weight": "pytorch_model-00001-of-00007.bin",
167
+ "transformer.h.2.attn.out_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
168
+ "transformer.h.2.attn.qkv_proj.weight": "pytorch_model-00001-of-00007.bin",
169
+ "transformer.h.2.attn.qkv_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
170
+ "transformer.h.2.ln_1.bias": "pytorch_model-00001-of-00007.bin",
171
+ "transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00007.bin",
172
+ "transformer.h.2.mlp.fc_in.bias": "pytorch_model-00001-of-00007.bin",
173
+ "transformer.h.2.mlp.fc_in.weight": "pytorch_model-00001-of-00007.bin",
174
+ "transformer.h.2.mlp.fc_in.weight_scale": "pytorch_model-00001-of-00007.bin",
175
+ "transformer.h.2.mlp.fc_out.bias": "pytorch_model-00001-of-00007.bin",
176
+ "transformer.h.2.mlp.fc_out.weight": "pytorch_model-00001-of-00007.bin",
177
+ "transformer.h.20.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
178
+ "transformer.h.20.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
179
+ "transformer.h.20.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
180
+ "transformer.h.20.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
181
+ "transformer.h.20.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
182
+ "transformer.h.20.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
183
+ "transformer.h.20.ln_1.bias": "pytorch_model-00004-of-00007.bin",
184
+ "transformer.h.20.ln_1.weight": "pytorch_model-00004-of-00007.bin",
185
+ "transformer.h.20.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
186
+ "transformer.h.20.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
187
+ "transformer.h.20.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
188
+ "transformer.h.20.mlp.fc_out.bias": "pytorch_model-00004-of-00007.bin",
189
+ "transformer.h.20.mlp.fc_out.weight": "pytorch_model-00004-of-00007.bin",
190
+ "transformer.h.21.attn.causal_mask": "pytorch_model-00004-of-00007.bin",
191
+ "transformer.h.21.attn.embed_positions.inv_freq": "pytorch_model-00004-of-00007.bin",
192
+ "transformer.h.21.attn.out_proj.weight": "pytorch_model-00004-of-00007.bin",
193
+ "transformer.h.21.attn.out_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
194
+ "transformer.h.21.attn.qkv_proj.weight": "pytorch_model-00004-of-00007.bin",
195
+ "transformer.h.21.attn.qkv_proj.weight_scale": "pytorch_model-00004-of-00007.bin",
196
+ "transformer.h.21.ln_1.bias": "pytorch_model-00004-of-00007.bin",
197
+ "transformer.h.21.ln_1.weight": "pytorch_model-00004-of-00007.bin",
198
+ "transformer.h.21.mlp.fc_in.bias": "pytorch_model-00004-of-00007.bin",
199
+ "transformer.h.21.mlp.fc_in.weight": "pytorch_model-00004-of-00007.bin",
200
+ "transformer.h.21.mlp.fc_in.weight_scale": "pytorch_model-00004-of-00007.bin",
201
+ "transformer.h.21.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
202
+ "transformer.h.21.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
203
+ "transformer.h.22.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
204
+ "transformer.h.22.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
205
+ "transformer.h.22.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
206
+ "transformer.h.22.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
207
+ "transformer.h.22.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
208
+ "transformer.h.22.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
209
+ "transformer.h.22.ln_1.bias": "pytorch_model-00005-of-00007.bin",
210
+ "transformer.h.22.ln_1.weight": "pytorch_model-00005-of-00007.bin",
211
+ "transformer.h.22.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
212
+ "transformer.h.22.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
213
+ "transformer.h.22.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
214
+ "transformer.h.22.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
215
+ "transformer.h.22.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
216
+ "transformer.h.23.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
217
+ "transformer.h.23.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
218
+ "transformer.h.23.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
219
+ "transformer.h.23.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
220
+ "transformer.h.23.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
221
+ "transformer.h.23.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
222
+ "transformer.h.23.ln_1.bias": "pytorch_model-00005-of-00007.bin",
223
+ "transformer.h.23.ln_1.weight": "pytorch_model-00005-of-00007.bin",
224
+ "transformer.h.23.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
225
+ "transformer.h.23.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
226
+ "transformer.h.23.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
227
+ "transformer.h.23.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
228
+ "transformer.h.23.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
229
+ "transformer.h.24.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
230
+ "transformer.h.24.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
231
+ "transformer.h.24.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
232
+ "transformer.h.24.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
233
+ "transformer.h.24.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
234
+ "transformer.h.24.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
235
+ "transformer.h.24.ln_1.bias": "pytorch_model-00005-of-00007.bin",
236
+ "transformer.h.24.ln_1.weight": "pytorch_model-00005-of-00007.bin",
237
+ "transformer.h.24.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
238
+ "transformer.h.24.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
239
+ "transformer.h.24.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
240
+ "transformer.h.24.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
241
+ "transformer.h.24.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
242
+ "transformer.h.25.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
243
+ "transformer.h.25.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
244
+ "transformer.h.25.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
245
+ "transformer.h.25.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
246
+ "transformer.h.25.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
247
+ "transformer.h.25.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
248
+ "transformer.h.25.ln_1.bias": "pytorch_model-00005-of-00007.bin",
249
+ "transformer.h.25.ln_1.weight": "pytorch_model-00005-of-00007.bin",
250
+ "transformer.h.25.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
251
+ "transformer.h.25.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
252
+ "transformer.h.25.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
253
+ "transformer.h.25.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
254
+ "transformer.h.25.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
255
+ "transformer.h.26.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
256
+ "transformer.h.26.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
257
+ "transformer.h.26.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
258
+ "transformer.h.26.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
259
+ "transformer.h.26.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
260
+ "transformer.h.26.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
261
+ "transformer.h.26.ln_1.bias": "pytorch_model-00005-of-00007.bin",
262
+ "transformer.h.26.ln_1.weight": "pytorch_model-00005-of-00007.bin",
263
+ "transformer.h.26.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
264
+ "transformer.h.26.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
265
+ "transformer.h.26.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
266
+ "transformer.h.26.mlp.fc_out.bias": "pytorch_model-00005-of-00007.bin",
267
+ "transformer.h.26.mlp.fc_out.weight": "pytorch_model-00005-of-00007.bin",
268
+ "transformer.h.27.attn.causal_mask": "pytorch_model-00005-of-00007.bin",
269
+ "transformer.h.27.attn.embed_positions.inv_freq": "pytorch_model-00005-of-00007.bin",
270
+ "transformer.h.27.attn.out_proj.weight": "pytorch_model-00005-of-00007.bin",
271
+ "transformer.h.27.attn.out_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
272
+ "transformer.h.27.attn.qkv_proj.weight": "pytorch_model-00005-of-00007.bin",
273
+ "transformer.h.27.attn.qkv_proj.weight_scale": "pytorch_model-00005-of-00007.bin",
274
+ "transformer.h.27.ln_1.bias": "pytorch_model-00005-of-00007.bin",
275
+ "transformer.h.27.ln_1.weight": "pytorch_model-00005-of-00007.bin",
276
+ "transformer.h.27.mlp.fc_in.bias": "pytorch_model-00005-of-00007.bin",
277
+ "transformer.h.27.mlp.fc_in.weight": "pytorch_model-00005-of-00007.bin",
278
+ "transformer.h.27.mlp.fc_in.weight_scale": "pytorch_model-00005-of-00007.bin",
279
+ "transformer.h.27.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
280
+ "transformer.h.27.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
281
+ "transformer.h.28.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
282
+ "transformer.h.28.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
283
+ "transformer.h.28.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
284
+ "transformer.h.28.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
285
+ "transformer.h.28.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
286
+ "transformer.h.28.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
287
+ "transformer.h.28.ln_1.bias": "pytorch_model-00006-of-00007.bin",
288
+ "transformer.h.28.ln_1.weight": "pytorch_model-00006-of-00007.bin",
289
+ "transformer.h.28.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
290
+ "transformer.h.28.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
291
+ "transformer.h.28.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
292
+ "transformer.h.28.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
293
+ "transformer.h.28.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
294
+ "transformer.h.29.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
295
+ "transformer.h.29.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
296
+ "transformer.h.29.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
297
+ "transformer.h.29.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
298
+ "transformer.h.29.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
299
+ "transformer.h.29.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
300
+ "transformer.h.29.ln_1.bias": "pytorch_model-00006-of-00007.bin",
301
+ "transformer.h.29.ln_1.weight": "pytorch_model-00006-of-00007.bin",
302
+ "transformer.h.29.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
303
+ "transformer.h.29.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
304
+ "transformer.h.29.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
305
+ "transformer.h.29.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
306
+ "transformer.h.29.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
307
+ "transformer.h.3.attn.causal_mask": "pytorch_model-00001-of-00007.bin",
308
+ "transformer.h.3.attn.embed_positions.inv_freq": "pytorch_model-00001-of-00007.bin",
309
+ "transformer.h.3.attn.out_proj.weight": "pytorch_model-00001-of-00007.bin",
310
+ "transformer.h.3.attn.out_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
311
+ "transformer.h.3.attn.qkv_proj.weight": "pytorch_model-00001-of-00007.bin",
312
+ "transformer.h.3.attn.qkv_proj.weight_scale": "pytorch_model-00001-of-00007.bin",
313
+ "transformer.h.3.ln_1.bias": "pytorch_model-00001-of-00007.bin",
314
+ "transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00007.bin",
315
+ "transformer.h.3.mlp.fc_in.bias": "pytorch_model-00001-of-00007.bin",
316
+ "transformer.h.3.mlp.fc_in.weight": "pytorch_model-00001-of-00007.bin",
317
+ "transformer.h.3.mlp.fc_in.weight_scale": "pytorch_model-00001-of-00007.bin",
318
+ "transformer.h.3.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
319
+ "transformer.h.3.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
320
+ "transformer.h.30.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
321
+ "transformer.h.30.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
322
+ "transformer.h.30.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
323
+ "transformer.h.30.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
324
+ "transformer.h.30.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
325
+ "transformer.h.30.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
326
+ "transformer.h.30.ln_1.bias": "pytorch_model-00006-of-00007.bin",
327
+ "transformer.h.30.ln_1.weight": "pytorch_model-00006-of-00007.bin",
328
+ "transformer.h.30.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
329
+ "transformer.h.30.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
330
+ "transformer.h.30.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
331
+ "transformer.h.30.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
332
+ "transformer.h.30.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
333
+ "transformer.h.31.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
334
+ "transformer.h.31.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
335
+ "transformer.h.31.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
336
+ "transformer.h.31.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
337
+ "transformer.h.31.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
338
+ "transformer.h.31.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
339
+ "transformer.h.31.ln_1.bias": "pytorch_model-00006-of-00007.bin",
340
+ "transformer.h.31.ln_1.weight": "pytorch_model-00006-of-00007.bin",
341
+ "transformer.h.31.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
342
+ "transformer.h.31.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
343
+ "transformer.h.31.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
344
+ "transformer.h.31.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
345
+ "transformer.h.31.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
346
+ "transformer.h.32.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
347
+ "transformer.h.32.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
348
+ "transformer.h.32.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
349
+ "transformer.h.32.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
350
+ "transformer.h.32.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
351
+ "transformer.h.32.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
352
+ "transformer.h.32.ln_1.bias": "pytorch_model-00006-of-00007.bin",
353
+ "transformer.h.32.ln_1.weight": "pytorch_model-00006-of-00007.bin",
354
+ "transformer.h.32.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
355
+ "transformer.h.32.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
356
+ "transformer.h.32.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
357
+ "transformer.h.32.mlp.fc_out.bias": "pytorch_model-00006-of-00007.bin",
358
+ "transformer.h.32.mlp.fc_out.weight": "pytorch_model-00006-of-00007.bin",
359
+ "transformer.h.33.attn.causal_mask": "pytorch_model-00006-of-00007.bin",
360
+ "transformer.h.33.attn.embed_positions.inv_freq": "pytorch_model-00006-of-00007.bin",
361
+ "transformer.h.33.attn.out_proj.weight": "pytorch_model-00006-of-00007.bin",
362
+ "transformer.h.33.attn.out_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
363
+ "transformer.h.33.attn.qkv_proj.weight": "pytorch_model-00006-of-00007.bin",
364
+ "transformer.h.33.attn.qkv_proj.weight_scale": "pytorch_model-00006-of-00007.bin",
365
+ "transformer.h.33.ln_1.bias": "pytorch_model-00006-of-00007.bin",
366
+ "transformer.h.33.ln_1.weight": "pytorch_model-00006-of-00007.bin",
367
+ "transformer.h.33.mlp.fc_in.bias": "pytorch_model-00006-of-00007.bin",
368
+ "transformer.h.33.mlp.fc_in.weight": "pytorch_model-00006-of-00007.bin",
369
+ "transformer.h.33.mlp.fc_in.weight_scale": "pytorch_model-00006-of-00007.bin",
370
+ "transformer.h.33.mlp.fc_out.bias": "pytorch_model-00007-of-00007.bin",
371
+ "transformer.h.33.mlp.fc_out.weight": "pytorch_model-00007-of-00007.bin",
372
+ "transformer.h.4.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
373
+ "transformer.h.4.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
374
+ "transformer.h.4.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
375
+ "transformer.h.4.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
376
+ "transformer.h.4.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
377
+ "transformer.h.4.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
378
+ "transformer.h.4.ln_1.bias": "pytorch_model-00002-of-00007.bin",
379
+ "transformer.h.4.ln_1.weight": "pytorch_model-00002-of-00007.bin",
380
+ "transformer.h.4.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
381
+ "transformer.h.4.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
382
+ "transformer.h.4.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
383
+ "transformer.h.4.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
384
+ "transformer.h.4.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
385
+ "transformer.h.5.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
386
+ "transformer.h.5.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
387
+ "transformer.h.5.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
388
+ "transformer.h.5.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
389
+ "transformer.h.5.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
390
+ "transformer.h.5.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
391
+ "transformer.h.5.ln_1.bias": "pytorch_model-00002-of-00007.bin",
392
+ "transformer.h.5.ln_1.weight": "pytorch_model-00002-of-00007.bin",
393
+ "transformer.h.5.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
394
+ "transformer.h.5.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
395
+ "transformer.h.5.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
396
+ "transformer.h.5.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
397
+ "transformer.h.5.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
398
+ "transformer.h.6.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
399
+ "transformer.h.6.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
400
+ "transformer.h.6.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
401
+ "transformer.h.6.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
402
+ "transformer.h.6.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
403
+ "transformer.h.6.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
404
+ "transformer.h.6.ln_1.bias": "pytorch_model-00002-of-00007.bin",
405
+ "transformer.h.6.ln_1.weight": "pytorch_model-00002-of-00007.bin",
406
+ "transformer.h.6.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
407
+ "transformer.h.6.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
408
+ "transformer.h.6.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
409
+ "transformer.h.6.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
410
+ "transformer.h.6.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
411
+ "transformer.h.7.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
412
+ "transformer.h.7.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
413
+ "transformer.h.7.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
414
+ "transformer.h.7.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
415
+ "transformer.h.7.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
416
+ "transformer.h.7.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
417
+ "transformer.h.7.ln_1.bias": "pytorch_model-00002-of-00007.bin",
418
+ "transformer.h.7.ln_1.weight": "pytorch_model-00002-of-00007.bin",
419
+ "transformer.h.7.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
420
+ "transformer.h.7.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
421
+ "transformer.h.7.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
422
+ "transformer.h.7.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
423
+ "transformer.h.7.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
424
+ "transformer.h.8.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
425
+ "transformer.h.8.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
426
+ "transformer.h.8.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
427
+ "transformer.h.8.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
428
+ "transformer.h.8.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
429
+ "transformer.h.8.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
430
+ "transformer.h.8.ln_1.bias": "pytorch_model-00002-of-00007.bin",
431
+ "transformer.h.8.ln_1.weight": "pytorch_model-00002-of-00007.bin",
432
+ "transformer.h.8.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
433
+ "transformer.h.8.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
434
+ "transformer.h.8.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
435
+ "transformer.h.8.mlp.fc_out.bias": "pytorch_model-00002-of-00007.bin",
436
+ "transformer.h.8.mlp.fc_out.weight": "pytorch_model-00002-of-00007.bin",
437
+ "transformer.h.9.attn.causal_mask": "pytorch_model-00002-of-00007.bin",
438
+ "transformer.h.9.attn.embed_positions.inv_freq": "pytorch_model-00002-of-00007.bin",
439
+ "transformer.h.9.attn.out_proj.weight": "pytorch_model-00002-of-00007.bin",
440
+ "transformer.h.9.attn.out_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
441
+ "transformer.h.9.attn.qkv_proj.weight": "pytorch_model-00002-of-00007.bin",
442
+ "transformer.h.9.attn.qkv_proj.weight_scale": "pytorch_model-00002-of-00007.bin",
443
+ "transformer.h.9.ln_1.bias": "pytorch_model-00002-of-00007.bin",
444
+ "transformer.h.9.ln_1.weight": "pytorch_model-00002-of-00007.bin",
445
+ "transformer.h.9.mlp.fc_in.bias": "pytorch_model-00002-of-00007.bin",
446
+ "transformer.h.9.mlp.fc_in.weight": "pytorch_model-00002-of-00007.bin",
447
+ "transformer.h.9.mlp.fc_in.weight_scale": "pytorch_model-00002-of-00007.bin",
448
+ "transformer.h.9.mlp.fc_out.bias": "pytorch_model-00003-of-00007.bin",
449
+ "transformer.h.9.mlp.fc_out.weight": "pytorch_model-00003-of-00007.bin",
450
+ "transformer.ln_f.bias": "pytorch_model-00007-of-00007.bin",
451
+ "transformer.ln_f.weight": "pytorch_model-00007-of-00007.bin",
452
+ "transformer.wte.weight": "pytorch_model-00001-of-00007.bin"
453
+ }
454
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "<eoh>",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "<eom>",
12
+ "lstrip": false,
13
+ "normalized": true,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ },
17
+ {
18
+ "content": "<eot>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ {
25
+ "content": "<eoc>",
26
+ "lstrip": false,
27
+ "normalized": true,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ {
32
+ "content": "<eor>",
33
+ "lstrip": false,
34
+ "normalized": true,
35
+ "rstrip": false,
36
+ "single_word": false
37
+ }
38
+ ],
39
+ "bos_token": "<|endoftext|>",
40
+ "eos_token": {
41
+ "content": "<eom>",
42
+ "lstrip": false,
43
+ "normalized": true,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ },
47
+ "unk_token": "<|endoftext|>"
48
+ }
tokenization_moss.py ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tokenization classes for Moss"""
2
+
3
+ import json
4
+ import os
5
+ import numpy as np
6
+ import regex as re
7
+
8
+ from functools import lru_cache
9
+ from typing import TYPE_CHECKING, List, Optional, Tuple, Union
10
+
11
+ from transformers.utils import is_tf_available, is_torch_available, logging
12
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
13
+
14
+
15
+ if TYPE_CHECKING:
16
+ if is_torch_available():
17
+ import torch
18
+ if is_tf_available():
19
+ import tensorflow as tf
20
+
21
+
22
+ logger = logging.get_logger(__name__)
23
+
24
+ VOCAB_FILES_NAMES = {
25
+ "vocab_file": "vocab.json",
26
+ "merges_file": "merges.txt",
27
+ }
28
+
29
+ PRETRAINED_VOCAB_FILES_MAP = {
30
+ "vocab_file": {
31
+ "fnlp/moss-moon-003-base": "https://huggingface.co/fnlp/moss-moon-003-base/resolve/main/vocab.json",
32
+ "fnlp/moss-moon-003-sft": "https://huggingface.co/fnlp/moss-moon-003-sft/resolve/main/vocab.json",
33
+ "fnlp/moss-moon-003-sft-plugin": "https://huggingface.co/fnlp/moss-moon-003-sft-plugin/resolve/main/vocab.json",
34
+ },
35
+ "merges_file": {
36
+ "fnlp/moss-moon-003-base": "https://huggingface.co/fnlp/moss-moon-003-base/resolve/main/merge.txt",
37
+ "fnlp/moss-moon-003-sft": "https://huggingface.co/fnlp/moss-moon-003-sft/resolve/main/merge.txt",
38
+ "fnlp/moss-moon-003-sft-plugin": "https://huggingface.co/fnlp/moss-moon-003-sft-plugin/resolve/main/merge.txt",
39
+ },
40
+ }
41
+
42
+ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
43
+ "fnlp/moss-moon-003-base": 2048,
44
+ "fnlp/moss-moon-003-sft": 2048,
45
+ "fnlp/moss-moon-003-sft-plugin": 2048,
46
+ }
47
+
48
+
49
+ @lru_cache()
50
+ def bytes_to_unicode():
51
+ """
52
+ Returns list of utf-8 byte and a mapping to unicode strings. We specifically avoids mapping to whitespace/control
53
+ characters the bpe code barfs on.
54
+
55
+ The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab
56
+ if you want to avoid UNKs. When you're at something like a 10B token dataset you end up needing around 5K for
57
+ decent coverage. This is a significant percentage of your normal, say, 32K bpe vocab. To avoid that, we want lookup
58
+ tables between utf-8 bytes and unicode strings.
59
+ """
60
+ bs = (
61
+ list(range(ord("!"), ord("~") + 1)) + list(range(ord("¡"), ord("¬") + 1)) + list(range(ord("®"), ord("ÿ") + 1))
62
+ )
63
+ cs = bs[:]
64
+ n = 0
65
+ for b in range(2**8):
66
+ if b not in bs:
67
+ bs.append(b)
68
+ cs.append(2**8 + n)
69
+ n += 1
70
+ cs = [chr(n) for n in cs]
71
+ return dict(zip(bs, cs))
72
+
73
+
74
+ def get_pairs(word):
75
+ """
76
+ Return set of symbol pairs in a word.
77
+
78
+ Word is represented as tuple of symbols (symbols being variable-length strings).
79
+ """
80
+ pairs = set()
81
+ prev_char = word[0]
82
+ for char in word[1:]:
83
+ pairs.add((prev_char, char))
84
+ prev_char = char
85
+ return pairs
86
+
87
+
88
+ class MossTokenizer(PreTrainedTokenizer):
89
+ """
90
+ Construct a Moss tokenizer. Based on byte-level Byte-Pair-Encoding.
91
+
92
+ This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
93
+ be encoded differently whether it is at the beginning of the sentence (without space) or not:
94
+
95
+ You can get around that behavior by passing `add_prefix_space=True` when instantiating this tokenizer or when you
96
+ call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.
97
+
98
+ <Tip>
99
+
100
+ When used with `is_split_into_words=True`, this tokenizer will add a space before each word (even the first one).
101
+
102
+ </Tip>
103
+
104
+ This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
105
+ this superclass for more information regarding those methods.
106
+
107
+ Args:
108
+ vocab_file (`str`):
109
+ Path to the vocabulary file.
110
+ merges_file (`str`):
111
+ Path to the merges file.
112
+ errors (`str`, *optional*, defaults to `"replace"`):
113
+ Paradigm to follow when decoding bytes to UTF-8. See
114
+ [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
115
+ unk_token (`str`, *optional*, defaults to `<|endoftext|>`):
116
+ The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
117
+ token instead.
118
+ bos_token (`str`, *optional*, defaults to `<|endoftext|>`):
119
+ The beginning of sequence token.
120
+ eos_token (`str`, *optional*, defaults to `<|endoftext|>`):
121
+ The end of sequence token.
122
+ add_prefix_space (`bool`, *optional*, defaults to `False`):
123
+ Whether or not to add an initial space to the input. This allows to treat the leading word just as any
124
+ other word. (Moss tokenizer detect beginning of words by the preceding space).
125
+ """
126
+
127
+ vocab_files_names = VOCAB_FILES_NAMES
128
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
129
+ max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
130
+ model_input_names = ["input_ids", "attention_mask"]
131
+
132
+ def __init__(
133
+ self,
134
+ vocab_file,
135
+ merges_file,
136
+ errors="replace",
137
+ unk_token="<|endoftext|>",
138
+ bos_token="<|endoftext|>",
139
+ eos_token="<eom>",
140
+ pad_token=None,
141
+ add_prefix_space=False,
142
+ add_bos_token=False,
143
+ **kwargs,
144
+ ):
145
+ bos_token = AddedToken(bos_token, lstrip=False, rstrip=False) if isinstance(bos_token, str) else bos_token
146
+ eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
147
+ unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
148
+ pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
149
+ super().__init__(
150
+ errors=errors,
151
+ unk_token=unk_token,
152
+ bos_token=bos_token,
153
+ eos_token=eos_token,
154
+ pad_token=pad_token,
155
+ add_prefix_space=add_prefix_space,
156
+ add_bos_token=add_bos_token,
157
+ **kwargs,
158
+ )
159
+ self.add_bos_token = add_bos_token
160
+
161
+ with open(vocab_file, encoding="utf-8") as vocab_handle:
162
+ self.encoder = json.load(vocab_handle)
163
+ self.decoder = {v: k for k, v in self.encoder.items()}
164
+ self.errors = errors # how to handle errors in decoding
165
+ self.byte_encoder = bytes_to_unicode()
166
+ self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
167
+ with open(merges_file, encoding="utf-8") as merges_handle:
168
+ bpe_merges = merges_handle.read().split("\n")[1:-1]
169
+ bpe_merges = [tuple(merge.split()) for merge in bpe_merges]
170
+ self.bpe_ranks = dict(zip(bpe_merges, range(len(bpe_merges))))
171
+ self.cache = {}
172
+ self.add_prefix_space = add_prefix_space
173
+
174
+ # Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
175
+ self.pat = re.compile(r"""'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""")
176
+
177
+ @property
178
+ def vocab_size(self):
179
+ return len(self.encoder)
180
+
181
+ def get_vocab(self):
182
+ return dict(self.encoder, **self.added_tokens_encoder)
183
+
184
+ def bpe(self, token):
185
+ if token in self.cache:
186
+ return self.cache[token]
187
+ word = tuple(token)
188
+ pairs = get_pairs(word)
189
+
190
+ if not pairs:
191
+ return token
192
+
193
+ while True:
194
+ bigram = min(pairs, key=lambda pair: self.bpe_ranks.get(pair, float("inf")))
195
+ if bigram not in self.bpe_ranks:
196
+ break
197
+ first, second = bigram
198
+ new_word = []
199
+ i = 0
200
+ while i < len(word):
201
+ try:
202
+ j = word.index(first, i)
203
+ except ValueError:
204
+ new_word.extend(word[i:])
205
+ break
206
+ else:
207
+ new_word.extend(word[i:j])
208
+ i = j
209
+
210
+ if word[i] == first and i < len(word) - 1 and word[i + 1] == second:
211
+ new_word.append(first + second)
212
+ i += 2
213
+ else:
214
+ new_word.append(word[i])
215
+ i += 1
216
+ new_word = tuple(new_word)
217
+ word = new_word
218
+ if len(word) == 1:
219
+ break
220
+ else:
221
+ pairs = get_pairs(word)
222
+ word = " ".join(word)
223
+ self.cache[token] = word
224
+ return word
225
+
226
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
227
+ if self.add_bos_token:
228
+ bos_token_ids = [self.bos_token_id]
229
+ else:
230
+ bos_token_ids = []
231
+
232
+ output = bos_token_ids + token_ids_0
233
+
234
+ if token_ids_1 is None:
235
+ return output
236
+
237
+ return output + bos_token_ids + token_ids_1
238
+
239
+ def _tokenize(self, text):
240
+ """Tokenize a string."""
241
+ bpe_tokens = []
242
+ for token in re.findall(self.pat, text):
243
+ token = "".join(
244
+ self.byte_encoder[b] for b in token.encode("utf-8")
245
+ ) # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
246
+ bpe_tokens.extend(bpe_token for bpe_token in self.bpe(token).split(" "))
247
+ return bpe_tokens
248
+
249
+ def _convert_token_to_id(self, token):
250
+ """Converts a token (str) in an id using the vocab."""
251
+ return self.encoder.get(token, self.encoder.get(self.unk_token))
252
+
253
+ def _convert_id_to_token(self, index):
254
+ """Converts an index (integer) in a token (str) using the vocab."""
255
+ return self.decoder.get(index)
256
+
257
+ def convert_tokens_to_string(self, tokens):
258
+ """Converts a sequence of tokens (string) in a single string."""
259
+ text = "".join(tokens)
260
+ text = bytearray([self.byte_decoder[c] for c in text]).decode("utf-8", errors=self.errors)
261
+ return text
262
+
263
+ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
264
+ if not os.path.isdir(save_directory):
265
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
266
+ return
267
+ vocab_file = os.path.join(
268
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
269
+ )
270
+ merge_file = os.path.join(
271
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["merges_file"]
272
+ )
273
+
274
+ with open(vocab_file, "w", encoding="utf-8") as f:
275
+ f.write(json.dumps(self.encoder, indent=2, sort_keys=True, ensure_ascii=False) + "\n")
276
+
277
+ index = 0
278
+ with open(merge_file, "w", encoding="utf-8") as writer:
279
+ writer.write("#version: 0.2\n")
280
+ for bpe_tokens, token_index in sorted(self.bpe_ranks.items(), key=lambda kv: kv[1]):
281
+ if index != token_index:
282
+ logger.warning(
283
+ f"Saving vocabulary to {merge_file}: BPE merge indices are not consecutive."
284
+ " Please check that the tokenizer is not corrupted!"
285
+ )
286
+ index = token_index
287
+ writer.write(" ".join(bpe_tokens) + "\n")
288
+ index += 1
289
+
290
+ return vocab_file, merge_file
291
+
292
+ def prepare_for_tokenization(self, text, is_split_into_words=False, **kwargs):
293
+ add_prefix_space = kwargs.pop("add_prefix_space", self.add_prefix_space)
294
+ if is_split_into_words or add_prefix_space:
295
+ text = " " + text
296
+ return (text, kwargs)
297
+
298
+ def decode(
299
+ self,
300
+ token_ids: Union[int, List[int], "np.ndarray", "torch.Tensor", "tf.Tensor"],
301
+ skip_special_tokens: bool = False,
302
+ clean_up_tokenization_spaces: bool = None,
303
+ truncate_before_pattern: Optional[List[str]] = None,
304
+ **kwargs,
305
+ ) -> str:
306
+ """
307
+ Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
308
+ tokens and clean up tokenization spaces.
309
+
310
+ Similar to doing `self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))`.
311
+
312
+ Args:
313
+ token_ids (`Union[int, List[int], np.ndarray, torch.Tensor, tf.Tensor]`):
314
+ List of tokenized input ids. Can be obtained using the `__call__` method.
315
+ skip_special_tokens (`bool`, *optional*, defaults to `False`):
316
+ Whether or not to remove special tokens in the decoding.
317
+ clean_up_tokenization_spaces (`bool`, *optional*):
318
+ Whether or not to clean up the tokenization spaces. If `None`, will default to
319
+ `self.clean_up_tokenization_spaces` (available in the `tokenizer_config`).
320
+ truncate_before_pattern (`List[str]`, *optional*, defaults to `None`):
321
+ A list of regular expression strings that will be used to truncate the returned string. This can be
322
+ used to remove extra pieces of code (e.g. truncate if observing a comment symbol "#" at the beginning
323
+ of a new line). An example pattern could be `["^#", re.escape("<|endoftext|>"), "^'''", "\n\n\n"]`.
324
+ kwargs (additional keyword arguments, *optional*):
325
+ Will be passed to the underlying model specific decode method.
326
+
327
+ Returns:
328
+ `str`: The decoded sentence.
329
+ """
330
+ decoded_text = super()._decode(
331
+ token_ids=token_ids,
332
+ skip_special_tokens=skip_special_tokens,
333
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
334
+ **kwargs,
335
+ )
336
+
337
+ if truncate_before_pattern is not None and len(truncate_before_pattern) > 0:
338
+ decoded_text = self.truncate(decoded_text, truncate_before_pattern)
339
+
340
+ return decoded_text
341
+
342
+ def truncate(self, completion, truncate_before_pattern):
343
+ def find_re(string, pattern, start_pos):
344
+ m = pattern.search(string, start_pos)
345
+ return m.start() if m else -1
346
+
347
+ terminals = [re.compile(pattern, re.MULTILINE) for pattern in truncate_before_pattern]
348
+
349
+ prints = list(re.finditer("^print", completion, re.MULTILINE))
350
+
351
+ if len(prints) > 1:
352
+ completion = completion[: prints[1].start()]
353
+
354
+ defs = list(re.finditer("^def", completion, re.MULTILINE))
355
+
356
+ if len(defs) > 1:
357
+ completion = completion[: defs[1].start()]
358
+
359
+ start_pos = 0
360
+
361
+ terminals_pos = [
362
+ pos for pos in [find_re(completion, terminal, start_pos) for terminal in terminals] if pos != -1
363
+ ]
364
+
365
+ if len(terminals_pos) > 0:
366
+ return completion[: min(terminals_pos)]
367
+ else:
368
+ return completion
tokenizer_config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "eos_token": {
13
+ "__type": "AddedToken",
14
+ "content": "<eom>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "errors": "replace",
21
+ "model_max_length": 2048,
22
+ "name_or_path": "gpt2",
23
+ "pad_token": null,
24
+ "special_tokens_map_file": null,
25
+ "tokenizer_class": "MossTokenizer",
26
+ "unk_token": {
27
+ "__type": "AddedToken",
28
+ "content": "<|endoftext|>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ },
34
+ "auto_map": {
35
+ "AutoTokenizer": [
36
+ "tokenization_moss.MossTokenizer",
37
+ null
38
+ ]
39
+ }
40
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff