Upload folder using huggingface_hub
Browse files- added_tokens.json +21 -0
- config.json +46 -0
- configuration_kclgpt.py +150 -0
- configuration_shell.py +150 -0
- generation_config.json +6 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +556 -0
- modeling_kclgpt.py +939 -0
- modeling_shell.py +858 -0
- pytorch_model.bin.index.json +557 -0
- special_tokens_map.json +27 -0
- tokenizer.json +0 -0
- tokenizer_config.json +32 -0
- vocab.json +0 -0
added_tokens.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<commit_after>": 70017,
|
| 3 |
+
"<commit_before>": 70015,
|
| 4 |
+
"<commit_msg>": 70016,
|
| 5 |
+
"<empty_output>": 70014,
|
| 6 |
+
"<filename>": 70005,
|
| 7 |
+
"<fim_middle>": 70002,
|
| 8 |
+
"<fim_pad>": 70004,
|
| 9 |
+
"<fim_prefix>": 70001,
|
| 10 |
+
"<fim_suffix>": 70003,
|
| 11 |
+
"<gh_stars>": 70006,
|
| 12 |
+
"<issue_closed>": 70009,
|
| 13 |
+
"<issue_comment>": 70008,
|
| 14 |
+
"<issue_start>": 70007,
|
| 15 |
+
"<jupyter_code>": 70012,
|
| 16 |
+
"<jupyter_output>": 70013,
|
| 17 |
+
"<jupyter_start>": 70010,
|
| 18 |
+
"<jupyter_text>": 70011,
|
| 19 |
+
"<reponame>": 70018,
|
| 20 |
+
"<|endoftext|>": 70000
|
| 21 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/nvme/share/shellm/hf_configs/7b_gq_rope",
|
| 3 |
+
"activation_function": "gelu_pytorch_tanh",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"KCLGPTForCausalLM"
|
| 6 |
+
],
|
| 7 |
+
"attention_softmax_in_fp32": true,
|
| 8 |
+
"attn_pdrop": 0.1,
|
| 9 |
+
"auto_map": {
|
| 10 |
+
"AutoConfig": "configuration_kclgpt.KCLGPTConfig",
|
| 11 |
+
"AutoModelForCausalLM": "modeling_kclgpt.KCLGPTForCausalLM"
|
| 12 |
+
},
|
| 13 |
+
"bos_token_id": 70000,
|
| 14 |
+
"embd_pdrop": 0.1,
|
| 15 |
+
"eos_token_id": 70000,
|
| 16 |
+
"group_query_attention": true,
|
| 17 |
+
"inference_runner": 0,
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"layer_norm_epsilon": 1e-05,
|
| 20 |
+
"max_batch_size": null,
|
| 21 |
+
"max_sequence_length": null,
|
| 22 |
+
"model_type": "kclgpt",
|
| 23 |
+
"n_embd": 4096,
|
| 24 |
+
"n_head": 32,
|
| 25 |
+
"n_inner": 16384,
|
| 26 |
+
"n_layer": 42,
|
| 27 |
+
"n_positions": 8192,
|
| 28 |
+
"num_query_groups": 8,
|
| 29 |
+
"pad_key_length": true,
|
| 30 |
+
"position_embedding_type": "rope",
|
| 31 |
+
"pre_allocate_kv_cache": false,
|
| 32 |
+
"resid_pdrop": 0.1,
|
| 33 |
+
"rope_scaling": null,
|
| 34 |
+
"scale_attention_softmax_in_fp32": true,
|
| 35 |
+
"scale_attn_weights": true,
|
| 36 |
+
"summary_activation": null,
|
| 37 |
+
"summary_first_dropout": 0.1,
|
| 38 |
+
"summary_proj_to_labels": true,
|
| 39 |
+
"summary_type": "cls_index",
|
| 40 |
+
"summary_use_proj": true,
|
| 41 |
+
"torch_dtype": "bfloat16",
|
| 42 |
+
"transformers_version": "4.29.2",
|
| 43 |
+
"use_cache": true,
|
| 44 |
+
"validate_runner_input": true,
|
| 45 |
+
"vocab_size": 70144
|
| 46 |
+
}
|
configuration_kclgpt.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2023 The BigCode team and HuggingFace Inc. team.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
""" KCLGPT configuration"""
|
| 16 |
+
|
| 17 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 18 |
+
from transformers.utils import logging
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
logger = logging.get_logger(__name__)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class KCLGPTConfig(PretrainedConfig):
|
| 25 |
+
"""
|
| 26 |
+
This is the configuration class to store the configuration of a [`KCLGPTModel`]. It is used to instantiate a
|
| 27 |
+
KCLGPT model according to the specified arguments, defining the model architecture. Instantiating a
|
| 28 |
+
configuration with the defaults will yield a similar configuration to that of the KCLGPT
|
| 29 |
+
[gpt_bigcode](https://huggingface.co/gpt_bigcode) architecture.
|
| 30 |
+
|
| 31 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 32 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
Args:
|
| 36 |
+
vocab_size (`int`, *optional*, defaults to 50257):
|
| 37 |
+
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
|
| 38 |
+
`inputs_ids` passed when calling [`KCLGPTModel`].
|
| 39 |
+
n_positions (`int`, *optional*, defaults to 1024):
|
| 40 |
+
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
| 41 |
+
just in case (e.g., 512 or 1024 or 2048).
|
| 42 |
+
n_embd (`int`, *optional*, defaults to 768):
|
| 43 |
+
Dimensionality of the embeddings and hidden states.
|
| 44 |
+
n_layer (`int`, *optional*, defaults to 12):
|
| 45 |
+
Number of hidden layers in the Transformer encoder.
|
| 46 |
+
n_head (`int`, *optional*, defaults to 12):
|
| 47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 48 |
+
n_inner (`int`, *optional*, defaults to None):
|
| 49 |
+
Dimensionality of the inner feed-forward layers. `None` will set it to 4 times n_embd
|
| 50 |
+
activation_function (`str`, *optional*, defaults to `"gelu_pytorch_tanh"`):
|
| 51 |
+
Activation function, to be selected in the list `["relu", "silu", "gelu", "tanh", "gelu_new",
|
| 52 |
+
"gelu_pytorch_tanh"]`.
|
| 53 |
+
resid_pdrop (`float`, *optional*, defaults to 0.1):
|
| 54 |
+
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
| 55 |
+
embd_pdrop (`float`, *optional*, defaults to 0.1):
|
| 56 |
+
The dropout ratio for the embeddings.
|
| 57 |
+
attn_pdrop (`float`, *optional*, defaults to 0.1):
|
| 58 |
+
The dropout ratio for the attention.
|
| 59 |
+
layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
|
| 60 |
+
The epsilon to use in the layer normalization layers.
|
| 61 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 62 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 63 |
+
scale_attn_weights (`bool`, *optional*, defaults to `True`):
|
| 64 |
+
Scale attention weights by dividing by sqrt(hidden_size)..
|
| 65 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 66 |
+
Whether or not the model should return the last key/values attentions (not used by all models).
|
| 67 |
+
attention_softmax_in_fp32 (`bool`, *optional*, defaults to `True`):
|
| 68 |
+
Whether to call the fused softmax in float32.
|
| 69 |
+
scale_attention_softmax_in_fp32 (`bool`, *optional*, defaults to `True`):
|
| 70 |
+
Whether to scale the attention softmax in float32.
|
| 71 |
+
attention_type (`bool`, *optional*, defaults to `True`):
|
| 72 |
+
Whether to use Multi-Query Attion (`True`) or Multi-Head Attention (`False`).
|
| 73 |
+
Example:
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
>>> from transformers import KCLGPTConfig, KCLGPTModel
|
| 77 |
+
|
| 78 |
+
>>> # Initializing a KCLGPT configuration
|
| 79 |
+
>>> configuration = KCLGPTConfig()
|
| 80 |
+
|
| 81 |
+
>>> # Initializing a model (with random weights) from the configuration
|
| 82 |
+
>>> model = KCLGPTModel(configuration)
|
| 83 |
+
|
| 84 |
+
>>> # Accessing the model configuration
|
| 85 |
+
>>> configuration = model.config
|
| 86 |
+
```"""
|
| 87 |
+
|
| 88 |
+
model_type = "kclgpt"
|
| 89 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 90 |
+
attribute_map = {
|
| 91 |
+
"hidden_size": "n_embd",
|
| 92 |
+
"max_position_embeddings": "n_positions",
|
| 93 |
+
"num_attention_heads": "n_head",
|
| 94 |
+
"num_hidden_layers": "n_layer",
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
def __init__(
|
| 98 |
+
self,
|
| 99 |
+
vocab_size=50257,
|
| 100 |
+
n_positions=1024,
|
| 101 |
+
n_embd=768,
|
| 102 |
+
n_layer=12,
|
| 103 |
+
n_head=12,
|
| 104 |
+
n_inner=None,
|
| 105 |
+
activation_function="gelu_pytorch_tanh",
|
| 106 |
+
resid_pdrop=0.1,
|
| 107 |
+
embd_pdrop=0.1,
|
| 108 |
+
attn_pdrop=0.1,
|
| 109 |
+
layer_norm_epsilon=1e-5,
|
| 110 |
+
initializer_range=0.02,
|
| 111 |
+
scale_attn_weights=True,
|
| 112 |
+
use_cache=True,
|
| 113 |
+
bos_token_id=50256,
|
| 114 |
+
eos_token_id=50256,
|
| 115 |
+
attention_softmax_in_fp32=True,
|
| 116 |
+
scale_attention_softmax_in_fp32=True,
|
| 117 |
+
group_query_attention=True,
|
| 118 |
+
num_query_groups=1,
|
| 119 |
+
position_embedding_type="learned_absolute",
|
| 120 |
+
rope_scaling=None,
|
| 121 |
+
**kwargs,
|
| 122 |
+
):
|
| 123 |
+
self.vocab_size = vocab_size
|
| 124 |
+
self.n_positions = n_positions
|
| 125 |
+
self.n_embd = n_embd
|
| 126 |
+
self.n_layer = n_layer
|
| 127 |
+
self.n_head = n_head
|
| 128 |
+
self.n_inner = n_inner
|
| 129 |
+
self.activation_function = activation_function
|
| 130 |
+
self.resid_pdrop = resid_pdrop
|
| 131 |
+
self.embd_pdrop = embd_pdrop
|
| 132 |
+
self.attn_pdrop = attn_pdrop
|
| 133 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
| 134 |
+
self.initializer_range = initializer_range
|
| 135 |
+
self.scale_attn_weights = scale_attn_weights
|
| 136 |
+
self.use_cache = use_cache
|
| 137 |
+
self.attention_softmax_in_fp32 = attention_softmax_in_fp32
|
| 138 |
+
self.scale_attention_softmax_in_fp32 = scale_attention_softmax_in_fp32
|
| 139 |
+
self.group_query_attention = group_query_attention
|
| 140 |
+
self.num_query_groups = num_query_groups
|
| 141 |
+
self.position_embedding_type = position_embedding_type
|
| 142 |
+
self.rope_scaling = rope_scaling
|
| 143 |
+
assert self.position_embedding_type in [
|
| 144 |
+
"learned_absolute", "rope"
|
| 145 |
+
], "position_embedding_type must be one of ['learned_absolute', 'rope']"
|
| 146 |
+
|
| 147 |
+
self.bos_token_id = bos_token_id
|
| 148 |
+
self.eos_token_id = eos_token_id
|
| 149 |
+
|
| 150 |
+
super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token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4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
""" Shell configuration"""
|
| 16 |
+
|
| 17 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 18 |
+
from transformers.utils import logging
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
logger = logging.get_logger(__name__)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class ShellConfig(PretrainedConfig):
|
| 25 |
+
"""
|
| 26 |
+
This is the configuration class to store the configuration of a [`ShellModel`]. It is used to instantiate a
|
| 27 |
+
Shell model according to the specified arguments, defining the model architecture. Instantiating a
|
| 28 |
+
configuration with the defaults will yield a similar configuration to that of the Shell
|
| 29 |
+
[gpt_bigcode](https://huggingface.co/gpt_bigcode) architecture.
|
| 30 |
+
|
| 31 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 32 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
Args:
|
| 36 |
+
vocab_size (`int`, *optional*, defaults to 50257):
|
| 37 |
+
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
|
| 38 |
+
`inputs_ids` passed when calling [`ShellModel`].
|
| 39 |
+
n_positions (`int`, *optional*, defaults to 1024):
|
| 40 |
+
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
| 41 |
+
just in case (e.g., 512 or 1024 or 2048).
|
| 42 |
+
n_embd (`int`, *optional*, defaults to 768):
|
| 43 |
+
Dimensionality of the embeddings and hidden states.
|
| 44 |
+
n_layer (`int`, *optional*, defaults to 12):
|
| 45 |
+
Number of hidden layers in the Transformer encoder.
|
| 46 |
+
n_head (`int`, *optional*, defaults to 12):
|
| 47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 48 |
+
n_inner (`int`, *optional*, defaults to None):
|
| 49 |
+
Dimensionality of the inner feed-forward layers. `None` will set it to 4 times n_embd
|
| 50 |
+
activation_function (`str`, *optional*, defaults to `"gelu_pytorch_tanh"`):
|
| 51 |
+
Activation function, to be selected in the list `["relu", "silu", "gelu", "tanh", "gelu_new",
|
| 52 |
+
"gelu_pytorch_tanh"]`.
|
| 53 |
+
resid_pdrop (`float`, *optional*, defaults to 0.1):
|
| 54 |
+
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
| 55 |
+
embd_pdrop (`float`, *optional*, defaults to 0.1):
|
| 56 |
+
The dropout ratio for the embeddings.
|
| 57 |
+
attn_pdrop (`float`, *optional*, defaults to 0.1):
|
| 58 |
+
The dropout ratio for the attention.
|
| 59 |
+
layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
|
| 60 |
+
The epsilon to use in the layer normalization layers.
|
| 61 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 62 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 63 |
+
scale_attn_weights (`bool`, *optional*, defaults to `True`):
|
| 64 |
+
Scale attention weights by dividing by sqrt(hidden_size)..
|
| 65 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 66 |
+
Whether or not the model should return the last key/values attentions (not used by all models).
|
| 67 |
+
attention_softmax_in_fp32 (`bool`, *optional*, defaults to `True`):
|
| 68 |
+
Whether to call the fused softmax in float32.
|
| 69 |
+
scale_attention_softmax_in_fp32 (`bool`, *optional*, defaults to `True`):
|
| 70 |
+
Whether to scale the attention softmax in float32.
|
| 71 |
+
attention_type (`bool`, *optional*, defaults to `True`):
|
| 72 |
+
Whether to use Multi-Query Attion (`True`) or Multi-Head Attention (`False`).
|
| 73 |
+
Example:
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
>>> from transformers import ShellConfig, ShellModel
|
| 77 |
+
|
| 78 |
+
>>> # Initializing a Shell configuration
|
| 79 |
+
>>> configuration = ShellConfig()
|
| 80 |
+
|
| 81 |
+
>>> # Initializing a model (with random weights) from the configuration
|
| 82 |
+
>>> model = ShellModel(configuration)
|
| 83 |
+
|
| 84 |
+
>>> # Accessing the model configuration
|
| 85 |
+
>>> configuration = model.config
|
| 86 |
+
```"""
|
| 87 |
+
|
| 88 |
+
model_type = "kclgpt"
|
| 89 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 90 |
+
attribute_map = {
|
| 91 |
+
"hidden_size": "n_embd",
|
| 92 |
+
"max_position_embeddings": "n_positions",
|
| 93 |
+
"num_attention_heads": "n_head",
|
| 94 |
+
"num_hidden_layers": "n_layer",
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
def __init__(
|
| 98 |
+
self,
|
| 99 |
+
vocab_size=50257,
|
| 100 |
+
n_positions=1024,
|
| 101 |
+
n_embd=768,
|
| 102 |
+
n_layer=12,
|
| 103 |
+
n_head=12,
|
| 104 |
+
n_inner=None,
|
| 105 |
+
activation_function="gelu_pytorch_tanh",
|
| 106 |
+
resid_pdrop=0.1,
|
| 107 |
+
embd_pdrop=0.1,
|
| 108 |
+
attn_pdrop=0.1,
|
| 109 |
+
layer_norm_epsilon=1e-5,
|
| 110 |
+
initializer_range=0.02,
|
| 111 |
+
scale_attn_weights=True,
|
| 112 |
+
use_cache=True,
|
| 113 |
+
bos_token_id=50256,
|
| 114 |
+
eos_token_id=50256,
|
| 115 |
+
attention_softmax_in_fp32=True,
|
| 116 |
+
scale_attention_softmax_in_fp32=True,
|
| 117 |
+
group_query_attention=True,
|
| 118 |
+
num_query_groups=1,
|
| 119 |
+
position_embedding_type="learned_absolute",
|
| 120 |
+
rope_scaling=None,
|
| 121 |
+
**kwargs,
|
| 122 |
+
):
|
| 123 |
+
self.vocab_size = vocab_size
|
| 124 |
+
self.n_positions = n_positions
|
| 125 |
+
self.n_embd = n_embd
|
| 126 |
+
self.n_layer = n_layer
|
| 127 |
+
self.n_head = n_head
|
| 128 |
+
self.n_inner = n_inner
|
| 129 |
+
self.activation_function = activation_function
|
| 130 |
+
self.resid_pdrop = resid_pdrop
|
| 131 |
+
self.embd_pdrop = embd_pdrop
|
| 132 |
+
self.attn_pdrop = attn_pdrop
|
| 133 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
| 134 |
+
self.initializer_range = initializer_range
|
| 135 |
+
self.scale_attn_weights = scale_attn_weights
|
| 136 |
+
self.use_cache = use_cache
|
| 137 |
+
self.attention_softmax_in_fp32 = attention_softmax_in_fp32
|
| 138 |
+
self.scale_attention_softmax_in_fp32 = scale_attention_softmax_in_fp32
|
| 139 |
+
self.group_query_attention = group_query_attention
|
| 140 |
+
self.num_query_groups = num_query_groups
|
| 141 |
+
self.position_embedding_type = position_embedding_type
|
| 142 |
+
self.rope_scaling = rope_scaling
|
| 143 |
+
assert self.position_embedding_type in [
|
| 144 |
+
"learned_absolute", "rope"
|
| 145 |
+
], "position_embedding_type must be one of ['learned_absolute', 'rope']"
|
| 146 |
+
|
| 147 |
+
self.bos_token_id = bos_token_id
|
| 148 |
+
self.eos_token_id = eos_token_id
|
| 149 |
+
|
| 150 |
+
super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, **kwargs)
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 70000,
|
| 4 |
+
"eos_token_id": 70000,
|
| 5 |
+
"transformers_version": "4.29.2"
|
| 6 |
+
}
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:35affc26417d78eaaeaeb0dad037c4d1b7632018413b742892ea4bd72aac18fd
|
| 3 |
+
size 9955659648
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24eb05f7e6c43d3bb2d3cd51d14bf6063fd8b37e6df3d193423ba3c10c1d3da5
|
| 3 |
+
size 5420501688
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 15376102656
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"transformer.h.0.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 7 |
+
"transformer.h.0.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 8 |
+
"transformer.h.0.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 9 |
+
"transformer.h.0.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 10 |
+
"transformer.h.0.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 11 |
+
"transformer.h.0.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 12 |
+
"transformer.h.0.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 13 |
+
"transformer.h.0.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 14 |
+
"transformer.h.0.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 15 |
+
"transformer.h.0.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 16 |
+
"transformer.h.0.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 17 |
+
"transformer.h.0.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 18 |
+
"transformer.h.0.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 19 |
+
"transformer.h.1.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 20 |
+
"transformer.h.1.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 21 |
+
"transformer.h.1.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 22 |
+
"transformer.h.1.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 23 |
+
"transformer.h.1.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 24 |
+
"transformer.h.1.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 25 |
+
"transformer.h.1.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 26 |
+
"transformer.h.1.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 27 |
+
"transformer.h.1.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 28 |
+
"transformer.h.1.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 29 |
+
"transformer.h.1.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 30 |
+
"transformer.h.1.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 31 |
+
"transformer.h.1.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 32 |
+
"transformer.h.10.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 33 |
+
"transformer.h.10.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 34 |
+
"transformer.h.10.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 35 |
+
"transformer.h.10.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 36 |
+
"transformer.h.10.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 37 |
+
"transformer.h.10.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 38 |
+
"transformer.h.10.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 39 |
+
"transformer.h.10.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 40 |
+
"transformer.h.10.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 41 |
+
"transformer.h.10.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 42 |
+
"transformer.h.10.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 43 |
+
"transformer.h.10.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 44 |
+
"transformer.h.10.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 45 |
+
"transformer.h.11.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 46 |
+
"transformer.h.11.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 47 |
+
"transformer.h.11.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 48 |
+
"transformer.h.11.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 49 |
+
"transformer.h.11.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 50 |
+
"transformer.h.11.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 51 |
+
"transformer.h.11.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 52 |
+
"transformer.h.11.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 53 |
+
"transformer.h.11.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 54 |
+
"transformer.h.11.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 55 |
+
"transformer.h.11.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 56 |
+
"transformer.h.11.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 57 |
+
"transformer.h.11.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 58 |
+
"transformer.h.12.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 59 |
+
"transformer.h.12.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 60 |
+
"transformer.h.12.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 61 |
+
"transformer.h.12.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 62 |
+
"transformer.h.12.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 63 |
+
"transformer.h.12.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 64 |
+
"transformer.h.12.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 65 |
+
"transformer.h.12.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 66 |
+
"transformer.h.12.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 67 |
+
"transformer.h.12.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 68 |
+
"transformer.h.12.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 69 |
+
"transformer.h.12.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 70 |
+
"transformer.h.12.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 71 |
+
"transformer.h.13.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 72 |
+
"transformer.h.13.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 73 |
+
"transformer.h.13.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 74 |
+
"transformer.h.13.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 75 |
+
"transformer.h.13.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 76 |
+
"transformer.h.13.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 77 |
+
"transformer.h.13.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 78 |
+
"transformer.h.13.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 79 |
+
"transformer.h.13.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 80 |
+
"transformer.h.13.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 81 |
+
"transformer.h.13.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 82 |
+
"transformer.h.13.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 83 |
+
"transformer.h.13.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 84 |
+
"transformer.h.14.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 85 |
+
"transformer.h.14.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 86 |
+
"transformer.h.14.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 87 |
+
"transformer.h.14.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 88 |
+
"transformer.h.14.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 89 |
+
"transformer.h.14.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 90 |
+
"transformer.h.14.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 91 |
+
"transformer.h.14.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 92 |
+
"transformer.h.14.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 93 |
+
"transformer.h.14.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 94 |
+
"transformer.h.14.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 95 |
+
"transformer.h.14.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 96 |
+
"transformer.h.14.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 97 |
+
"transformer.h.15.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 98 |
+
"transformer.h.15.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 99 |
+
"transformer.h.15.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 100 |
+
"transformer.h.15.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 101 |
+
"transformer.h.15.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 102 |
+
"transformer.h.15.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 103 |
+
"transformer.h.15.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 104 |
+
"transformer.h.15.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 105 |
+
"transformer.h.15.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 106 |
+
"transformer.h.15.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 107 |
+
"transformer.h.15.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 108 |
+
"transformer.h.15.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 109 |
+
"transformer.h.15.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 110 |
+
"transformer.h.16.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 111 |
+
"transformer.h.16.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 112 |
+
"transformer.h.16.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 113 |
+
"transformer.h.16.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 114 |
+
"transformer.h.16.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 115 |
+
"transformer.h.16.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 116 |
+
"transformer.h.16.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 117 |
+
"transformer.h.16.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 118 |
+
"transformer.h.16.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 119 |
+
"transformer.h.16.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 120 |
+
"transformer.h.16.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 121 |
+
"transformer.h.16.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 122 |
+
"transformer.h.16.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 123 |
+
"transformer.h.17.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 124 |
+
"transformer.h.17.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 125 |
+
"transformer.h.17.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 126 |
+
"transformer.h.17.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 127 |
+
"transformer.h.17.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 128 |
+
"transformer.h.17.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 129 |
+
"transformer.h.17.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 130 |
+
"transformer.h.17.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 131 |
+
"transformer.h.17.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 132 |
+
"transformer.h.17.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 133 |
+
"transformer.h.17.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 134 |
+
"transformer.h.17.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 135 |
+
"transformer.h.17.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 136 |
+
"transformer.h.18.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 137 |
+
"transformer.h.18.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 138 |
+
"transformer.h.18.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 139 |
+
"transformer.h.18.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 140 |
+
"transformer.h.18.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 141 |
+
"transformer.h.18.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 142 |
+
"transformer.h.18.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 143 |
+
"transformer.h.18.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 144 |
+
"transformer.h.18.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 145 |
+
"transformer.h.18.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 146 |
+
"transformer.h.18.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 147 |
+
"transformer.h.18.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 148 |
+
"transformer.h.18.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 149 |
+
"transformer.h.19.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 150 |
+
"transformer.h.19.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 151 |
+
"transformer.h.19.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 152 |
+
"transformer.h.19.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 153 |
+
"transformer.h.19.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 154 |
+
"transformer.h.19.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 155 |
+
"transformer.h.19.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 156 |
+
"transformer.h.19.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 157 |
+
"transformer.h.19.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 158 |
+
"transformer.h.19.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 159 |
+
"transformer.h.19.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 160 |
+
"transformer.h.19.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 161 |
+
"transformer.h.19.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 162 |
+
"transformer.h.2.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 163 |
+
"transformer.h.2.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 164 |
+
"transformer.h.2.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 165 |
+
"transformer.h.2.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 166 |
+
"transformer.h.2.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 167 |
+
"transformer.h.2.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 168 |
+
"transformer.h.2.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 169 |
+
"transformer.h.2.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 170 |
+
"transformer.h.2.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 171 |
+
"transformer.h.2.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 172 |
+
"transformer.h.2.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 173 |
+
"transformer.h.2.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 174 |
+
"transformer.h.2.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 175 |
+
"transformer.h.20.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 176 |
+
"transformer.h.20.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 177 |
+
"transformer.h.20.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 178 |
+
"transformer.h.20.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 179 |
+
"transformer.h.20.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 180 |
+
"transformer.h.20.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 181 |
+
"transformer.h.20.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 182 |
+
"transformer.h.20.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 183 |
+
"transformer.h.20.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 184 |
+
"transformer.h.20.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 185 |
+
"transformer.h.20.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 186 |
+
"transformer.h.20.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 187 |
+
"transformer.h.20.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 188 |
+
"transformer.h.21.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 189 |
+
"transformer.h.21.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 190 |
+
"transformer.h.21.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 191 |
+
"transformer.h.21.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 192 |
+
"transformer.h.21.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 193 |
+
"transformer.h.21.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 194 |
+
"transformer.h.21.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 195 |
+
"transformer.h.21.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 196 |
+
"transformer.h.21.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 197 |
+
"transformer.h.21.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 198 |
+
"transformer.h.21.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 199 |
+
"transformer.h.21.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 200 |
+
"transformer.h.21.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 201 |
+
"transformer.h.22.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 202 |
+
"transformer.h.22.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 203 |
+
"transformer.h.22.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 204 |
+
"transformer.h.22.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 205 |
+
"transformer.h.22.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 206 |
+
"transformer.h.22.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 207 |
+
"transformer.h.22.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 208 |
+
"transformer.h.22.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 209 |
+
"transformer.h.22.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 210 |
+
"transformer.h.22.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 211 |
+
"transformer.h.22.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 212 |
+
"transformer.h.22.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 213 |
+
"transformer.h.22.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 214 |
+
"transformer.h.23.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 215 |
+
"transformer.h.23.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 216 |
+
"transformer.h.23.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 217 |
+
"transformer.h.23.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 218 |
+
"transformer.h.23.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 219 |
+
"transformer.h.23.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 220 |
+
"transformer.h.23.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 221 |
+
"transformer.h.23.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 222 |
+
"transformer.h.23.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 223 |
+
"transformer.h.23.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 224 |
+
"transformer.h.23.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 225 |
+
"transformer.h.23.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 226 |
+
"transformer.h.23.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 227 |
+
"transformer.h.24.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 228 |
+
"transformer.h.24.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 229 |
+
"transformer.h.24.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 230 |
+
"transformer.h.24.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 231 |
+
"transformer.h.24.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 232 |
+
"transformer.h.24.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 233 |
+
"transformer.h.24.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 234 |
+
"transformer.h.24.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 235 |
+
"transformer.h.24.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 236 |
+
"transformer.h.24.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 237 |
+
"transformer.h.24.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 238 |
+
"transformer.h.24.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 239 |
+
"transformer.h.24.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 240 |
+
"transformer.h.25.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 241 |
+
"transformer.h.25.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 242 |
+
"transformer.h.25.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 243 |
+
"transformer.h.25.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 244 |
+
"transformer.h.25.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 245 |
+
"transformer.h.25.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 246 |
+
"transformer.h.25.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 247 |
+
"transformer.h.25.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 248 |
+
"transformer.h.25.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 249 |
+
"transformer.h.25.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 250 |
+
"transformer.h.25.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 251 |
+
"transformer.h.25.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 252 |
+
"transformer.h.25.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 253 |
+
"transformer.h.26.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 254 |
+
"transformer.h.26.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 255 |
+
"transformer.h.26.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 256 |
+
"transformer.h.26.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 257 |
+
"transformer.h.26.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 258 |
+
"transformer.h.26.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 259 |
+
"transformer.h.26.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 260 |
+
"transformer.h.26.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 261 |
+
"transformer.h.26.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 262 |
+
"transformer.h.26.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 263 |
+
"transformer.h.26.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 264 |
+
"transformer.h.26.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 265 |
+
"transformer.h.26.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 266 |
+
"transformer.h.27.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 267 |
+
"transformer.h.27.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 268 |
+
"transformer.h.27.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 269 |
+
"transformer.h.27.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 270 |
+
"transformer.h.27.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 271 |
+
"transformer.h.27.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 272 |
+
"transformer.h.27.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 273 |
+
"transformer.h.27.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 274 |
+
"transformer.h.27.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 275 |
+
"transformer.h.27.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 276 |
+
"transformer.h.27.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 277 |
+
"transformer.h.27.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 278 |
+
"transformer.h.27.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 279 |
+
"transformer.h.28.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 280 |
+
"transformer.h.28.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 281 |
+
"transformer.h.28.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 282 |
+
"transformer.h.28.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 283 |
+
"transformer.h.28.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 284 |
+
"transformer.h.28.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 285 |
+
"transformer.h.28.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 286 |
+
"transformer.h.28.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 287 |
+
"transformer.h.28.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 288 |
+
"transformer.h.28.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 289 |
+
"transformer.h.28.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 290 |
+
"transformer.h.28.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 291 |
+
"transformer.h.28.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 292 |
+
"transformer.h.29.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 293 |
+
"transformer.h.29.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 294 |
+
"transformer.h.29.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 295 |
+
"transformer.h.29.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 296 |
+
"transformer.h.29.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 297 |
+
"transformer.h.29.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 298 |
+
"transformer.h.29.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 299 |
+
"transformer.h.29.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 300 |
+
"transformer.h.29.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 301 |
+
"transformer.h.29.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 302 |
+
"transformer.h.29.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 303 |
+
"transformer.h.29.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 304 |
+
"transformer.h.29.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 305 |
+
"transformer.h.3.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 306 |
+
"transformer.h.3.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 307 |
+
"transformer.h.3.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 308 |
+
"transformer.h.3.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 309 |
+
"transformer.h.3.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 310 |
+
"transformer.h.3.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 311 |
+
"transformer.h.3.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 312 |
+
"transformer.h.3.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 313 |
+
"transformer.h.3.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 314 |
+
"transformer.h.3.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 315 |
+
"transformer.h.3.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 316 |
+
"transformer.h.3.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 317 |
+
"transformer.h.3.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 318 |
+
"transformer.h.30.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 319 |
+
"transformer.h.30.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 320 |
+
"transformer.h.30.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 321 |
+
"transformer.h.30.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 322 |
+
"transformer.h.30.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 323 |
+
"transformer.h.30.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 324 |
+
"transformer.h.30.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 325 |
+
"transformer.h.30.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 326 |
+
"transformer.h.30.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 327 |
+
"transformer.h.30.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 328 |
+
"transformer.h.30.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 329 |
+
"transformer.h.30.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 330 |
+
"transformer.h.30.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 331 |
+
"transformer.h.31.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 332 |
+
"transformer.h.31.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 333 |
+
"transformer.h.31.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 334 |
+
"transformer.h.31.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 335 |
+
"transformer.h.31.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 336 |
+
"transformer.h.31.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 337 |
+
"transformer.h.31.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 338 |
+
"transformer.h.31.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 339 |
+
"transformer.h.31.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 340 |
+
"transformer.h.31.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 341 |
+
"transformer.h.31.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 342 |
+
"transformer.h.31.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 343 |
+
"transformer.h.31.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 344 |
+
"transformer.h.32.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 345 |
+
"transformer.h.32.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 346 |
+
"transformer.h.32.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 347 |
+
"transformer.h.32.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 348 |
+
"transformer.h.32.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 349 |
+
"transformer.h.32.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 350 |
+
"transformer.h.32.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 351 |
+
"transformer.h.32.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 352 |
+
"transformer.h.32.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 353 |
+
"transformer.h.32.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 354 |
+
"transformer.h.32.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 355 |
+
"transformer.h.32.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 356 |
+
"transformer.h.32.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 357 |
+
"transformer.h.33.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 358 |
+
"transformer.h.33.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 359 |
+
"transformer.h.33.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 360 |
+
"transformer.h.33.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 361 |
+
"transformer.h.33.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 362 |
+
"transformer.h.33.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 363 |
+
"transformer.h.33.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 364 |
+
"transformer.h.33.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 365 |
+
"transformer.h.33.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 366 |
+
"transformer.h.33.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 367 |
+
"transformer.h.33.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 368 |
+
"transformer.h.33.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 369 |
+
"transformer.h.33.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 370 |
+
"transformer.h.34.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 371 |
+
"transformer.h.34.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 372 |
+
"transformer.h.34.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 373 |
+
"transformer.h.34.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 374 |
+
"transformer.h.34.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 375 |
+
"transformer.h.34.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 376 |
+
"transformer.h.34.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 377 |
+
"transformer.h.34.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 378 |
+
"transformer.h.34.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 379 |
+
"transformer.h.34.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 380 |
+
"transformer.h.34.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 381 |
+
"transformer.h.34.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 382 |
+
"transformer.h.34.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 383 |
+
"transformer.h.35.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 384 |
+
"transformer.h.35.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 385 |
+
"transformer.h.35.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 386 |
+
"transformer.h.35.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 387 |
+
"transformer.h.35.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 388 |
+
"transformer.h.35.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 389 |
+
"transformer.h.35.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 390 |
+
"transformer.h.35.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 391 |
+
"transformer.h.35.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 392 |
+
"transformer.h.35.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 393 |
+
"transformer.h.35.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 394 |
+
"transformer.h.35.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 395 |
+
"transformer.h.35.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 396 |
+
"transformer.h.36.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 397 |
+
"transformer.h.36.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 398 |
+
"transformer.h.36.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 399 |
+
"transformer.h.36.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 400 |
+
"transformer.h.36.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 401 |
+
"transformer.h.36.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 402 |
+
"transformer.h.36.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 403 |
+
"transformer.h.36.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 404 |
+
"transformer.h.36.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 405 |
+
"transformer.h.36.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 406 |
+
"transformer.h.36.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 407 |
+
"transformer.h.36.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 408 |
+
"transformer.h.36.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 409 |
+
"transformer.h.37.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 410 |
+
"transformer.h.37.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 411 |
+
"transformer.h.37.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 412 |
+
"transformer.h.37.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 413 |
+
"transformer.h.37.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 414 |
+
"transformer.h.37.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 415 |
+
"transformer.h.37.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 416 |
+
"transformer.h.37.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 417 |
+
"transformer.h.37.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 418 |
+
"transformer.h.37.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 419 |
+
"transformer.h.37.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 420 |
+
"transformer.h.37.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 421 |
+
"transformer.h.37.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 422 |
+
"transformer.h.38.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 423 |
+
"transformer.h.38.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 424 |
+
"transformer.h.38.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 425 |
+
"transformer.h.38.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 426 |
+
"transformer.h.38.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 427 |
+
"transformer.h.38.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 428 |
+
"transformer.h.38.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 429 |
+
"transformer.h.38.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 430 |
+
"transformer.h.38.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 431 |
+
"transformer.h.38.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 432 |
+
"transformer.h.38.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 433 |
+
"transformer.h.38.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 434 |
+
"transformer.h.38.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 435 |
+
"transformer.h.39.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 436 |
+
"transformer.h.39.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 437 |
+
"transformer.h.39.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 438 |
+
"transformer.h.39.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 439 |
+
"transformer.h.39.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 440 |
+
"transformer.h.39.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 441 |
+
"transformer.h.39.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 442 |
+
"transformer.h.39.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 443 |
+
"transformer.h.39.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 444 |
+
"transformer.h.39.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 445 |
+
"transformer.h.39.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 446 |
+
"transformer.h.39.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 447 |
+
"transformer.h.39.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 448 |
+
"transformer.h.4.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 449 |
+
"transformer.h.4.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 450 |
+
"transformer.h.4.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 451 |
+
"transformer.h.4.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 452 |
+
"transformer.h.4.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 453 |
+
"transformer.h.4.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 454 |
+
"transformer.h.4.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 455 |
+
"transformer.h.4.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 456 |
+
"transformer.h.4.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 457 |
+
"transformer.h.4.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 458 |
+
"transformer.h.4.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 459 |
+
"transformer.h.4.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 460 |
+
"transformer.h.4.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 461 |
+
"transformer.h.40.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 462 |
+
"transformer.h.40.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 463 |
+
"transformer.h.40.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 464 |
+
"transformer.h.40.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 465 |
+
"transformer.h.40.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 466 |
+
"transformer.h.40.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 467 |
+
"transformer.h.40.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 468 |
+
"transformer.h.40.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 469 |
+
"transformer.h.40.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 470 |
+
"transformer.h.40.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 471 |
+
"transformer.h.40.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 472 |
+
"transformer.h.40.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 473 |
+
"transformer.h.40.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 474 |
+
"transformer.h.41.attn.c_attn.bias": "model-00002-of-00002.safetensors",
|
| 475 |
+
"transformer.h.41.attn.c_attn.weight": "model-00002-of-00002.safetensors",
|
| 476 |
+
"transformer.h.41.attn.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 477 |
+
"transformer.h.41.attn.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 478 |
+
"transformer.h.41.attn.rotary_emb.inv_freq": "model-00002-of-00002.safetensors",
|
| 479 |
+
"transformer.h.41.ln_1.bias": "model-00002-of-00002.safetensors",
|
| 480 |
+
"transformer.h.41.ln_1.weight": "model-00002-of-00002.safetensors",
|
| 481 |
+
"transformer.h.41.ln_2.bias": "model-00002-of-00002.safetensors",
|
| 482 |
+
"transformer.h.41.ln_2.weight": "model-00002-of-00002.safetensors",
|
| 483 |
+
"transformer.h.41.mlp.c_fc.bias": "model-00002-of-00002.safetensors",
|
| 484 |
+
"transformer.h.41.mlp.c_fc.weight": "model-00002-of-00002.safetensors",
|
| 485 |
+
"transformer.h.41.mlp.c_proj.bias": "model-00002-of-00002.safetensors",
|
| 486 |
+
"transformer.h.41.mlp.c_proj.weight": "model-00002-of-00002.safetensors",
|
| 487 |
+
"transformer.h.5.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 488 |
+
"transformer.h.5.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 489 |
+
"transformer.h.5.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 490 |
+
"transformer.h.5.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 491 |
+
"transformer.h.5.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 492 |
+
"transformer.h.5.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 493 |
+
"transformer.h.5.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 494 |
+
"transformer.h.5.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 495 |
+
"transformer.h.5.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 496 |
+
"transformer.h.5.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 497 |
+
"transformer.h.5.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 498 |
+
"transformer.h.5.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 499 |
+
"transformer.h.5.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 500 |
+
"transformer.h.6.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 501 |
+
"transformer.h.6.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 502 |
+
"transformer.h.6.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 503 |
+
"transformer.h.6.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 504 |
+
"transformer.h.6.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 505 |
+
"transformer.h.6.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 506 |
+
"transformer.h.6.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 507 |
+
"transformer.h.6.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 508 |
+
"transformer.h.6.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 509 |
+
"transformer.h.6.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 510 |
+
"transformer.h.6.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 511 |
+
"transformer.h.6.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 512 |
+
"transformer.h.6.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 513 |
+
"transformer.h.7.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 514 |
+
"transformer.h.7.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 515 |
+
"transformer.h.7.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 516 |
+
"transformer.h.7.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 517 |
+
"transformer.h.7.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 518 |
+
"transformer.h.7.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 519 |
+
"transformer.h.7.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 520 |
+
"transformer.h.7.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 521 |
+
"transformer.h.7.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 522 |
+
"transformer.h.7.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 523 |
+
"transformer.h.7.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 524 |
+
"transformer.h.7.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 525 |
+
"transformer.h.7.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 526 |
+
"transformer.h.8.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 527 |
+
"transformer.h.8.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 528 |
+
"transformer.h.8.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 529 |
+
"transformer.h.8.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 530 |
+
"transformer.h.8.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 531 |
+
"transformer.h.8.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 532 |
+
"transformer.h.8.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 533 |
+
"transformer.h.8.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 534 |
+
"transformer.h.8.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 535 |
+
"transformer.h.8.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 536 |
+
"transformer.h.8.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 537 |
+
"transformer.h.8.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 538 |
+
"transformer.h.8.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 539 |
+
"transformer.h.9.attn.c_attn.bias": "model-00001-of-00002.safetensors",
|
| 540 |
+
"transformer.h.9.attn.c_attn.weight": "model-00001-of-00002.safetensors",
|
| 541 |
+
"transformer.h.9.attn.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 542 |
+
"transformer.h.9.attn.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 543 |
+
"transformer.h.9.attn.rotary_emb.inv_freq": "model-00001-of-00002.safetensors",
|
| 544 |
+
"transformer.h.9.ln_1.bias": "model-00001-of-00002.safetensors",
|
| 545 |
+
"transformer.h.9.ln_1.weight": "model-00001-of-00002.safetensors",
|
| 546 |
+
"transformer.h.9.ln_2.bias": "model-00001-of-00002.safetensors",
|
| 547 |
+
"transformer.h.9.ln_2.weight": "model-00001-of-00002.safetensors",
|
| 548 |
+
"transformer.h.9.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
| 549 |
+
"transformer.h.9.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
| 550 |
+
"transformer.h.9.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
| 551 |
+
"transformer.h.9.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
| 552 |
+
"transformer.ln_f.bias": "model-00002-of-00002.safetensors",
|
| 553 |
+
"transformer.ln_f.weight": "model-00002-of-00002.safetensors",
|
| 554 |
+
"transformer.wte.weight": "model-00001-of-00002.safetensors"
|
| 555 |
+
}
|
| 556 |
+
}
|
modeling_kclgpt.py
ADDED
|
@@ -0,0 +1,939 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2023 The Bigcode team and HuggingFace Inc. team.
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""PyTorch KCLGPT model."""
|
| 15 |
+
import math
|
| 16 |
+
from typing import List, Optional, Tuple, Union
|
| 17 |
+
|
| 18 |
+
import torch
|
| 19 |
+
import torch.utils.checkpoint
|
| 20 |
+
from torch import nn
|
| 21 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
| 22 |
+
|
| 23 |
+
from transformers.activations import ACT2FN
|
| 24 |
+
from transformers.modeling_outputs import (
|
| 25 |
+
BaseModelOutputWithPastAndCrossAttentions,
|
| 26 |
+
CausalLMOutputWithCrossAttentions,
|
| 27 |
+
)
|
| 28 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 29 |
+
from transformers.utils import (
|
| 30 |
+
add_start_docstrings,
|
| 31 |
+
add_start_docstrings_to_model_forward,
|
| 32 |
+
logging,
|
| 33 |
+
)
|
| 34 |
+
from .configuration_kclgpt import KCLGPTConfig
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
logger = logging.get_logger(__name__)
|
| 38 |
+
|
| 39 |
+
# Fused kernels
|
| 40 |
+
# Use separate functions for each case because conditionals prevent kernel fusion.
|
| 41 |
+
# TODO: Could have better fused kernels depending on scaling, dropout and head mask.
|
| 42 |
+
# Is it doable without writing 32 functions?
|
| 43 |
+
@torch.jit.script
|
| 44 |
+
def upcast_masked_softmax(
|
| 45 |
+
x: torch.Tensor, mask: torch.Tensor, mask_value: torch.Tensor, scale: float, softmax_dtype: torch.dtype
|
| 46 |
+
):
|
| 47 |
+
input_dtype = x.dtype
|
| 48 |
+
x = x.to(softmax_dtype) * scale
|
| 49 |
+
x = torch.where(mask, x, mask_value)
|
| 50 |
+
x = torch.nn.functional.softmax(x, dim=-1).to(input_dtype)
|
| 51 |
+
return x
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
@torch.jit.script
|
| 55 |
+
def upcast_softmax(x: torch.Tensor, scale: float, softmax_dtype: torch.dtype):
|
| 56 |
+
input_dtype = x.dtype
|
| 57 |
+
x = x.to(softmax_dtype) * scale
|
| 58 |
+
x = torch.nn.functional.softmax(x, dim=-1).to(input_dtype)
|
| 59 |
+
return x
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
@torch.jit.script
|
| 63 |
+
def masked_softmax(x: torch.Tensor, mask: torch.Tensor, mask_value: torch.Tensor):
|
| 64 |
+
x = torch.where(mask, x, mask_value)
|
| 65 |
+
x = torch.nn.functional.softmax(x, dim=-1)
|
| 66 |
+
return x
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class LlamaRotaryEmbedding(torch.nn.Module):
|
| 70 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
|
| 71 |
+
super().__init__()
|
| 72 |
+
|
| 73 |
+
self.dim = dim
|
| 74 |
+
self.max_position_embeddings = max_position_embeddings
|
| 75 |
+
self.base = base
|
| 76 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 77 |
+
self.register_buffer("inv_freq", inv_freq)
|
| 78 |
+
|
| 79 |
+
# Build here to make `torch.jit.trace` work.
|
| 80 |
+
self._set_cos_sin_cache(
|
| 81 |
+
seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 85 |
+
self.max_seq_len_cached = seq_len
|
| 86 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 87 |
+
|
| 88 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 89 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 90 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 91 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 92 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 93 |
+
|
| 94 |
+
def forward(self, x, seq_len=None):
|
| 95 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
| 96 |
+
if seq_len > self.max_seq_len_cached:
|
| 97 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
|
| 98 |
+
|
| 99 |
+
return (
|
| 100 |
+
self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
| 101 |
+
self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding):
|
| 106 |
+
"""LlamaRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
|
| 107 |
+
|
| 108 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
| 109 |
+
self.scaling_factor = scaling_factor
|
| 110 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
| 111 |
+
|
| 112 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 113 |
+
self.max_seq_len_cached = seq_len
|
| 114 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 115 |
+
t = t / self.scaling_factor
|
| 116 |
+
|
| 117 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 118 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 119 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 120 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 121 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class LlamaDynamicNTKScalingRotaryEmbedding(LlamaRotaryEmbedding):
|
| 125 |
+
"""LlamaRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
|
| 126 |
+
|
| 127 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
| 128 |
+
self.scaling_factor = scaling_factor
|
| 129 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
| 130 |
+
|
| 131 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 132 |
+
self.max_seq_len_cached = seq_len
|
| 133 |
+
|
| 134 |
+
if seq_len > self.max_position_embeddings:
|
| 135 |
+
base = self.base * (
|
| 136 |
+
(self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
|
| 137 |
+
) ** (self.dim / (self.dim - 2))
|
| 138 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 139 |
+
self.register_buffer("inv_freq", inv_freq)
|
| 140 |
+
|
| 141 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 142 |
+
|
| 143 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 144 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 145 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 146 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 147 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 148 |
+
|
| 149 |
+
def rotate_half(x):
|
| 150 |
+
"""Rotates half the hidden dims of the input."""
|
| 151 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 152 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 153 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
| 157 |
+
# The first two dimensions of cos and sin are always 1, so we can `squeeze` them.
|
| 158 |
+
cos = cos.squeeze(1).squeeze(0) # [seq_len, dim]
|
| 159 |
+
sin = sin.squeeze(1).squeeze(0) # [seq_len, dim]
|
| 160 |
+
cos = cos[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
| 161 |
+
sin = sin[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
| 162 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 163 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 164 |
+
return q_embed, k_embed
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
class KCLGPTAttention(nn.Module):
|
| 168 |
+
def __init__(self, config, layer_idx=None):
|
| 169 |
+
super().__init__()
|
| 170 |
+
self.mask_value = None
|
| 171 |
+
|
| 172 |
+
self.position_embedding_type = config.position_embedding_type
|
| 173 |
+
self.rope_scaling = config.rope_scaling
|
| 174 |
+
self.max_position_embeddings = config.max_position_embeddings
|
| 175 |
+
|
| 176 |
+
self.group_query_attention = config.group_query_attention
|
| 177 |
+
self.num_query_groups = config.num_query_groups
|
| 178 |
+
|
| 179 |
+
self.embed_dim = config.hidden_size
|
| 180 |
+
self.num_heads = config.num_attention_heads
|
| 181 |
+
self.head_dim = self.embed_dim // self.num_heads
|
| 182 |
+
self.kv_heads = config.num_query_groups if self.group_query_attention else self.num_heads
|
| 183 |
+
self.kv_dim = self.kv_heads * self.head_dim
|
| 184 |
+
self.split_size = self.embed_dim
|
| 185 |
+
if self.head_dim * self.num_heads != self.embed_dim:
|
| 186 |
+
raise ValueError(
|
| 187 |
+
f"`embed_dim` must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`:"
|
| 188 |
+
f" {self.num_heads})."
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
self.scale_attn_weights = config.scale_attn_weights
|
| 192 |
+
|
| 193 |
+
self.layer_idx = layer_idx
|
| 194 |
+
self.attention_softmax_in_fp32 = config.attention_softmax_in_fp32
|
| 195 |
+
self.scale_attention_softmax_in_fp32 = (
|
| 196 |
+
config.scale_attention_softmax_in_fp32 and config.attention_softmax_in_fp32
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
self.c_attn = nn.Linear(self.embed_dim, self.embed_dim + 2 * self.kv_dim)
|
| 200 |
+
|
| 201 |
+
self.c_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 202 |
+
|
| 203 |
+
self.attn_dropout = nn.Dropout(config.attn_pdrop)
|
| 204 |
+
self.resid_dropout = nn.Dropout(config.resid_pdrop)
|
| 205 |
+
|
| 206 |
+
if self.position_embedding_type == "rope":
|
| 207 |
+
self._init_rope()
|
| 208 |
+
|
| 209 |
+
def _init_rope(self):
|
| 210 |
+
if self.rope_scaling is None:
|
| 211 |
+
self.rotary_emb = LlamaRotaryEmbedding(self.head_dim, max_position_embeddings=self.max_position_embeddings)
|
| 212 |
+
else:
|
| 213 |
+
scaling_type = self.rope_scaling["type"]
|
| 214 |
+
scaling_factor = self.rope_scaling["factor"]
|
| 215 |
+
if scaling_type == "linear":
|
| 216 |
+
self.rotary_emb = LlamaLinearScalingRotaryEmbedding(
|
| 217 |
+
self.head_dim, max_position_embeddings=self.max_position_embeddings, scaling_factor=scaling_factor
|
| 218 |
+
)
|
| 219 |
+
elif scaling_type == "dynamic":
|
| 220 |
+
self.rotary_emb = LlamaDynamicNTKScalingRotaryEmbedding(
|
| 221 |
+
self.head_dim, max_position_embeddings=self.max_position_embeddings, scaling_factor=scaling_factor
|
| 222 |
+
)
|
| 223 |
+
else:
|
| 224 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def _get_mask_value(self, device, dtype):
|
| 228 |
+
# torch.where expects a tensor. We use a cache to avoid recreating it every time.
|
| 229 |
+
if self.mask_value is None or self.mask_value.dtype != dtype or self.mask_value.device != device:
|
| 230 |
+
self.mask_value = torch.full([], torch.finfo(dtype).min, dtype=dtype, device=device)
|
| 231 |
+
return self.mask_value
|
| 232 |
+
|
| 233 |
+
def _attn(self, query, key, value, attention_mask=None, head_mask=None):
|
| 234 |
+
dtype = query.dtype
|
| 235 |
+
softmax_dtype = torch.float32 if self.attention_softmax_in_fp32 else dtype
|
| 236 |
+
upcast = dtype != softmax_dtype
|
| 237 |
+
|
| 238 |
+
unscale = self.layer_idx + 1 if self.scale_attention_softmax_in_fp32 and upcast else 1
|
| 239 |
+
scale_factor = unscale**-1
|
| 240 |
+
if self.scale_attn_weights:
|
| 241 |
+
scale_factor /= self.head_dim**0.5
|
| 242 |
+
|
| 243 |
+
# [b, np, sq, sk]
|
| 244 |
+
output_size = (query.size(1),
|
| 245 |
+
query.size(2),
|
| 246 |
+
query.size(0),
|
| 247 |
+
key.size(0))
|
| 248 |
+
attn_view = (output_size[0]*output_size[1], output_size[2], output_size[3])
|
| 249 |
+
|
| 250 |
+
# [sq, b, np, hn] -> [sq, b * np, hn]
|
| 251 |
+
query = query.reshape(output_size[2],
|
| 252 |
+
output_size[0] * output_size[1], -1)
|
| 253 |
+
# [sk, b, np, hn] -> [sk, b * np, hn]
|
| 254 |
+
key = key.reshape(output_size[3],
|
| 255 |
+
output_size[0] * output_size[1], -1)
|
| 256 |
+
attn_weights = torch.empty(attn_view, device=query.device, dtype=query.dtype)
|
| 257 |
+
if query.device.type == "cpu":
|
| 258 |
+
# This is needed because of a bug in pytorch https://github.com/pytorch/pytorch/issues/80588.
|
| 259 |
+
# The bug was fixed in https://github.com/pytorch/pytorch/pull/96086,
|
| 260 |
+
# but the fix has not been released as of pytorch version 2.0.0.
|
| 261 |
+
attn_weights = torch.zeros_like(attn_weights)
|
| 262 |
+
beta = 1
|
| 263 |
+
else:
|
| 264 |
+
beta = 0
|
| 265 |
+
|
| 266 |
+
attn_weights = torch.baddbmm(attn_weights,
|
| 267 |
+
query.transpose(0, 1),
|
| 268 |
+
key.transpose(0, 1).transpose(1, 2),
|
| 269 |
+
beta=beta, alpha=scale_factor).reshape(output_size)
|
| 270 |
+
|
| 271 |
+
if upcast:
|
| 272 |
+
# Use a fused kernel to prevent a large overhead from casting and scaling.
|
| 273 |
+
# Sub-optimal when the key length is not a multiple of 8.
|
| 274 |
+
if attention_mask is None:
|
| 275 |
+
attn_weights = upcast_softmax(attn_weights, unscale, softmax_dtype)
|
| 276 |
+
else:
|
| 277 |
+
mask_value = self._get_mask_value(attn_weights.device, softmax_dtype)
|
| 278 |
+
attn_weights = upcast_masked_softmax(attn_weights, attention_mask, mask_value, unscale, softmax_dtype)
|
| 279 |
+
else:
|
| 280 |
+
if attention_mask is not None:
|
| 281 |
+
mask_value = self._get_mask_value(attn_weights.device, softmax_dtype)
|
| 282 |
+
|
| 283 |
+
# The fused kernel is very slow when the key length is not a multiple of 8, so we skip fusion.
|
| 284 |
+
attn_weights = torch.where(attention_mask, attn_weights, mask_value)
|
| 285 |
+
|
| 286 |
+
attn_weights = torch.nn.functional.softmax(attn_weights, dim=-1)
|
| 287 |
+
|
| 288 |
+
attn_weights = self.attn_dropout(attn_weights)
|
| 289 |
+
|
| 290 |
+
attn_weights = attn_weights.reshape(attn_view)
|
| 291 |
+
|
| 292 |
+
# value_layer -> context layer.
|
| 293 |
+
# [sk, b, np, hn] --> [b, np, sq, hn]
|
| 294 |
+
|
| 295 |
+
# context layer shape: [b, np, sq, hn]
|
| 296 |
+
output_size = (value.size(1),
|
| 297 |
+
value.size(2),
|
| 298 |
+
query.size(0),
|
| 299 |
+
value.size(3))
|
| 300 |
+
|
| 301 |
+
# change view [sk, b * np, hn]
|
| 302 |
+
value = value.reshape(value.size(0),
|
| 303 |
+
output_size[0] * output_size[1], -1)
|
| 304 |
+
attn_output = torch.bmm(attn_weights, value.transpose(0, 1))
|
| 305 |
+
|
| 306 |
+
# change view [b, np, sq, hn]
|
| 307 |
+
attn_output = attn_output.reshape(*output_size)
|
| 308 |
+
# [b, np, sq, hn] --> [sq, b, np, hn]
|
| 309 |
+
attn_output = attn_output.permute(2, 0, 1, 3).contiguous()
|
| 310 |
+
|
| 311 |
+
# [sq, b, np, hn] --> [sq, b, hp]
|
| 312 |
+
attn_output = attn_output.reshape(attn_output.size(0), attn_output.size(1), -1)
|
| 313 |
+
|
| 314 |
+
return attn_output, attn_weights
|
| 315 |
+
|
| 316 |
+
def forward(
|
| 317 |
+
self,
|
| 318 |
+
hidden_states: torch.Tensor,
|
| 319 |
+
layer_past: Optional[torch.Tensor] = None,
|
| 320 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 321 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 322 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 323 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 324 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 325 |
+
use_cache: Optional[bool] = False,
|
| 326 |
+
output_attentions: Optional[bool] = False,
|
| 327 |
+
) -> Union[
|
| 328 |
+
Tuple[torch.Tensor, Optional[torch.Tensor]],
|
| 329 |
+
Tuple[torch.Tensor, Optional[torch.Tensor], Tuple[torch.Tensor, ...]],
|
| 330 |
+
]:
|
| 331 |
+
if self.group_query_attention:
|
| 332 |
+
query, key_value = self.c_attn(hidden_states).split((self.embed_dim, 2 * self.kv_dim), dim=2)
|
| 333 |
+
else:
|
| 334 |
+
# Note: We split as (self.num_heads, 3, self.head_dim) instead of (3, self.num_heads, self.head_dim),
|
| 335 |
+
# i.e., the memory layout is not the same as GPT2.
|
| 336 |
+
# This makes the concatenation with past_key_value more efficient.
|
| 337 |
+
query, key_value = (
|
| 338 |
+
self.c_attn(hidden_states)
|
| 339 |
+
.reshape(*hidden_states.shape[:2], self.num_heads, 3 * self.head_dim)
|
| 340 |
+
.transpose(1, 2)
|
| 341 |
+
.split((self.head_dim, 2 * self.head_dim), dim=3)
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
+
query = query.reshape(query.size(0), query.size(1), -1, self.head_dim)
|
| 345 |
+
|
| 346 |
+
key, value = key_value.split((self.head_dim*self.num_query_groups, self.head_dim*self.num_query_groups), dim=-1)
|
| 347 |
+
# expand the key_layer and value_layer [sk, b, ng, hn] -> [sk, b, np, hn]
|
| 348 |
+
key = key.reshape(key.size(0), key.size(1), -1, self.head_dim)
|
| 349 |
+
value = value.reshape(value.size(0), value.size(1), -1, self.head_dim)
|
| 350 |
+
|
| 351 |
+
key = key.repeat_interleave(
|
| 352 |
+
self.num_heads // self.num_query_groups,
|
| 353 |
+
dim = 2
|
| 354 |
+
)
|
| 355 |
+
value = value.repeat_interleave(
|
| 356 |
+
self.num_heads // self.num_query_groups,
|
| 357 |
+
dim = 2
|
| 358 |
+
)
|
| 359 |
+
|
| 360 |
+
if self.position_embedding_type == "rope":
|
| 361 |
+
kv_seq_len = key.shape[-3]
|
| 362 |
+
if layer_past is not None:
|
| 363 |
+
kv_seq_len += layer_past[0].shape[-3]
|
| 364 |
+
|
| 365 |
+
cos, sin = self.rotary_emb(value, seq_len=kv_seq_len)
|
| 366 |
+
query = query.transpose(1, 2).contiguous()
|
| 367 |
+
key = key.transpose(1, 2).contiguous()
|
| 368 |
+
query, key = apply_rotary_pos_emb(query, key, cos, sin, position_ids)
|
| 369 |
+
query = query.transpose(1, 2).contiguous()
|
| 370 |
+
key = key.transpose(1, 2).contiguous()
|
| 371 |
+
|
| 372 |
+
if layer_past is not None:
|
| 373 |
+
key = torch.cat((layer_past[0], key), dim=-3)
|
| 374 |
+
value = torch.cat((layer_past[1], value), dim=-3)
|
| 375 |
+
present = (key, value) if use_cache else None
|
| 376 |
+
|
| 377 |
+
attn_output, attn_weights = self._attn(query.transpose(0, 1), key.transpose(0, 1), value.transpose(0, 1), attention_mask, head_mask)
|
| 378 |
+
|
| 379 |
+
attn_output = attn_output.transpose(0, 1).reshape(hidden_states.shape)
|
| 380 |
+
attn_output = self.c_proj(attn_output)
|
| 381 |
+
attn_output = self.resid_dropout(attn_output)
|
| 382 |
+
|
| 383 |
+
outputs = (attn_output, present)
|
| 384 |
+
if output_attentions:
|
| 385 |
+
if self.group_query_attention:
|
| 386 |
+
# Transpose to return weights in the usual format (batch_size, num_heads, query_length, key_length)
|
| 387 |
+
attn_weights = attn_weights.transpose(1, 2)
|
| 388 |
+
outputs += (attn_weights,)
|
| 389 |
+
|
| 390 |
+
return outputs # a, present, (attentions)
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
class KCLGPTMLP(nn.Module):
|
| 394 |
+
def __init__(self, intermediate_size, config):
|
| 395 |
+
super().__init__()
|
| 396 |
+
embed_dim = config.hidden_size
|
| 397 |
+
self.c_fc = nn.Linear(embed_dim, intermediate_size)
|
| 398 |
+
self.c_proj = nn.Linear(intermediate_size, embed_dim)
|
| 399 |
+
self.act = ACT2FN[config.activation_function]
|
| 400 |
+
self.dropout = nn.Dropout(config.resid_pdrop)
|
| 401 |
+
|
| 402 |
+
# Copied from transformers.models.gpt2.modeling_gpt2.GPT2MLP.forward
|
| 403 |
+
def forward(self, hidden_states: Optional[Tuple[torch.Tensor]]) -> torch.Tensor:
|
| 404 |
+
hidden_states = self.c_fc(hidden_states)
|
| 405 |
+
hidden_states = self.act(hidden_states)
|
| 406 |
+
hidden_states = self.c_proj(hidden_states)
|
| 407 |
+
hidden_states = self.dropout(hidden_states)
|
| 408 |
+
return hidden_states
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
class KCLGPTBlock(nn.Module):
|
| 412 |
+
def __init__(self, config, layer_idx=None):
|
| 413 |
+
super().__init__()
|
| 414 |
+
hidden_size = config.hidden_size
|
| 415 |
+
self.inner_dim = config.n_inner if config.n_inner is not None else 4 * hidden_size
|
| 416 |
+
|
| 417 |
+
self.ln_1 = nn.LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
|
| 418 |
+
self.attn = KCLGPTAttention(config, layer_idx=layer_idx)
|
| 419 |
+
self.ln_2 = nn.LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
|
| 420 |
+
|
| 421 |
+
self.mlp = KCLGPTMLP(self.inner_dim, config)
|
| 422 |
+
|
| 423 |
+
def forward(
|
| 424 |
+
self,
|
| 425 |
+
hidden_states: Optional[Tuple[torch.Tensor]],
|
| 426 |
+
layer_past: Optional[torch.Tensor] = None,
|
| 427 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 428 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 429 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 430 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 431 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 432 |
+
use_cache: Optional[bool] = False,
|
| 433 |
+
output_attentions: Optional[bool] = False,
|
| 434 |
+
) -> Union[
|
| 435 |
+
Tuple[torch.Tensor], Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor, torch.Tensor]
|
| 436 |
+
]:
|
| 437 |
+
residual = hidden_states
|
| 438 |
+
hidden_states = self.ln_1(hidden_states)
|
| 439 |
+
attn_outputs = self.attn(
|
| 440 |
+
hidden_states,
|
| 441 |
+
layer_past=layer_past,
|
| 442 |
+
attention_mask=attention_mask,
|
| 443 |
+
position_ids=position_ids,
|
| 444 |
+
head_mask=head_mask,
|
| 445 |
+
use_cache=use_cache,
|
| 446 |
+
output_attentions=output_attentions,
|
| 447 |
+
)
|
| 448 |
+
attn_output = attn_outputs[0] # output_attn: a, present, (attentions)
|
| 449 |
+
|
| 450 |
+
outputs = attn_outputs[1:]
|
| 451 |
+
# residual connection
|
| 452 |
+
hidden_states = attn_output + residual
|
| 453 |
+
|
| 454 |
+
residual = hidden_states
|
| 455 |
+
hidden_states = self.ln_2(hidden_states)
|
| 456 |
+
feed_forward_hidden_states = self.mlp(hidden_states)
|
| 457 |
+
# residual connection
|
| 458 |
+
hidden_states = residual + feed_forward_hidden_states
|
| 459 |
+
|
| 460 |
+
if use_cache:
|
| 461 |
+
outputs = (hidden_states,) + outputs
|
| 462 |
+
else:
|
| 463 |
+
outputs = (hidden_states,) + outputs[1:]
|
| 464 |
+
|
| 465 |
+
return outputs # hidden_states, present, (attentions, cross_attentions)
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
class KCLGPTPreTrainedModel(PreTrainedModel):
|
| 469 |
+
"""
|
| 470 |
+
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
|
| 471 |
+
models.
|
| 472 |
+
"""
|
| 473 |
+
|
| 474 |
+
config_class = KCLGPTConfig
|
| 475 |
+
base_model_prefix = "transformer"
|
| 476 |
+
supports_gradient_checkpointing = True
|
| 477 |
+
_no_split_modules = ["KCLGPTBlock"]
|
| 478 |
+
_skip_keys_device_placement = "past_key_values"
|
| 479 |
+
|
| 480 |
+
def __init__(self, *inputs, **kwargs):
|
| 481 |
+
super().__init__(*inputs, **kwargs)
|
| 482 |
+
|
| 483 |
+
def _init_weights(self, module):
|
| 484 |
+
"""Initialize the weights."""
|
| 485 |
+
if isinstance(module, (KCLGPTMLP, KCLGPTAttention)):
|
| 486 |
+
# Reinitialize selected weights subject to the OpenAI GPT-2 Paper Scheme:
|
| 487 |
+
# > A modified initialization which accounts for the accumulation on the residual path with model depth. Scale
|
| 488 |
+
# > the weights of residual layers at initialization by a factor of 1/√N where N is the # of residual layers.
|
| 489 |
+
# > -- GPT-2 :: https://openai.com/blog/better-language-models/
|
| 490 |
+
#
|
| 491 |
+
# Reference (Megatron-LM): https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/model/gpt_model.py
|
| 492 |
+
module.c_proj.weight.data.normal_(
|
| 493 |
+
mean=0.0, std=(self.config.initializer_range / math.sqrt(2 * self.config.n_layer))
|
| 494 |
+
)
|
| 495 |
+
module.c_proj._is_hf_initialized = True
|
| 496 |
+
elif isinstance(module, nn.Linear):
|
| 497 |
+
# Slightly different from the TF version which uses truncated_normal for initialization
|
| 498 |
+
# cf https://github.com/pytorch/pytorch/pull/5617
|
| 499 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 500 |
+
if module.bias is not None:
|
| 501 |
+
module.bias.data.zero_()
|
| 502 |
+
elif isinstance(module, nn.Embedding):
|
| 503 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 504 |
+
if module.padding_idx is not None:
|
| 505 |
+
module.weight.data[module.padding_idx].zero_()
|
| 506 |
+
elif isinstance(module, nn.LayerNorm):
|
| 507 |
+
module.bias.data.zero_()
|
| 508 |
+
module.weight.data.fill_(1.0)
|
| 509 |
+
|
| 510 |
+
# Copied from transformers.models.gpt2.modeling_gpt2.GPT2PreTrainedModel._set_gradient_checkpointing with GPT2->KCLGPT
|
| 511 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
| 512 |
+
if isinstance(module, KCLGPTModel):
|
| 513 |
+
module.gradient_checkpointing = value
|
| 514 |
+
|
| 515 |
+
|
| 516 |
+
GPT_BIGCODE_START_DOCSTRING = r"""
|
| 517 |
+
|
| 518 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
| 519 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
| 520 |
+
etc.)
|
| 521 |
+
|
| 522 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
| 523 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
| 524 |
+
and behavior.
|
| 525 |
+
|
| 526 |
+
Parameters:
|
| 527 |
+
config ([`KCLGPTConfig`]): Model configuration class with all the parameters of the model.
|
| 528 |
+
Initializing with a config file does not load the weights associated with the model, only the
|
| 529 |
+
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
| 530 |
+
"""
|
| 531 |
+
|
| 532 |
+
GPT_BIGCODE_INPUTS_DOCSTRING = r"""
|
| 533 |
+
Args:
|
| 534 |
+
input_ids (`torch.Tensor` of shape `(batch_size, input_ids_length)`):
|
| 535 |
+
`input_ids_length` = `sequence_length` if `past_key_values` is `None` else
|
| 536 |
+
`past_key_values[0][0].shape[-2]` (`sequence_length` of input past key value states). Indices of input
|
| 537 |
+
sequence tokens in the vocabulary.
|
| 538 |
+
|
| 539 |
+
If `past_key_values` is used, only `input_ids` that do not have their past calculated should be passed as
|
| 540 |
+
`input_ids`.
|
| 541 |
+
|
| 542 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
| 543 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
| 544 |
+
|
| 545 |
+
[What are input IDs?](../glossary#input-ids)
|
| 546 |
+
past_key_values (`Tuple[torch.Tensor]` of length `config.n_layers`):
|
| 547 |
+
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
|
| 548 |
+
`past_key_values` output below). Can be used to speed up sequential decoding. The `input_ids` which have
|
| 549 |
+
their past given to this model should not be passed as `input_ids` as they have already been computed.
|
| 550 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 551 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
| 552 |
+
|
| 553 |
+
- 1 for tokens that are **not masked**,
|
| 554 |
+
- 0 for tokens that are **masked**.
|
| 555 |
+
|
| 556 |
+
If `past_key_values` is used, `attention_mask` needs to contain the masking strategy that was used for
|
| 557 |
+
`past_key_values`. In other words, the `attention_mask` always has to have the length:
|
| 558 |
+
`len(past_key_values) + len(input_ids)`
|
| 559 |
+
|
| 560 |
+
[What are attention masks?](../glossary#attention-mask)
|
| 561 |
+
token_type_ids (`torch.Tensor` of shape `(batch_size, input_ids_length)`, *optional*):
|
| 562 |
+
Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
|
| 563 |
+
1]`:
|
| 564 |
+
|
| 565 |
+
- 0 corresponds to a *sentence A* token,
|
| 566 |
+
- 1 corresponds to a *sentence B* token.
|
| 567 |
+
|
| 568 |
+
[What are token type IDs?](../glossary#token-type-ids)
|
| 569 |
+
position_ids (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 570 |
+
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
| 571 |
+
config.max_position_embeddings - 1]`.
|
| 572 |
+
|
| 573 |
+
[What are position IDs?](../glossary#position-ids)
|
| 574 |
+
head_mask (`torch.Tensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
|
| 575 |
+
Mask to nullify selected heads of the self-attention modules. Mask values selected in `[0, 1]`:
|
| 576 |
+
|
| 577 |
+
- 1 indicates the head is **not masked**,
|
| 578 |
+
- 0 indicates the head is **masked**.
|
| 579 |
+
|
| 580 |
+
inputs_embeds (`torch.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
| 581 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
|
| 582 |
+
is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
|
| 583 |
+
model's internal embedding lookup matrix.
|
| 584 |
+
|
| 585 |
+
If `past_key_values` is used, optionally only the last `inputs_embeds` have to be input (see
|
| 586 |
+
`past_key_values`).
|
| 587 |
+
use_cache (`bool`, *optional*):
|
| 588 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
| 589 |
+
`past_key_values`).
|
| 590 |
+
output_attentions (`bool`, *optional*):
|
| 591 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
| 592 |
+
tensors for more detail.
|
| 593 |
+
output_hidden_states (`bool`, *optional*):
|
| 594 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
| 595 |
+
more detail.
|
| 596 |
+
return_dict (`bool`, *optional*):
|
| 597 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
| 598 |
+
"""
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
@add_start_docstrings(
|
| 602 |
+
"The bare GPT_BIGCODE Model transformer outputting raw hidden-states without any specific head on top.",
|
| 603 |
+
GPT_BIGCODE_START_DOCSTRING,
|
| 604 |
+
)
|
| 605 |
+
class KCLGPTModel(KCLGPTPreTrainedModel):
|
| 606 |
+
def __init__(self, config):
|
| 607 |
+
super().__init__(config)
|
| 608 |
+
self.group_query_attention = config.group_query_attention
|
| 609 |
+
self.num_query_groups = config.num_query_groups
|
| 610 |
+
self.position_embedding_type = config.position_embedding_type
|
| 611 |
+
self.embed_dim = config.hidden_size
|
| 612 |
+
|
| 613 |
+
self.wte = nn.Embedding(config.vocab_size, self.embed_dim)
|
| 614 |
+
if self.position_embedding_type == "learned_absolute":
|
| 615 |
+
self.wpe = nn.Embedding(config.max_position_embeddings, self.embed_dim)
|
| 616 |
+
else:
|
| 617 |
+
pass
|
| 618 |
+
|
| 619 |
+
self.drop = nn.Dropout(config.embd_pdrop)
|
| 620 |
+
self.h = nn.ModuleList([KCLGPTBlock(config, layer_idx=i) for i in range(config.num_hidden_layers)])
|
| 621 |
+
self.ln_f = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)
|
| 622 |
+
|
| 623 |
+
max_positions = config.max_position_embeddings
|
| 624 |
+
self.register_buffer(
|
| 625 |
+
"bias", torch.tril(torch.ones((max_positions, max_positions), dtype=torch.bool)), persistent=False
|
| 626 |
+
)
|
| 627 |
+
|
| 628 |
+
self.gradient_checkpointing = False
|
| 629 |
+
|
| 630 |
+
# Initialize weights and apply final processing
|
| 631 |
+
self.post_init()
|
| 632 |
+
|
| 633 |
+
def get_input_embeddings(self):
|
| 634 |
+
return self.wte
|
| 635 |
+
|
| 636 |
+
def set_input_embeddings(self, new_embeddings):
|
| 637 |
+
self.wte = new_embeddings
|
| 638 |
+
|
| 639 |
+
@add_start_docstrings_to_model_forward(GPT_BIGCODE_INPUTS_DOCSTRING)
|
| 640 |
+
def forward(
|
| 641 |
+
self,
|
| 642 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 643 |
+
past_key_values: Optional[List[torch.Tensor]] = None,
|
| 644 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 645 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 646 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 647 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 648 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 649 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 650 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 651 |
+
use_cache: Optional[bool] = None,
|
| 652 |
+
output_attentions: Optional[bool] = None,
|
| 653 |
+
output_hidden_states: Optional[bool] = None,
|
| 654 |
+
return_dict: Optional[bool] = None,
|
| 655 |
+
) -> Union[Tuple, BaseModelOutputWithPastAndCrossAttentions]:
|
| 656 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 657 |
+
output_hidden_states = (
|
| 658 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 659 |
+
)
|
| 660 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 661 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 662 |
+
|
| 663 |
+
if input_ids is not None and inputs_embeds is not None:
|
| 664 |
+
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
|
| 665 |
+
elif input_ids is not None:
|
| 666 |
+
input_shape = input_ids.size()
|
| 667 |
+
input_ids = input_ids.reshape(-1, input_shape[-1])
|
| 668 |
+
batch_size = input_ids.shape[0]
|
| 669 |
+
elif inputs_embeds is not None:
|
| 670 |
+
input_shape = inputs_embeds.size()[:-1]
|
| 671 |
+
batch_size = inputs_embeds.shape[0]
|
| 672 |
+
else:
|
| 673 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
| 674 |
+
|
| 675 |
+
if batch_size <= 0:
|
| 676 |
+
raise ValueError("batch_size has to be defined and > 0")
|
| 677 |
+
|
| 678 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
| 679 |
+
|
| 680 |
+
if token_type_ids is not None:
|
| 681 |
+
token_type_ids = token_type_ids.reshape(-1, input_shape[-1])
|
| 682 |
+
if position_ids is not None:
|
| 683 |
+
position_ids = position_ids.reshape(-1, input_shape[-1])
|
| 684 |
+
|
| 685 |
+
if past_key_values is None:
|
| 686 |
+
past_length = 0
|
| 687 |
+
past_key_values = tuple([None] * len(self.h))
|
| 688 |
+
else:
|
| 689 |
+
past_length = past_key_values[0][0].size(-3)
|
| 690 |
+
|
| 691 |
+
if attention_mask is not None and len(attention_mask.shape) == 2 and position_ids is None:
|
| 692 |
+
# create position_ids on the fly for batch generation
|
| 693 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 694 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 695 |
+
if past_length > 0:
|
| 696 |
+
position_ids = position_ids[:, past_length : input_shape[-1] + past_length :]
|
| 697 |
+
elif position_ids is None:
|
| 698 |
+
position_ids = torch.arange(past_length, input_shape[-1] + past_length, dtype=torch.long, device=device)
|
| 699 |
+
position_ids = position_ids.unsqueeze(0).reshape(-1, input_shape[-1])
|
| 700 |
+
|
| 701 |
+
# Self-attention mask.
|
| 702 |
+
query_length = input_shape[-1]
|
| 703 |
+
key_length = past_length + query_length
|
| 704 |
+
self_attention_mask = self.bias[None, key_length - query_length : key_length, :key_length]
|
| 705 |
+
|
| 706 |
+
if attention_mask is not None:
|
| 707 |
+
self_attention_mask = self_attention_mask * attention_mask.reshape(batch_size, 1, -1).to(
|
| 708 |
+
dtype=torch.bool, device=self_attention_mask.device
|
| 709 |
+
)
|
| 710 |
+
|
| 711 |
+
# MQA models: (batch_size, query_length, n_heads, key_length)
|
| 712 |
+
# MHA models: (batch_size, n_heads, query_length, key_length)
|
| 713 |
+
attention_mask = self_attention_mask.unsqueeze(1)
|
| 714 |
+
|
| 715 |
+
encoder_attention_mask = None
|
| 716 |
+
|
| 717 |
+
# Prepare head mask if needed
|
| 718 |
+
# 1.0 in head_mask indicate we keep the head
|
| 719 |
+
# attention_probs has shape bsz x n_heads x N x N
|
| 720 |
+
# head_mask has shape n_layer x batch x n_heads x N x N
|
| 721 |
+
head_mask = self.get_head_mask(head_mask, self.config.n_layer)
|
| 722 |
+
|
| 723 |
+
if inputs_embeds is None:
|
| 724 |
+
inputs_embeds = self.wte(input_ids)
|
| 725 |
+
|
| 726 |
+
hidden_states = inputs_embeds
|
| 727 |
+
if self.position_embedding_type == "learned_absolute":
|
| 728 |
+
position_embeds = self.wpe(position_ids)
|
| 729 |
+
hidden_states = hidden_states + position_embeds
|
| 730 |
+
|
| 731 |
+
if token_type_ids is not None:
|
| 732 |
+
token_type_embeds = self.wte(token_type_ids)
|
| 733 |
+
hidden_states = hidden_states + token_type_embeds
|
| 734 |
+
|
| 735 |
+
hidden_states = self.drop(hidden_states)
|
| 736 |
+
|
| 737 |
+
output_shape = input_shape + (hidden_states.size(-1),)
|
| 738 |
+
|
| 739 |
+
presents = [] if use_cache else None
|
| 740 |
+
all_self_attentions = () if output_attentions else None
|
| 741 |
+
all_hidden_states = () if output_hidden_states else None
|
| 742 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
| 743 |
+
if output_hidden_states:
|
| 744 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 745 |
+
|
| 746 |
+
if self.gradient_checkpointing and self.training:
|
| 747 |
+
|
| 748 |
+
def create_custom_forward(module):
|
| 749 |
+
def custom_forward(*inputs):
|
| 750 |
+
# None for past_key_value
|
| 751 |
+
return module(*inputs, use_cache, output_attentions)
|
| 752 |
+
|
| 753 |
+
return custom_forward
|
| 754 |
+
|
| 755 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
| 756 |
+
create_custom_forward(block),
|
| 757 |
+
hidden_states,
|
| 758 |
+
None,
|
| 759 |
+
attention_mask,
|
| 760 |
+
position_ids,
|
| 761 |
+
head_mask[i],
|
| 762 |
+
encoder_hidden_states,
|
| 763 |
+
encoder_attention_mask,
|
| 764 |
+
)
|
| 765 |
+
else:
|
| 766 |
+
outputs = block(
|
| 767 |
+
hidden_states,
|
| 768 |
+
layer_past=layer_past,
|
| 769 |
+
attention_mask=attention_mask,
|
| 770 |
+
position_ids=position_ids,
|
| 771 |
+
head_mask=head_mask[i],
|
| 772 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 773 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 774 |
+
use_cache=use_cache,
|
| 775 |
+
output_attentions=output_attentions,
|
| 776 |
+
)
|
| 777 |
+
|
| 778 |
+
hidden_states = outputs[0]
|
| 779 |
+
if use_cache:
|
| 780 |
+
presents.append(outputs[1])
|
| 781 |
+
|
| 782 |
+
if output_attentions:
|
| 783 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
| 784 |
+
|
| 785 |
+
hidden_states = self.ln_f(hidden_states)
|
| 786 |
+
hidden_states = hidden_states.reshape(output_shape)
|
| 787 |
+
# Add last hidden state
|
| 788 |
+
if output_hidden_states:
|
| 789 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 790 |
+
|
| 791 |
+
|
| 792 |
+
if not return_dict:
|
| 793 |
+
return tuple(
|
| 794 |
+
v
|
| 795 |
+
for v in [hidden_states, presents, all_hidden_states, all_self_attentions]
|
| 796 |
+
if v is not None
|
| 797 |
+
)
|
| 798 |
+
|
| 799 |
+
return BaseModelOutputWithPastAndCrossAttentions(
|
| 800 |
+
last_hidden_state=hidden_states,
|
| 801 |
+
past_key_values=presents,
|
| 802 |
+
hidden_states=all_hidden_states,
|
| 803 |
+
attentions=all_self_attentions,
|
| 804 |
+
)
|
| 805 |
+
|
| 806 |
+
|
| 807 |
+
@add_start_docstrings(
|
| 808 |
+
"""
|
| 809 |
+
The GPT_BIGCODE Model transformer with a language modeling head on top (linear layer with weights tied to the input
|
| 810 |
+
embeddings).
|
| 811 |
+
""",
|
| 812 |
+
GPT_BIGCODE_START_DOCSTRING,
|
| 813 |
+
)
|
| 814 |
+
class KCLGPTForCausalLM(KCLGPTPreTrainedModel):
|
| 815 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 816 |
+
|
| 817 |
+
def __init__(self, config):
|
| 818 |
+
super().__init__(config)
|
| 819 |
+
self.transformer = KCLGPTModel(config)
|
| 820 |
+
self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False)
|
| 821 |
+
|
| 822 |
+
# Initialize weights and apply final processing
|
| 823 |
+
self.post_init()
|
| 824 |
+
|
| 825 |
+
def get_output_embeddings(self):
|
| 826 |
+
return self.lm_head
|
| 827 |
+
|
| 828 |
+
def set_output_embeddings(self, new_embeddings):
|
| 829 |
+
self.lm_head = new_embeddings
|
| 830 |
+
|
| 831 |
+
def prepare_inputs_for_generation(self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs):
|
| 832 |
+
token_type_ids = kwargs.get("token_type_ids", None)
|
| 833 |
+
# only last token for inputs_ids if past is defined in kwargs
|
| 834 |
+
if past_key_values:
|
| 835 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
| 836 |
+
if token_type_ids is not None:
|
| 837 |
+
token_type_ids = token_type_ids[:, -1].unsqueeze(-1)
|
| 838 |
+
|
| 839 |
+
attention_mask = kwargs.get("attention_mask", None)
|
| 840 |
+
position_ids = kwargs.get("position_ids", None)
|
| 841 |
+
|
| 842 |
+
if attention_mask is not None and position_ids is None:
|
| 843 |
+
# create position_ids on the fly for batch generation
|
| 844 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 845 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 846 |
+
if past_key_values:
|
| 847 |
+
position_ids = position_ids[:, -1].unsqueeze(-1)
|
| 848 |
+
else:
|
| 849 |
+
position_ids = None
|
| 850 |
+
|
| 851 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
| 852 |
+
if inputs_embeds is not None and past_key_values is None:
|
| 853 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
| 854 |
+
else:
|
| 855 |
+
model_inputs = {"input_ids": input_ids}
|
| 856 |
+
|
| 857 |
+
model_inputs.update(
|
| 858 |
+
{
|
| 859 |
+
"past_key_values": past_key_values,
|
| 860 |
+
"use_cache": kwargs.get("use_cache"),
|
| 861 |
+
"position_ids": position_ids,
|
| 862 |
+
"attention_mask": attention_mask,
|
| 863 |
+
"token_type_ids": token_type_ids,
|
| 864 |
+
}
|
| 865 |
+
)
|
| 866 |
+
return model_inputs
|
| 867 |
+
|
| 868 |
+
@add_start_docstrings_to_model_forward(GPT_BIGCODE_INPUTS_DOCSTRING)
|
| 869 |
+
def forward(
|
| 870 |
+
self,
|
| 871 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 872 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
| 873 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 874 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 875 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 876 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 877 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 878 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 879 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 880 |
+
labels: Optional[torch.Tensor] = None,
|
| 881 |
+
use_cache: Optional[bool] = None,
|
| 882 |
+
output_attentions: Optional[bool] = None,
|
| 883 |
+
output_hidden_states: Optional[bool] = None,
|
| 884 |
+
return_dict: Optional[bool] = None,
|
| 885 |
+
) -> Union[Tuple, CausalLMOutputWithCrossAttentions]:
|
| 886 |
+
r"""
|
| 887 |
+
labels (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 888 |
+
Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
|
| 889 |
+
`labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
|
| 890 |
+
are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
|
| 891 |
+
"""
|
| 892 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 893 |
+
|
| 894 |
+
transformer_outputs = self.transformer(
|
| 895 |
+
input_ids,
|
| 896 |
+
past_key_values=past_key_values,
|
| 897 |
+
attention_mask=attention_mask,
|
| 898 |
+
token_type_ids=token_type_ids,
|
| 899 |
+
position_ids=position_ids,
|
| 900 |
+
head_mask=head_mask,
|
| 901 |
+
inputs_embeds=inputs_embeds,
|
| 902 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 903 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 904 |
+
use_cache=use_cache,
|
| 905 |
+
output_attentions=output_attentions,
|
| 906 |
+
output_hidden_states=output_hidden_states,
|
| 907 |
+
return_dict=return_dict,
|
| 908 |
+
)
|
| 909 |
+
hidden_states = transformer_outputs[0]
|
| 910 |
+
lm_logits = self.lm_head(hidden_states)
|
| 911 |
+
loss = None
|
| 912 |
+
if labels is not None:
|
| 913 |
+
# Shift so that tokens < n predict n
|
| 914 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
| 915 |
+
shift_labels = labels[..., 1:].contiguous().to(shift_logits.device)
|
| 916 |
+
# Flatten the tokens
|
| 917 |
+
loss_fct = CrossEntropyLoss()
|
| 918 |
+
loss = loss_fct(shift_logits.reshape(-1, shift_logits.size(-1)), shift_labels.reshape(-1))
|
| 919 |
+
|
| 920 |
+
if not return_dict:
|
| 921 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
| 922 |
+
return ((loss,) + output) if loss is not None else output
|
| 923 |
+
|
| 924 |
+
return CausalLMOutputWithCrossAttentions(
|
| 925 |
+
loss=loss,
|
| 926 |
+
logits=lm_logits,
|
| 927 |
+
past_key_values=transformer_outputs.past_key_values,
|
| 928 |
+
hidden_states=transformer_outputs.hidden_states,
|
| 929 |
+
attentions=transformer_outputs.attentions,
|
| 930 |
+
)
|
| 931 |
+
|
| 932 |
+
@staticmethod
|
| 933 |
+
def _reorder_cache(past_key_values, beam_idx):
|
| 934 |
+
reordered_past = ()
|
| 935 |
+
for layer_past in past_key_values:
|
| 936 |
+
reordered_past += (
|
| 937 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
|
| 938 |
+
)
|
| 939 |
+
return reordered_past
|
modeling_shell.py
ADDED
|
@@ -0,0 +1,858 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2023 The Bigcode team and HuggingFace Inc. team.
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""PyTorch Shell model."""
|
| 15 |
+
import math
|
| 16 |
+
from typing import List, Optional, Tuple, Union
|
| 17 |
+
|
| 18 |
+
import torch
|
| 19 |
+
import torch.utils.checkpoint
|
| 20 |
+
from torch import nn
|
| 21 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
| 22 |
+
|
| 23 |
+
from transformers.activations import ACT2FN
|
| 24 |
+
from transformers.modeling_outputs import (
|
| 25 |
+
BaseModelOutputWithPastAndCrossAttentions,
|
| 26 |
+
CausalLMOutputWithCrossAttentions,
|
| 27 |
+
)
|
| 28 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 29 |
+
from transformers.utils import (
|
| 30 |
+
add_start_docstrings,
|
| 31 |
+
add_start_docstrings_to_model_forward,
|
| 32 |
+
logging,
|
| 33 |
+
)
|
| 34 |
+
from .configuration_shell import ShellConfig
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
logger = logging.get_logger(__name__)
|
| 38 |
+
|
| 39 |
+
# Fused kernels
|
| 40 |
+
# Use separate functions for each case because conditionals prevent kernel fusion.
|
| 41 |
+
# TODO: Could have better fused kernels depending on scaling, dropout and head mask.
|
| 42 |
+
# Is it doable without writing 32 functions?
|
| 43 |
+
@torch.jit.script
|
| 44 |
+
def upcast_masked_softmax(
|
| 45 |
+
x: torch.Tensor, mask: torch.Tensor, mask_value: torch.Tensor, scale: float, softmax_dtype: torch.dtype
|
| 46 |
+
):
|
| 47 |
+
input_dtype = x.dtype
|
| 48 |
+
x = x.to(softmax_dtype) * scale
|
| 49 |
+
x = torch.where(mask, x, mask_value)
|
| 50 |
+
x = torch.nn.functional.softmax(x, dim=-1).to(input_dtype)
|
| 51 |
+
return x
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
@torch.jit.script
|
| 55 |
+
def upcast_softmax(x: torch.Tensor, scale: float, softmax_dtype: torch.dtype):
|
| 56 |
+
input_dtype = x.dtype
|
| 57 |
+
x = x.to(softmax_dtype) * scale
|
| 58 |
+
x = torch.nn.functional.softmax(x, dim=-1).to(input_dtype)
|
| 59 |
+
return x
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
@torch.jit.script
|
| 63 |
+
def masked_softmax(x: torch.Tensor, mask: torch.Tensor, mask_value: torch.Tensor):
|
| 64 |
+
x = torch.where(mask, x, mask_value)
|
| 65 |
+
x = torch.nn.functional.softmax(x, dim=-1)
|
| 66 |
+
return x
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class ShellRotaryEmbedding(torch.nn.Module):
|
| 70 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
|
| 71 |
+
super().__init__()
|
| 72 |
+
|
| 73 |
+
self.dim = dim
|
| 74 |
+
self.max_position_embeddings = max_position_embeddings
|
| 75 |
+
self.base = base
|
| 76 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 77 |
+
self.register_buffer("inv_freq", inv_freq)
|
| 78 |
+
|
| 79 |
+
# Build here to make `torch.jit.trace` work.
|
| 80 |
+
self._set_cos_sin_cache(
|
| 81 |
+
seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 85 |
+
self.max_seq_len_cached = seq_len
|
| 86 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 87 |
+
|
| 88 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 89 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 90 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 91 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 92 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 93 |
+
|
| 94 |
+
def forward(self, x, seq_len=None):
|
| 95 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
| 96 |
+
if seq_len > self.max_seq_len_cached:
|
| 97 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
|
| 98 |
+
|
| 99 |
+
return (
|
| 100 |
+
self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
| 101 |
+
self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class ShellLinearScalingRotaryEmbedding(ShellRotaryEmbedding):
|
| 106 |
+
"""ShellRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
|
| 107 |
+
|
| 108 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
| 109 |
+
self.scaling_factor = scaling_factor
|
| 110 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
| 111 |
+
|
| 112 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 113 |
+
self.max_seq_len_cached = seq_len
|
| 114 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 115 |
+
t = t / self.scaling_factor
|
| 116 |
+
|
| 117 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 118 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 119 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 120 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 121 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class ShellDynamicNTKScalingRotaryEmbedding(ShellRotaryEmbedding):
|
| 125 |
+
"""ShellRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
|
| 126 |
+
|
| 127 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
| 128 |
+
self.scaling_factor = scaling_factor
|
| 129 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
| 130 |
+
|
| 131 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 132 |
+
self.max_seq_len_cached = seq_len
|
| 133 |
+
|
| 134 |
+
if seq_len > self.max_position_embeddings:
|
| 135 |
+
base = self.base * (
|
| 136 |
+
(self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
|
| 137 |
+
) ** (self.dim / (self.dim - 2))
|
| 138 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 139 |
+
self.register_buffer("inv_freq", inv_freq)
|
| 140 |
+
|
| 141 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
| 142 |
+
|
| 143 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 144 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 145 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 146 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
| 147 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
| 148 |
+
|
| 149 |
+
def rotate_half(x):
|
| 150 |
+
"""Rotates half the hidden dims of the input."""
|
| 151 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 152 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 153 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
| 157 |
+
# The first two dimensions of cos and sin are always 1, so we can `squeeze` them.
|
| 158 |
+
cos = cos.squeeze(1).squeeze(0) # [seq_len, dim]
|
| 159 |
+
sin = sin.squeeze(1).squeeze(0) # [seq_len, dim]
|
| 160 |
+
cos = cos[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
| 161 |
+
sin = sin[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
| 162 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 163 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 164 |
+
return q_embed, k_embed
|
| 165 |
+
|
| 166 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 167 |
+
"""
|
| 168 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 169 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 170 |
+
"""
|
| 171 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 172 |
+
if n_rep == 1:
|
| 173 |
+
return hidden_states
|
| 174 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 175 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 176 |
+
|
| 177 |
+
class ShellAttention(nn.Module):
|
| 178 |
+
def __init__(self, config, layer_idx=None):
|
| 179 |
+
super().__init__()
|
| 180 |
+
self.mask_value = None
|
| 181 |
+
|
| 182 |
+
self.position_embedding_type = config.position_embedding_type
|
| 183 |
+
self.rope_scaling = config.rope_scaling
|
| 184 |
+
self.max_position_embeddings = config.max_position_embeddings
|
| 185 |
+
|
| 186 |
+
self.group_query_attention = config.group_query_attention
|
| 187 |
+
self.num_query_groups = config.num_query_groups
|
| 188 |
+
|
| 189 |
+
self.embed_dim = config.hidden_size
|
| 190 |
+
self.num_heads = config.num_attention_heads
|
| 191 |
+
self.head_dim = self.embed_dim // self.num_heads
|
| 192 |
+
self.kv_heads = config.num_query_groups if self.group_query_attention else self.num_heads
|
| 193 |
+
self.kv_dim = self.kv_heads * self.head_dim
|
| 194 |
+
self.split_size = self.embed_dim
|
| 195 |
+
if self.head_dim * self.num_heads != self.embed_dim:
|
| 196 |
+
raise ValueError(
|
| 197 |
+
f"`embed_dim` must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`:"
|
| 198 |
+
f" {self.num_heads})."
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
self.layer_idx = layer_idx
|
| 202 |
+
|
| 203 |
+
self.c_attn = nn.Linear(self.embed_dim, self.embed_dim + 2 * self.kv_dim)
|
| 204 |
+
self.c_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 205 |
+
|
| 206 |
+
self.attn_dropout = nn.Dropout(config.attn_pdrop)
|
| 207 |
+
self.resid_dropout = nn.Dropout(config.resid_pdrop)
|
| 208 |
+
|
| 209 |
+
if self.position_embedding_type == "rope":
|
| 210 |
+
self._init_rope()
|
| 211 |
+
|
| 212 |
+
def _init_rope(self):
|
| 213 |
+
if self.rope_scaling is None:
|
| 214 |
+
self.rotary_emb = ShellRotaryEmbedding(self.head_dim, max_position_embeddings=self.max_position_embeddings)
|
| 215 |
+
else:
|
| 216 |
+
scaling_type = self.rope_scaling["type"]
|
| 217 |
+
scaling_factor = self.rope_scaling["factor"]
|
| 218 |
+
if scaling_type == "linear":
|
| 219 |
+
self.rotary_emb = ShellLinearScalingRotaryEmbedding(
|
| 220 |
+
self.head_dim, max_position_embeddings=self.max_position_embeddings, scaling_factor=scaling_factor
|
| 221 |
+
)
|
| 222 |
+
elif scaling_type == "dynamic":
|
| 223 |
+
self.rotary_emb = ShellDynamicNTKScalingRotaryEmbedding(
|
| 224 |
+
self.head_dim, max_position_embeddings=self.max_position_embeddings, scaling_factor=scaling_factor
|
| 225 |
+
)
|
| 226 |
+
else:
|
| 227 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def _get_mask_value(self, device, dtype):
|
| 231 |
+
# torch.where expects a tensor. We use a cache to avoid recreating it every time.
|
| 232 |
+
if self.mask_value is None or self.mask_value.dtype != dtype or self.mask_value.device != device:
|
| 233 |
+
self.mask_value = torch.full([], torch.finfo(dtype).min, dtype=dtype, device=device)
|
| 234 |
+
return self.mask_value
|
| 235 |
+
|
| 236 |
+
def forward(
|
| 237 |
+
self,
|
| 238 |
+
hidden_states: torch.Tensor,
|
| 239 |
+
layer_past: Optional[torch.Tensor] = None,
|
| 240 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 241 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 242 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 243 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 244 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 245 |
+
use_cache: Optional[bool] = False,
|
| 246 |
+
output_attentions: Optional[bool] = False,
|
| 247 |
+
) -> Union[
|
| 248 |
+
Tuple[torch.Tensor, Optional[torch.Tensor]],
|
| 249 |
+
Tuple[torch.Tensor, Optional[torch.Tensor], Tuple[torch.Tensor, ...]],
|
| 250 |
+
]:
|
| 251 |
+
bsz, q_len, _ = hidden_states.size()
|
| 252 |
+
query_states, key_states, value_states = self.c_attn(hidden_states).split((self.embed_dim, self.kv_dim, self.kv_dim), dim=2)
|
| 253 |
+
|
| 254 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 255 |
+
key_states = key_states.view(bsz, q_len, self.num_query_groups, self.head_dim).transpose(1, 2)
|
| 256 |
+
value_states = value_states.view(bsz, q_len, self.num_query_groups, self.head_dim).transpose(1, 2)
|
| 257 |
+
|
| 258 |
+
kv_seq_len = key_states.shape[-2]
|
| 259 |
+
if past_key_value is not None:
|
| 260 |
+
kv_seq_len += past_key_value[0].shape[-2]
|
| 261 |
+
cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
| 262 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
| 263 |
+
|
| 264 |
+
if past_key_value is not None:
|
| 265 |
+
# reuse k, v, self_attention
|
| 266 |
+
key_states = torch.cat([past_key_value[0], key_states], dim=2)
|
| 267 |
+
value_states = torch.cat([past_key_value[1], value_states], dim=2)
|
| 268 |
+
|
| 269 |
+
past_key_value = (key_states, value_states) if use_cache else None
|
| 270 |
+
|
| 271 |
+
# repeat k/v heads if n_kv_heads < n_heads
|
| 272 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
| 273 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
| 274 |
+
|
| 275 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
|
| 276 |
+
|
| 277 |
+
if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
|
| 278 |
+
raise ValueError(
|
| 279 |
+
f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
|
| 280 |
+
f" {attn_weights.size()}"
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
if attention_mask is not None:
|
| 284 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
| 285 |
+
raise ValueError(
|
| 286 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
| 287 |
+
)
|
| 288 |
+
attn_weights = attn_weights + attention_mask
|
| 289 |
+
|
| 290 |
+
# upcast attention to fp32
|
| 291 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
|
| 292 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 293 |
+
|
| 294 |
+
if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
|
| 295 |
+
raise ValueError(
|
| 296 |
+
f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
|
| 297 |
+
f" {attn_output.size()}"
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 301 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
|
| 302 |
+
|
| 303 |
+
attn_output = self.o_proj(attn_output)
|
| 304 |
+
|
| 305 |
+
outputs = (attn_output, past_key_value)
|
| 306 |
+
if output_attentions:
|
| 307 |
+
outputs += (attn_weights,)
|
| 308 |
+
|
| 309 |
+
return outputs # a, present, (attentions)
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
class ShellMLP(nn.Module):
|
| 313 |
+
def __init__(self, intermediate_size, config):
|
| 314 |
+
super().__init__()
|
| 315 |
+
embed_dim = config.hidden_size
|
| 316 |
+
self.c_fc = nn.Linear(embed_dim, intermediate_size)
|
| 317 |
+
self.c_proj = nn.Linear(intermediate_size, embed_dim)
|
| 318 |
+
self.act = ACT2FN[config.activation_function]
|
| 319 |
+
self.dropout = nn.Dropout(config.resid_pdrop)
|
| 320 |
+
|
| 321 |
+
# Copied from transformers.models.gpt2.modeling_gpt2.GPT2MLP.forward
|
| 322 |
+
def forward(self, hidden_states: Optional[Tuple[torch.Tensor]]) -> torch.Tensor:
|
| 323 |
+
hidden_states = self.c_fc(hidden_states)
|
| 324 |
+
hidden_states = self.act(hidden_states)
|
| 325 |
+
hidden_states = self.c_proj(hidden_states)
|
| 326 |
+
hidden_states = self.dropout(hidden_states)
|
| 327 |
+
return hidden_states
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
class ShellBlock(nn.Module):
|
| 331 |
+
def __init__(self, config, layer_idx=None):
|
| 332 |
+
super().__init__()
|
| 333 |
+
hidden_size = config.hidden_size
|
| 334 |
+
self.inner_dim = config.n_inner if config.n_inner is not None else 4 * hidden_size
|
| 335 |
+
|
| 336 |
+
self.ln_1 = nn.LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
|
| 337 |
+
self.attn = ShellAttention(config, layer_idx=layer_idx)
|
| 338 |
+
self.ln_2 = nn.LayerNorm(hidden_size, eps=config.layer_norm_epsilon)
|
| 339 |
+
|
| 340 |
+
self.mlp = ShellMLP(self.inner_dim, config)
|
| 341 |
+
|
| 342 |
+
def forward(
|
| 343 |
+
self,
|
| 344 |
+
hidden_states: Optional[Tuple[torch.Tensor]],
|
| 345 |
+
layer_past: Optional[torch.Tensor] = None,
|
| 346 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 347 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 348 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 349 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 350 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 351 |
+
use_cache: Optional[bool] = False,
|
| 352 |
+
output_attentions: Optional[bool] = False,
|
| 353 |
+
) -> Union[
|
| 354 |
+
Tuple[torch.Tensor], Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor, torch.Tensor]
|
| 355 |
+
]:
|
| 356 |
+
residual = hidden_states
|
| 357 |
+
hidden_states = self.ln_1(hidden_states)
|
| 358 |
+
attn_outputs = self.attn(
|
| 359 |
+
hidden_states,
|
| 360 |
+
layer_past=layer_past,
|
| 361 |
+
attention_mask=attention_mask,
|
| 362 |
+
position_ids=position_ids,
|
| 363 |
+
head_mask=head_mask,
|
| 364 |
+
use_cache=use_cache,
|
| 365 |
+
output_attentions=output_attentions,
|
| 366 |
+
)
|
| 367 |
+
attn_output = attn_outputs[0] # output_attn: a, present, (attentions)
|
| 368 |
+
|
| 369 |
+
outputs = attn_outputs[1:]
|
| 370 |
+
# residual connection
|
| 371 |
+
hidden_states = attn_output + residual
|
| 372 |
+
|
| 373 |
+
residual = hidden_states
|
| 374 |
+
hidden_states = self.ln_2(hidden_states)
|
| 375 |
+
feed_forward_hidden_states = self.mlp(hidden_states)
|
| 376 |
+
# residual connection
|
| 377 |
+
hidden_states = residual + feed_forward_hidden_states
|
| 378 |
+
|
| 379 |
+
if use_cache:
|
| 380 |
+
outputs = (hidden_states,) + outputs
|
| 381 |
+
else:
|
| 382 |
+
outputs = (hidden_states,) + outputs[1:]
|
| 383 |
+
|
| 384 |
+
return outputs # hidden_states, present, (attentions, cross_attentions)
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
class ShellPreTrainedModel(PreTrainedModel):
|
| 388 |
+
"""
|
| 389 |
+
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
|
| 390 |
+
models.
|
| 391 |
+
"""
|
| 392 |
+
|
| 393 |
+
config_class = ShellConfig
|
| 394 |
+
base_model_prefix = "transformer"
|
| 395 |
+
supports_gradient_checkpointing = True
|
| 396 |
+
_no_split_modules = ["ShellBlock"]
|
| 397 |
+
_skip_keys_device_placement = "past_key_values"
|
| 398 |
+
|
| 399 |
+
def __init__(self, *inputs, **kwargs):
|
| 400 |
+
super().__init__(*inputs, **kwargs)
|
| 401 |
+
|
| 402 |
+
def _init_weights(self, module):
|
| 403 |
+
"""Initialize the weights."""
|
| 404 |
+
if isinstance(module, (ShellMLP, ShellAttention)):
|
| 405 |
+
# Reinitialize selected weights subject to the OpenAI GPT-2 Paper Scheme:
|
| 406 |
+
# > A modified initialization which accounts for the accumulation on the residual path with model depth. Scale
|
| 407 |
+
# > the weights of residual layers at initialization by a factor of 1/√N where N is the # of residual layers.
|
| 408 |
+
# > -- GPT-2 :: https://openai.com/blog/better-language-models/
|
| 409 |
+
#
|
| 410 |
+
# Reference (Megatron-LM): https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/model/gpt_model.py
|
| 411 |
+
module.c_proj.weight.data.normal_(
|
| 412 |
+
mean=0.0, std=(self.config.initializer_range / math.sqrt(2 * self.config.n_layer))
|
| 413 |
+
)
|
| 414 |
+
module.c_proj._is_hf_initialized = True
|
| 415 |
+
elif isinstance(module, nn.Linear):
|
| 416 |
+
# Slightly different from the TF version which uses truncated_normal for initialization
|
| 417 |
+
# cf https://github.com/pytorch/pytorch/pull/5617
|
| 418 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 419 |
+
if module.bias is not None:
|
| 420 |
+
module.bias.data.zero_()
|
| 421 |
+
elif isinstance(module, nn.Embedding):
|
| 422 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 423 |
+
if module.padding_idx is not None:
|
| 424 |
+
module.weight.data[module.padding_idx].zero_()
|
| 425 |
+
elif isinstance(module, nn.LayerNorm):
|
| 426 |
+
module.bias.data.zero_()
|
| 427 |
+
module.weight.data.fill_(1.0)
|
| 428 |
+
|
| 429 |
+
# Copied from transformers.models.gpt2.modeling_gpt2.GPT2PreTrainedModel._set_gradient_checkpointing with GPT2->Shell
|
| 430 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
| 431 |
+
if isinstance(module, ShellModel):
|
| 432 |
+
module.gradient_checkpointing = value
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
GPT_BIGCODE_START_DOCSTRING = r"""
|
| 436 |
+
|
| 437 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
| 438 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
| 439 |
+
etc.)
|
| 440 |
+
|
| 441 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
| 442 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
| 443 |
+
and behavior.
|
| 444 |
+
|
| 445 |
+
Parameters:
|
| 446 |
+
config ([`ShellConfig`]): Model configuration class with all the parameters of the model.
|
| 447 |
+
Initializing with a config file does not load the weights associated with the model, only the
|
| 448 |
+
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
| 449 |
+
"""
|
| 450 |
+
|
| 451 |
+
GPT_BIGCODE_INPUTS_DOCSTRING = r"""
|
| 452 |
+
Args:
|
| 453 |
+
input_ids (`torch.Tensor` of shape `(batch_size, input_ids_length)`):
|
| 454 |
+
`input_ids_length` = `sequence_length` if `past_key_values` is `None` else
|
| 455 |
+
`past_key_values[0][0].shape[-2]` (`sequence_length` of input past key value states). Indices of input
|
| 456 |
+
sequence tokens in the vocabulary.
|
| 457 |
+
|
| 458 |
+
If `past_key_values` is used, only `input_ids` that do not have their past calculated should be passed as
|
| 459 |
+
`input_ids`.
|
| 460 |
+
|
| 461 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
| 462 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
| 463 |
+
|
| 464 |
+
[What are input IDs?](../glossary#input-ids)
|
| 465 |
+
past_key_values (`Tuple[torch.Tensor]` of length `config.n_layers`):
|
| 466 |
+
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
|
| 467 |
+
`past_key_values` output below). Can be used to speed up sequential decoding. The `input_ids` which have
|
| 468 |
+
their past given to this model should not be passed as `input_ids` as they have already been computed.
|
| 469 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 470 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
| 471 |
+
|
| 472 |
+
- 1 for tokens that are **not masked**,
|
| 473 |
+
- 0 for tokens that are **masked**.
|
| 474 |
+
|
| 475 |
+
If `past_key_values` is used, `attention_mask` needs to contain the masking strategy that was used for
|
| 476 |
+
`past_key_values`. In other words, the `attention_mask` always has to have the length:
|
| 477 |
+
`len(past_key_values) + len(input_ids)`
|
| 478 |
+
|
| 479 |
+
[What are attention masks?](../glossary#attention-mask)
|
| 480 |
+
token_type_ids (`torch.Tensor` of shape `(batch_size, input_ids_length)`, *optional*):
|
| 481 |
+
Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
|
| 482 |
+
1]`:
|
| 483 |
+
|
| 484 |
+
- 0 corresponds to a *sentence A* token,
|
| 485 |
+
- 1 corresponds to a *sentence B* token.
|
| 486 |
+
|
| 487 |
+
[What are token type IDs?](../glossary#token-type-ids)
|
| 488 |
+
position_ids (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 489 |
+
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
| 490 |
+
config.max_position_embeddings - 1]`.
|
| 491 |
+
|
| 492 |
+
[What are position IDs?](../glossary#position-ids)
|
| 493 |
+
head_mask (`torch.Tensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
|
| 494 |
+
Mask to nullify selected heads of the self-attention modules. Mask values selected in `[0, 1]`:
|
| 495 |
+
|
| 496 |
+
- 1 indicates the head is **not masked**,
|
| 497 |
+
- 0 indicates the head is **masked**.
|
| 498 |
+
|
| 499 |
+
inputs_embeds (`torch.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
| 500 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
|
| 501 |
+
is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
|
| 502 |
+
model's internal embedding lookup matrix.
|
| 503 |
+
|
| 504 |
+
If `past_key_values` is used, optionally only the last `inputs_embeds` have to be input (see
|
| 505 |
+
`past_key_values`).
|
| 506 |
+
use_cache (`bool`, *optional*):
|
| 507 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
| 508 |
+
`past_key_values`).
|
| 509 |
+
output_attentions (`bool`, *optional*):
|
| 510 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
| 511 |
+
tensors for more detail.
|
| 512 |
+
output_hidden_states (`bool`, *optional*):
|
| 513 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
| 514 |
+
more detail.
|
| 515 |
+
return_dict (`bool`, *optional*):
|
| 516 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
| 517 |
+
"""
|
| 518 |
+
|
| 519 |
+
|
| 520 |
+
@add_start_docstrings(
|
| 521 |
+
"The bare GPT_BIGCODE Model transformer outputting raw hidden-states without any specific head on top.",
|
| 522 |
+
GPT_BIGCODE_START_DOCSTRING,
|
| 523 |
+
)
|
| 524 |
+
class ShellModel(ShellPreTrainedModel):
|
| 525 |
+
def __init__(self, config):
|
| 526 |
+
super().__init__(config)
|
| 527 |
+
self.group_query_attention = config.group_query_attention
|
| 528 |
+
self.num_query_groups = config.num_query_groups
|
| 529 |
+
self.position_embedding_type = config.position_embedding_type
|
| 530 |
+
self.embed_dim = config.hidden_size
|
| 531 |
+
|
| 532 |
+
self.wte = nn.Embedding(config.vocab_size, self.embed_dim)
|
| 533 |
+
if self.position_embedding_type == "learned_absolute":
|
| 534 |
+
self.wpe = nn.Embedding(config.max_position_embeddings, self.embed_dim)
|
| 535 |
+
else:
|
| 536 |
+
pass
|
| 537 |
+
|
| 538 |
+
self.drop = nn.Dropout(config.embd_pdrop)
|
| 539 |
+
self.h = nn.ModuleList([ShellBlock(config, layer_idx=i) for i in range(config.num_hidden_layers)])
|
| 540 |
+
self.ln_f = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_epsilon)
|
| 541 |
+
|
| 542 |
+
max_positions = config.max_position_embeddings
|
| 543 |
+
self.register_buffer(
|
| 544 |
+
"bias", torch.tril(torch.ones((max_positions, max_positions), dtype=torch.bool)), persistent=False
|
| 545 |
+
)
|
| 546 |
+
|
| 547 |
+
self.gradient_checkpointing = False
|
| 548 |
+
|
| 549 |
+
# Initialize weights and apply final processing
|
| 550 |
+
self.post_init()
|
| 551 |
+
|
| 552 |
+
def get_input_embeddings(self):
|
| 553 |
+
return self.wte
|
| 554 |
+
|
| 555 |
+
def set_input_embeddings(self, new_embeddings):
|
| 556 |
+
self.wte = new_embeddings
|
| 557 |
+
|
| 558 |
+
@add_start_docstrings_to_model_forward(GPT_BIGCODE_INPUTS_DOCSTRING)
|
| 559 |
+
def forward(
|
| 560 |
+
self,
|
| 561 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 562 |
+
past_key_values: Optional[List[torch.Tensor]] = None,
|
| 563 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 564 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 565 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 566 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 567 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 568 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 569 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 570 |
+
use_cache: Optional[bool] = None,
|
| 571 |
+
output_attentions: Optional[bool] = None,
|
| 572 |
+
output_hidden_states: Optional[bool] = None,
|
| 573 |
+
return_dict: Optional[bool] = None,
|
| 574 |
+
) -> Union[Tuple, BaseModelOutputWithPastAndCrossAttentions]:
|
| 575 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 576 |
+
output_hidden_states = (
|
| 577 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 578 |
+
)
|
| 579 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 580 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 581 |
+
|
| 582 |
+
if input_ids is not None and inputs_embeds is not None:
|
| 583 |
+
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
|
| 584 |
+
elif input_ids is not None:
|
| 585 |
+
input_shape = input_ids.size()
|
| 586 |
+
input_ids = input_ids.reshape(-1, input_shape[-1])
|
| 587 |
+
batch_size = input_ids.shape[0]
|
| 588 |
+
elif inputs_embeds is not None:
|
| 589 |
+
input_shape = inputs_embeds.size()[:-1]
|
| 590 |
+
batch_size = inputs_embeds.shape[0]
|
| 591 |
+
else:
|
| 592 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
| 593 |
+
|
| 594 |
+
if batch_size <= 0:
|
| 595 |
+
raise ValueError("batch_size has to be defined and > 0")
|
| 596 |
+
|
| 597 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
| 598 |
+
|
| 599 |
+
if token_type_ids is not None:
|
| 600 |
+
token_type_ids = token_type_ids.reshape(-1, input_shape[-1])
|
| 601 |
+
if position_ids is not None:
|
| 602 |
+
position_ids = position_ids.reshape(-1, input_shape[-1])
|
| 603 |
+
|
| 604 |
+
if past_key_values is None:
|
| 605 |
+
past_length = 0
|
| 606 |
+
past_key_values = tuple([None] * len(self.h))
|
| 607 |
+
else:
|
| 608 |
+
past_length = past_key_values[0][0].size(-3)
|
| 609 |
+
|
| 610 |
+
if attention_mask is not None and len(attention_mask.shape) == 2 and position_ids is None:
|
| 611 |
+
# create position_ids on the fly for batch generation
|
| 612 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 613 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 614 |
+
if past_length > 0:
|
| 615 |
+
position_ids = position_ids[:, past_length : input_shape[-1] + past_length :]
|
| 616 |
+
elif position_ids is None:
|
| 617 |
+
position_ids = torch.arange(past_length, input_shape[-1] + past_length, dtype=torch.long, device=device)
|
| 618 |
+
position_ids = position_ids.unsqueeze(0).reshape(-1, input_shape[-1])
|
| 619 |
+
|
| 620 |
+
# Self-attention mask.
|
| 621 |
+
query_length = input_shape[-1]
|
| 622 |
+
key_length = past_length + query_length
|
| 623 |
+
self_attention_mask = self.bias[None, key_length - query_length : key_length, :key_length]
|
| 624 |
+
|
| 625 |
+
if attention_mask is not None:
|
| 626 |
+
self_attention_mask = self_attention_mask * attention_mask.reshape(batch_size, 1, -1).to(
|
| 627 |
+
dtype=torch.bool, device=self_attention_mask.device
|
| 628 |
+
)
|
| 629 |
+
|
| 630 |
+
# MQA models: (batch_size, query_length, n_heads, key_length)
|
| 631 |
+
# MHA models: (batch_size, n_heads, query_length, key_length)
|
| 632 |
+
attention_mask = self_attention_mask.unsqueeze(1)
|
| 633 |
+
|
| 634 |
+
encoder_attention_mask = None
|
| 635 |
+
|
| 636 |
+
# Prepare head mask if needed
|
| 637 |
+
# 1.0 in head_mask indicate we keep the head
|
| 638 |
+
# attention_probs has shape bsz x n_heads x N x N
|
| 639 |
+
# head_mask has shape n_layer x batch x n_heads x N x N
|
| 640 |
+
head_mask = self.get_head_mask(head_mask, self.config.n_layer)
|
| 641 |
+
|
| 642 |
+
if inputs_embeds is None:
|
| 643 |
+
inputs_embeds = self.wte(input_ids)
|
| 644 |
+
|
| 645 |
+
hidden_states = inputs_embeds
|
| 646 |
+
if self.position_embedding_type == "learned_absolute":
|
| 647 |
+
position_embeds = self.wpe(position_ids)
|
| 648 |
+
hidden_states = hidden_states + position_embeds
|
| 649 |
+
|
| 650 |
+
if token_type_ids is not None:
|
| 651 |
+
token_type_embeds = self.wte(token_type_ids)
|
| 652 |
+
hidden_states = hidden_states + token_type_embeds
|
| 653 |
+
|
| 654 |
+
hidden_states = self.drop(hidden_states)
|
| 655 |
+
|
| 656 |
+
output_shape = input_shape + (hidden_states.size(-1),)
|
| 657 |
+
|
| 658 |
+
presents = [] if use_cache else None
|
| 659 |
+
all_self_attentions = () if output_attentions else None
|
| 660 |
+
all_hidden_states = () if output_hidden_states else None
|
| 661 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
| 662 |
+
if output_hidden_states:
|
| 663 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 664 |
+
|
| 665 |
+
if self.gradient_checkpointing and self.training:
|
| 666 |
+
|
| 667 |
+
def create_custom_forward(module):
|
| 668 |
+
def custom_forward(*inputs):
|
| 669 |
+
# None for past_key_value
|
| 670 |
+
return module(*inputs, use_cache, output_attentions)
|
| 671 |
+
|
| 672 |
+
return custom_forward
|
| 673 |
+
|
| 674 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
| 675 |
+
create_custom_forward(block),
|
| 676 |
+
hidden_states,
|
| 677 |
+
None,
|
| 678 |
+
attention_mask,
|
| 679 |
+
position_ids,
|
| 680 |
+
head_mask[i],
|
| 681 |
+
encoder_hidden_states,
|
| 682 |
+
encoder_attention_mask,
|
| 683 |
+
)
|
| 684 |
+
else:
|
| 685 |
+
outputs = block(
|
| 686 |
+
hidden_states,
|
| 687 |
+
layer_past=layer_past,
|
| 688 |
+
attention_mask=attention_mask,
|
| 689 |
+
position_ids=position_ids,
|
| 690 |
+
head_mask=head_mask[i],
|
| 691 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 692 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 693 |
+
use_cache=use_cache,
|
| 694 |
+
output_attentions=output_attentions,
|
| 695 |
+
)
|
| 696 |
+
|
| 697 |
+
hidden_states = outputs[0]
|
| 698 |
+
if use_cache:
|
| 699 |
+
presents.append(outputs[1])
|
| 700 |
+
|
| 701 |
+
if output_attentions:
|
| 702 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
| 703 |
+
|
| 704 |
+
hidden_states = self.ln_f(hidden_states)
|
| 705 |
+
hidden_states = hidden_states.reshape(output_shape)
|
| 706 |
+
# Add last hidden state
|
| 707 |
+
if output_hidden_states:
|
| 708 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 709 |
+
|
| 710 |
+
|
| 711 |
+
if not return_dict:
|
| 712 |
+
return tuple(
|
| 713 |
+
v
|
| 714 |
+
for v in [hidden_states, presents, all_hidden_states, all_self_attentions]
|
| 715 |
+
if v is not None
|
| 716 |
+
)
|
| 717 |
+
|
| 718 |
+
return BaseModelOutputWithPastAndCrossAttentions(
|
| 719 |
+
last_hidden_state=hidden_states,
|
| 720 |
+
past_key_values=presents,
|
| 721 |
+
hidden_states=all_hidden_states,
|
| 722 |
+
attentions=all_self_attentions,
|
| 723 |
+
)
|
| 724 |
+
|
| 725 |
+
|
| 726 |
+
@add_start_docstrings(
|
| 727 |
+
"""
|
| 728 |
+
The GPT_BIGCODE Model transformer with a language modeling head on top (linear layer with weights tied to the input
|
| 729 |
+
embeddings).
|
| 730 |
+
""",
|
| 731 |
+
GPT_BIGCODE_START_DOCSTRING,
|
| 732 |
+
)
|
| 733 |
+
class ShellForCausalLM(ShellPreTrainedModel):
|
| 734 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 735 |
+
|
| 736 |
+
def __init__(self, config):
|
| 737 |
+
super().__init__(config)
|
| 738 |
+
self.transformer = ShellModel(config)
|
| 739 |
+
self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False)
|
| 740 |
+
|
| 741 |
+
# Initialize weights and apply final processing
|
| 742 |
+
self.post_init()
|
| 743 |
+
|
| 744 |
+
def get_output_embeddings(self):
|
| 745 |
+
return self.lm_head
|
| 746 |
+
|
| 747 |
+
def set_output_embeddings(self, new_embeddings):
|
| 748 |
+
self.lm_head = new_embeddings
|
| 749 |
+
|
| 750 |
+
def prepare_inputs_for_generation(self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs):
|
| 751 |
+
token_type_ids = kwargs.get("token_type_ids", None)
|
| 752 |
+
# only last token for inputs_ids if past is defined in kwargs
|
| 753 |
+
if past_key_values:
|
| 754 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
| 755 |
+
if token_type_ids is not None:
|
| 756 |
+
token_type_ids = token_type_ids[:, -1].unsqueeze(-1)
|
| 757 |
+
|
| 758 |
+
attention_mask = kwargs.get("attention_mask", None)
|
| 759 |
+
position_ids = kwargs.get("position_ids", None)
|
| 760 |
+
|
| 761 |
+
if attention_mask is not None and position_ids is None:
|
| 762 |
+
# create position_ids on the fly for batch generation
|
| 763 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 764 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 765 |
+
if past_key_values:
|
| 766 |
+
position_ids = position_ids[:, -1].unsqueeze(-1)
|
| 767 |
+
else:
|
| 768 |
+
position_ids = None
|
| 769 |
+
|
| 770 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
| 771 |
+
if inputs_embeds is not None and past_key_values is None:
|
| 772 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
| 773 |
+
else:
|
| 774 |
+
model_inputs = {"input_ids": input_ids}
|
| 775 |
+
|
| 776 |
+
model_inputs.update(
|
| 777 |
+
{
|
| 778 |
+
"past_key_values": past_key_values,
|
| 779 |
+
"use_cache": kwargs.get("use_cache"),
|
| 780 |
+
"position_ids": position_ids,
|
| 781 |
+
"attention_mask": attention_mask,
|
| 782 |
+
"token_type_ids": token_type_ids,
|
| 783 |
+
}
|
| 784 |
+
)
|
| 785 |
+
return model_inputs
|
| 786 |
+
|
| 787 |
+
@add_start_docstrings_to_model_forward(GPT_BIGCODE_INPUTS_DOCSTRING)
|
| 788 |
+
def forward(
|
| 789 |
+
self,
|
| 790 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 791 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
| 792 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 793 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 794 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 795 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 796 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 797 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
| 798 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
| 799 |
+
labels: Optional[torch.Tensor] = None,
|
| 800 |
+
use_cache: Optional[bool] = None,
|
| 801 |
+
output_attentions: Optional[bool] = None,
|
| 802 |
+
output_hidden_states: Optional[bool] = None,
|
| 803 |
+
return_dict: Optional[bool] = None,
|
| 804 |
+
) -> Union[Tuple, CausalLMOutputWithCrossAttentions]:
|
| 805 |
+
r"""
|
| 806 |
+
labels (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 807 |
+
Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
|
| 808 |
+
`labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size]` All labels set to `-100`
|
| 809 |
+
are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size]`
|
| 810 |
+
"""
|
| 811 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 812 |
+
|
| 813 |
+
transformer_outputs = self.transformer(
|
| 814 |
+
input_ids,
|
| 815 |
+
past_key_values=past_key_values,
|
| 816 |
+
attention_mask=attention_mask,
|
| 817 |
+
token_type_ids=token_type_ids,
|
| 818 |
+
position_ids=position_ids,
|
| 819 |
+
head_mask=head_mask,
|
| 820 |
+
inputs_embeds=inputs_embeds,
|
| 821 |
+
encoder_hidden_states=encoder_hidden_states,
|
| 822 |
+
encoder_attention_mask=encoder_attention_mask,
|
| 823 |
+
use_cache=use_cache,
|
| 824 |
+
output_attentions=output_attentions,
|
| 825 |
+
output_hidden_states=output_hidden_states,
|
| 826 |
+
return_dict=return_dict,
|
| 827 |
+
)
|
| 828 |
+
hidden_states = transformer_outputs[0]
|
| 829 |
+
lm_logits = self.lm_head(hidden_states)
|
| 830 |
+
loss = None
|
| 831 |
+
if labels is not None:
|
| 832 |
+
# Shift so that tokens < n predict n
|
| 833 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
| 834 |
+
shift_labels = labels[..., 1:].contiguous().to(shift_logits.device)
|
| 835 |
+
# Flatten the tokens
|
| 836 |
+
loss_fct = CrossEntropyLoss()
|
| 837 |
+
loss = loss_fct(shift_logits.reshape(-1, shift_logits.size(-1)), shift_labels.reshape(-1))
|
| 838 |
+
|
| 839 |
+
if not return_dict:
|
| 840 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
| 841 |
+
return ((loss,) + output) if loss is not None else output
|
| 842 |
+
|
| 843 |
+
return CausalLMOutputWithCrossAttentions(
|
| 844 |
+
loss=loss,
|
| 845 |
+
logits=lm_logits,
|
| 846 |
+
past_key_values=transformer_outputs.past_key_values,
|
| 847 |
+
hidden_states=transformer_outputs.hidden_states,
|
| 848 |
+
attentions=transformer_outputs.attentions,
|
| 849 |
+
)
|
| 850 |
+
|
| 851 |
+
@staticmethod
|
| 852 |
+
def _reorder_cache(past_key_values, beam_idx):
|
| 853 |
+
reordered_past = ()
|
| 854 |
+
for layer_past in past_key_values:
|
| 855 |
+
reordered_past += (
|
| 856 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
|
| 857 |
+
)
|
| 858 |
+
return reordered_past
|
pytorch_model.bin.index.json
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 15950722304
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"lm_head.weight": "pytorch_model-00002-of-00002.bin",
|
| 7 |
+
"transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 8 |
+
"transformer.h.0.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 9 |
+
"transformer.h.0.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 10 |
+
"transformer.h.0.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 11 |
+
"transformer.h.0.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 12 |
+
"transformer.h.0.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 13 |
+
"transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 14 |
+
"transformer.h.0.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 15 |
+
"transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 16 |
+
"transformer.h.0.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 17 |
+
"transformer.h.0.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 18 |
+
"transformer.h.0.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 19 |
+
"transformer.h.0.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 20 |
+
"transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 21 |
+
"transformer.h.1.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 22 |
+
"transformer.h.1.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 23 |
+
"transformer.h.1.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 24 |
+
"transformer.h.1.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 25 |
+
"transformer.h.1.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 26 |
+
"transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 27 |
+
"transformer.h.1.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 28 |
+
"transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 29 |
+
"transformer.h.1.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 30 |
+
"transformer.h.1.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 31 |
+
"transformer.h.1.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 32 |
+
"transformer.h.1.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 33 |
+
"transformer.h.10.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 34 |
+
"transformer.h.10.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 35 |
+
"transformer.h.10.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 36 |
+
"transformer.h.10.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 37 |
+
"transformer.h.10.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 38 |
+
"transformer.h.10.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 39 |
+
"transformer.h.10.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 40 |
+
"transformer.h.10.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 41 |
+
"transformer.h.10.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 42 |
+
"transformer.h.10.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 43 |
+
"transformer.h.10.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 44 |
+
"transformer.h.10.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 45 |
+
"transformer.h.10.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 46 |
+
"transformer.h.11.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 47 |
+
"transformer.h.11.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 48 |
+
"transformer.h.11.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 49 |
+
"transformer.h.11.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 50 |
+
"transformer.h.11.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 51 |
+
"transformer.h.11.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 52 |
+
"transformer.h.11.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 53 |
+
"transformer.h.11.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 54 |
+
"transformer.h.11.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 55 |
+
"transformer.h.11.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 56 |
+
"transformer.h.11.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 57 |
+
"transformer.h.11.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 58 |
+
"transformer.h.11.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 59 |
+
"transformer.h.12.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 60 |
+
"transformer.h.12.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 61 |
+
"transformer.h.12.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 62 |
+
"transformer.h.12.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 63 |
+
"transformer.h.12.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 64 |
+
"transformer.h.12.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 65 |
+
"transformer.h.12.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 66 |
+
"transformer.h.12.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 67 |
+
"transformer.h.12.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 68 |
+
"transformer.h.12.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 69 |
+
"transformer.h.12.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 70 |
+
"transformer.h.12.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 71 |
+
"transformer.h.12.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 72 |
+
"transformer.h.13.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 73 |
+
"transformer.h.13.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 74 |
+
"transformer.h.13.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 75 |
+
"transformer.h.13.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 76 |
+
"transformer.h.13.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 77 |
+
"transformer.h.13.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 78 |
+
"transformer.h.13.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 79 |
+
"transformer.h.13.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 80 |
+
"transformer.h.13.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 81 |
+
"transformer.h.13.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 82 |
+
"transformer.h.13.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 83 |
+
"transformer.h.13.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 84 |
+
"transformer.h.13.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 85 |
+
"transformer.h.14.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 86 |
+
"transformer.h.14.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 87 |
+
"transformer.h.14.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 88 |
+
"transformer.h.14.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 89 |
+
"transformer.h.14.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 90 |
+
"transformer.h.14.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 91 |
+
"transformer.h.14.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 92 |
+
"transformer.h.14.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 93 |
+
"transformer.h.14.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 94 |
+
"transformer.h.14.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 95 |
+
"transformer.h.14.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 96 |
+
"transformer.h.14.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 97 |
+
"transformer.h.14.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 98 |
+
"transformer.h.15.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 99 |
+
"transformer.h.15.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 100 |
+
"transformer.h.15.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 101 |
+
"transformer.h.15.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 102 |
+
"transformer.h.15.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 103 |
+
"transformer.h.15.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 104 |
+
"transformer.h.15.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 105 |
+
"transformer.h.15.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 106 |
+
"transformer.h.15.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 107 |
+
"transformer.h.15.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 108 |
+
"transformer.h.15.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 109 |
+
"transformer.h.15.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 110 |
+
"transformer.h.15.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 111 |
+
"transformer.h.16.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 112 |
+
"transformer.h.16.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 113 |
+
"transformer.h.16.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 114 |
+
"transformer.h.16.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 115 |
+
"transformer.h.16.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 116 |
+
"transformer.h.16.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 117 |
+
"transformer.h.16.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 118 |
+
"transformer.h.16.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 119 |
+
"transformer.h.16.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 120 |
+
"transformer.h.16.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 121 |
+
"transformer.h.16.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 122 |
+
"transformer.h.16.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 123 |
+
"transformer.h.16.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 124 |
+
"transformer.h.17.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 125 |
+
"transformer.h.17.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 126 |
+
"transformer.h.17.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 127 |
+
"transformer.h.17.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 128 |
+
"transformer.h.17.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 129 |
+
"transformer.h.17.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 130 |
+
"transformer.h.17.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 131 |
+
"transformer.h.17.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 132 |
+
"transformer.h.17.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 133 |
+
"transformer.h.17.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 134 |
+
"transformer.h.17.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 135 |
+
"transformer.h.17.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 136 |
+
"transformer.h.17.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 137 |
+
"transformer.h.18.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 138 |
+
"transformer.h.18.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 139 |
+
"transformer.h.18.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 140 |
+
"transformer.h.18.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 141 |
+
"transformer.h.18.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 142 |
+
"transformer.h.18.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 143 |
+
"transformer.h.18.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 144 |
+
"transformer.h.18.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 145 |
+
"transformer.h.18.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 146 |
+
"transformer.h.18.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 147 |
+
"transformer.h.18.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 148 |
+
"transformer.h.18.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 149 |
+
"transformer.h.18.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 150 |
+
"transformer.h.19.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 151 |
+
"transformer.h.19.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 152 |
+
"transformer.h.19.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 153 |
+
"transformer.h.19.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 154 |
+
"transformer.h.19.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 155 |
+
"transformer.h.19.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 156 |
+
"transformer.h.19.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 157 |
+
"transformer.h.19.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 158 |
+
"transformer.h.19.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 159 |
+
"transformer.h.19.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 160 |
+
"transformer.h.19.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 161 |
+
"transformer.h.19.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 162 |
+
"transformer.h.19.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 163 |
+
"transformer.h.2.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 164 |
+
"transformer.h.2.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 165 |
+
"transformer.h.2.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 166 |
+
"transformer.h.2.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 167 |
+
"transformer.h.2.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 168 |
+
"transformer.h.2.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 169 |
+
"transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 170 |
+
"transformer.h.2.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 171 |
+
"transformer.h.2.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 172 |
+
"transformer.h.2.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 173 |
+
"transformer.h.2.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 174 |
+
"transformer.h.2.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 175 |
+
"transformer.h.2.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 176 |
+
"transformer.h.20.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 177 |
+
"transformer.h.20.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 178 |
+
"transformer.h.20.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 179 |
+
"transformer.h.20.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 180 |
+
"transformer.h.20.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 181 |
+
"transformer.h.20.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 182 |
+
"transformer.h.20.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 183 |
+
"transformer.h.20.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 184 |
+
"transformer.h.20.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 185 |
+
"transformer.h.20.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 186 |
+
"transformer.h.20.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 187 |
+
"transformer.h.20.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 188 |
+
"transformer.h.20.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 189 |
+
"transformer.h.21.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 190 |
+
"transformer.h.21.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 191 |
+
"transformer.h.21.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 192 |
+
"transformer.h.21.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 193 |
+
"transformer.h.21.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 194 |
+
"transformer.h.21.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 195 |
+
"transformer.h.21.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 196 |
+
"transformer.h.21.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 197 |
+
"transformer.h.21.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 198 |
+
"transformer.h.21.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 199 |
+
"transformer.h.21.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 200 |
+
"transformer.h.21.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 201 |
+
"transformer.h.21.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 202 |
+
"transformer.h.22.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 203 |
+
"transformer.h.22.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 204 |
+
"transformer.h.22.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 205 |
+
"transformer.h.22.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 206 |
+
"transformer.h.22.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 207 |
+
"transformer.h.22.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 208 |
+
"transformer.h.22.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 209 |
+
"transformer.h.22.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 210 |
+
"transformer.h.22.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 211 |
+
"transformer.h.22.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 212 |
+
"transformer.h.22.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 213 |
+
"transformer.h.22.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 214 |
+
"transformer.h.22.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 215 |
+
"transformer.h.23.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 216 |
+
"transformer.h.23.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 217 |
+
"transformer.h.23.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 218 |
+
"transformer.h.23.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 219 |
+
"transformer.h.23.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 220 |
+
"transformer.h.23.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 221 |
+
"transformer.h.23.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 222 |
+
"transformer.h.23.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 223 |
+
"transformer.h.23.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 224 |
+
"transformer.h.23.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 225 |
+
"transformer.h.23.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 226 |
+
"transformer.h.23.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 227 |
+
"transformer.h.23.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 228 |
+
"transformer.h.24.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 229 |
+
"transformer.h.24.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 230 |
+
"transformer.h.24.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 231 |
+
"transformer.h.24.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 232 |
+
"transformer.h.24.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 233 |
+
"transformer.h.24.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 234 |
+
"transformer.h.24.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 235 |
+
"transformer.h.24.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 236 |
+
"transformer.h.24.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 237 |
+
"transformer.h.24.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 238 |
+
"transformer.h.24.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 239 |
+
"transformer.h.24.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 240 |
+
"transformer.h.24.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 241 |
+
"transformer.h.25.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 242 |
+
"transformer.h.25.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 243 |
+
"transformer.h.25.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 244 |
+
"transformer.h.25.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 245 |
+
"transformer.h.25.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 246 |
+
"transformer.h.25.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 247 |
+
"transformer.h.25.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 248 |
+
"transformer.h.25.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 249 |
+
"transformer.h.25.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 250 |
+
"transformer.h.25.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 251 |
+
"transformer.h.25.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 252 |
+
"transformer.h.25.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 253 |
+
"transformer.h.25.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 254 |
+
"transformer.h.26.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 255 |
+
"transformer.h.26.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 256 |
+
"transformer.h.26.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 257 |
+
"transformer.h.26.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 258 |
+
"transformer.h.26.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 259 |
+
"transformer.h.26.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 260 |
+
"transformer.h.26.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 261 |
+
"transformer.h.26.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 262 |
+
"transformer.h.26.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 263 |
+
"transformer.h.26.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 264 |
+
"transformer.h.26.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 265 |
+
"transformer.h.26.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 266 |
+
"transformer.h.26.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 267 |
+
"transformer.h.27.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 268 |
+
"transformer.h.27.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 269 |
+
"transformer.h.27.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 270 |
+
"transformer.h.27.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 271 |
+
"transformer.h.27.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 272 |
+
"transformer.h.27.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 273 |
+
"transformer.h.27.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 274 |
+
"transformer.h.27.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 275 |
+
"transformer.h.27.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 276 |
+
"transformer.h.27.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 277 |
+
"transformer.h.27.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 278 |
+
"transformer.h.27.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 279 |
+
"transformer.h.27.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 280 |
+
"transformer.h.28.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 281 |
+
"transformer.h.28.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 282 |
+
"transformer.h.28.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 283 |
+
"transformer.h.28.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 284 |
+
"transformer.h.28.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 285 |
+
"transformer.h.28.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 286 |
+
"transformer.h.28.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 287 |
+
"transformer.h.28.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 288 |
+
"transformer.h.28.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 289 |
+
"transformer.h.28.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 290 |
+
"transformer.h.28.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 291 |
+
"transformer.h.28.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 292 |
+
"transformer.h.28.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 293 |
+
"transformer.h.29.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 294 |
+
"transformer.h.29.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 295 |
+
"transformer.h.29.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 296 |
+
"transformer.h.29.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 297 |
+
"transformer.h.29.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 298 |
+
"transformer.h.29.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 299 |
+
"transformer.h.29.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 300 |
+
"transformer.h.29.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 301 |
+
"transformer.h.29.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 302 |
+
"transformer.h.29.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 303 |
+
"transformer.h.29.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 304 |
+
"transformer.h.29.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 305 |
+
"transformer.h.29.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 306 |
+
"transformer.h.3.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 307 |
+
"transformer.h.3.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 308 |
+
"transformer.h.3.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 309 |
+
"transformer.h.3.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 310 |
+
"transformer.h.3.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 311 |
+
"transformer.h.3.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 312 |
+
"transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 313 |
+
"transformer.h.3.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 314 |
+
"transformer.h.3.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 315 |
+
"transformer.h.3.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 316 |
+
"transformer.h.3.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 317 |
+
"transformer.h.3.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 318 |
+
"transformer.h.3.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 319 |
+
"transformer.h.30.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 320 |
+
"transformer.h.30.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 321 |
+
"transformer.h.30.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 322 |
+
"transformer.h.30.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 323 |
+
"transformer.h.30.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 324 |
+
"transformer.h.30.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 325 |
+
"transformer.h.30.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 326 |
+
"transformer.h.30.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 327 |
+
"transformer.h.30.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 328 |
+
"transformer.h.30.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 329 |
+
"transformer.h.30.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 330 |
+
"transformer.h.30.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 331 |
+
"transformer.h.30.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 332 |
+
"transformer.h.31.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 333 |
+
"transformer.h.31.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 334 |
+
"transformer.h.31.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 335 |
+
"transformer.h.31.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 336 |
+
"transformer.h.31.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 337 |
+
"transformer.h.31.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 338 |
+
"transformer.h.31.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 339 |
+
"transformer.h.31.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 340 |
+
"transformer.h.31.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 341 |
+
"transformer.h.31.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 342 |
+
"transformer.h.31.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 343 |
+
"transformer.h.31.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 344 |
+
"transformer.h.31.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 345 |
+
"transformer.h.32.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 346 |
+
"transformer.h.32.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 347 |
+
"transformer.h.32.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 348 |
+
"transformer.h.32.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 349 |
+
"transformer.h.32.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 350 |
+
"transformer.h.32.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 351 |
+
"transformer.h.32.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 352 |
+
"transformer.h.32.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 353 |
+
"transformer.h.32.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 354 |
+
"transformer.h.32.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 355 |
+
"transformer.h.32.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 356 |
+
"transformer.h.32.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 357 |
+
"transformer.h.32.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 358 |
+
"transformer.h.33.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 359 |
+
"transformer.h.33.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 360 |
+
"transformer.h.33.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 361 |
+
"transformer.h.33.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 362 |
+
"transformer.h.33.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 363 |
+
"transformer.h.33.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 364 |
+
"transformer.h.33.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 365 |
+
"transformer.h.33.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 366 |
+
"transformer.h.33.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 367 |
+
"transformer.h.33.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 368 |
+
"transformer.h.33.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 369 |
+
"transformer.h.33.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 370 |
+
"transformer.h.33.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 371 |
+
"transformer.h.34.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 372 |
+
"transformer.h.34.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 373 |
+
"transformer.h.34.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 374 |
+
"transformer.h.34.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 375 |
+
"transformer.h.34.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 376 |
+
"transformer.h.34.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 377 |
+
"transformer.h.34.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 378 |
+
"transformer.h.34.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 379 |
+
"transformer.h.34.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 380 |
+
"transformer.h.34.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 381 |
+
"transformer.h.34.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 382 |
+
"transformer.h.34.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 383 |
+
"transformer.h.34.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 384 |
+
"transformer.h.35.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 385 |
+
"transformer.h.35.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 386 |
+
"transformer.h.35.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 387 |
+
"transformer.h.35.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 388 |
+
"transformer.h.35.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 389 |
+
"transformer.h.35.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 390 |
+
"transformer.h.35.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 391 |
+
"transformer.h.35.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 392 |
+
"transformer.h.35.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 393 |
+
"transformer.h.35.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 394 |
+
"transformer.h.35.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 395 |
+
"transformer.h.35.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 396 |
+
"transformer.h.35.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 397 |
+
"transformer.h.36.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 398 |
+
"transformer.h.36.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 399 |
+
"transformer.h.36.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 400 |
+
"transformer.h.36.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 401 |
+
"transformer.h.36.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 402 |
+
"transformer.h.36.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 403 |
+
"transformer.h.36.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 404 |
+
"transformer.h.36.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 405 |
+
"transformer.h.36.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 406 |
+
"transformer.h.36.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 407 |
+
"transformer.h.36.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 408 |
+
"transformer.h.36.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 409 |
+
"transformer.h.36.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 410 |
+
"transformer.h.37.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 411 |
+
"transformer.h.37.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 412 |
+
"transformer.h.37.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 413 |
+
"transformer.h.37.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 414 |
+
"transformer.h.37.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 415 |
+
"transformer.h.37.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 416 |
+
"transformer.h.37.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 417 |
+
"transformer.h.37.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 418 |
+
"transformer.h.37.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 419 |
+
"transformer.h.37.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 420 |
+
"transformer.h.37.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 421 |
+
"transformer.h.37.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 422 |
+
"transformer.h.37.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 423 |
+
"transformer.h.38.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 424 |
+
"transformer.h.38.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 425 |
+
"transformer.h.38.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 426 |
+
"transformer.h.38.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 427 |
+
"transformer.h.38.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 428 |
+
"transformer.h.38.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 429 |
+
"transformer.h.38.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 430 |
+
"transformer.h.38.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 431 |
+
"transformer.h.38.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 432 |
+
"transformer.h.38.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 433 |
+
"transformer.h.38.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 434 |
+
"transformer.h.38.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 435 |
+
"transformer.h.38.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 436 |
+
"transformer.h.39.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 437 |
+
"transformer.h.39.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 438 |
+
"transformer.h.39.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 439 |
+
"transformer.h.39.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 440 |
+
"transformer.h.39.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 441 |
+
"transformer.h.39.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 442 |
+
"transformer.h.39.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 443 |
+
"transformer.h.39.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 444 |
+
"transformer.h.39.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 445 |
+
"transformer.h.39.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 446 |
+
"transformer.h.39.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 447 |
+
"transformer.h.39.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 448 |
+
"transformer.h.39.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 449 |
+
"transformer.h.4.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 450 |
+
"transformer.h.4.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 451 |
+
"transformer.h.4.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 452 |
+
"transformer.h.4.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 453 |
+
"transformer.h.4.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 454 |
+
"transformer.h.4.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 455 |
+
"transformer.h.4.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 456 |
+
"transformer.h.4.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 457 |
+
"transformer.h.4.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 458 |
+
"transformer.h.4.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 459 |
+
"transformer.h.4.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 460 |
+
"transformer.h.4.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 461 |
+
"transformer.h.4.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 462 |
+
"transformer.h.40.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 463 |
+
"transformer.h.40.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 464 |
+
"transformer.h.40.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 465 |
+
"transformer.h.40.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 466 |
+
"transformer.h.40.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 467 |
+
"transformer.h.40.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 468 |
+
"transformer.h.40.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 469 |
+
"transformer.h.40.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 470 |
+
"transformer.h.40.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 471 |
+
"transformer.h.40.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 472 |
+
"transformer.h.40.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 473 |
+
"transformer.h.40.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 474 |
+
"transformer.h.40.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 475 |
+
"transformer.h.41.attn.c_attn.bias": "pytorch_model-00002-of-00002.bin",
|
| 476 |
+
"transformer.h.41.attn.c_attn.weight": "pytorch_model-00002-of-00002.bin",
|
| 477 |
+
"transformer.h.41.attn.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 478 |
+
"transformer.h.41.attn.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 479 |
+
"transformer.h.41.attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
| 480 |
+
"transformer.h.41.ln_1.bias": "pytorch_model-00002-of-00002.bin",
|
| 481 |
+
"transformer.h.41.ln_1.weight": "pytorch_model-00002-of-00002.bin",
|
| 482 |
+
"transformer.h.41.ln_2.bias": "pytorch_model-00002-of-00002.bin",
|
| 483 |
+
"transformer.h.41.ln_2.weight": "pytorch_model-00002-of-00002.bin",
|
| 484 |
+
"transformer.h.41.mlp.c_fc.bias": "pytorch_model-00002-of-00002.bin",
|
| 485 |
+
"transformer.h.41.mlp.c_fc.weight": "pytorch_model-00002-of-00002.bin",
|
| 486 |
+
"transformer.h.41.mlp.c_proj.bias": "pytorch_model-00002-of-00002.bin",
|
| 487 |
+
"transformer.h.41.mlp.c_proj.weight": "pytorch_model-00002-of-00002.bin",
|
| 488 |
+
"transformer.h.5.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 489 |
+
"transformer.h.5.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 490 |
+
"transformer.h.5.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 491 |
+
"transformer.h.5.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 492 |
+
"transformer.h.5.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 493 |
+
"transformer.h.5.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 494 |
+
"transformer.h.5.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 495 |
+
"transformer.h.5.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 496 |
+
"transformer.h.5.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 497 |
+
"transformer.h.5.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 498 |
+
"transformer.h.5.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 499 |
+
"transformer.h.5.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 500 |
+
"transformer.h.5.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 501 |
+
"transformer.h.6.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 502 |
+
"transformer.h.6.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 503 |
+
"transformer.h.6.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 504 |
+
"transformer.h.6.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 505 |
+
"transformer.h.6.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 506 |
+
"transformer.h.6.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 507 |
+
"transformer.h.6.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 508 |
+
"transformer.h.6.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 509 |
+
"transformer.h.6.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 510 |
+
"transformer.h.6.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 511 |
+
"transformer.h.6.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 512 |
+
"transformer.h.6.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 513 |
+
"transformer.h.6.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 514 |
+
"transformer.h.7.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 515 |
+
"transformer.h.7.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 516 |
+
"transformer.h.7.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 517 |
+
"transformer.h.7.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 518 |
+
"transformer.h.7.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 519 |
+
"transformer.h.7.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 520 |
+
"transformer.h.7.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 521 |
+
"transformer.h.7.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 522 |
+
"transformer.h.7.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 523 |
+
"transformer.h.7.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 524 |
+
"transformer.h.7.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 525 |
+
"transformer.h.7.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 526 |
+
"transformer.h.7.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 527 |
+
"transformer.h.8.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 528 |
+
"transformer.h.8.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 529 |
+
"transformer.h.8.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 530 |
+
"transformer.h.8.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 531 |
+
"transformer.h.8.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 532 |
+
"transformer.h.8.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 533 |
+
"transformer.h.8.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 534 |
+
"transformer.h.8.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 535 |
+
"transformer.h.8.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 536 |
+
"transformer.h.8.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 537 |
+
"transformer.h.8.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 538 |
+
"transformer.h.8.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 539 |
+
"transformer.h.8.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 540 |
+
"transformer.h.9.attn.c_attn.bias": "pytorch_model-00001-of-00002.bin",
|
| 541 |
+
"transformer.h.9.attn.c_attn.weight": "pytorch_model-00001-of-00002.bin",
|
| 542 |
+
"transformer.h.9.attn.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 543 |
+
"transformer.h.9.attn.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 544 |
+
"transformer.h.9.attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
| 545 |
+
"transformer.h.9.ln_1.bias": "pytorch_model-00001-of-00002.bin",
|
| 546 |
+
"transformer.h.9.ln_1.weight": "pytorch_model-00001-of-00002.bin",
|
| 547 |
+
"transformer.h.9.ln_2.bias": "pytorch_model-00001-of-00002.bin",
|
| 548 |
+
"transformer.h.9.ln_2.weight": "pytorch_model-00001-of-00002.bin",
|
| 549 |
+
"transformer.h.9.mlp.c_fc.bias": "pytorch_model-00001-of-00002.bin",
|
| 550 |
+
"transformer.h.9.mlp.c_fc.weight": "pytorch_model-00001-of-00002.bin",
|
| 551 |
+
"transformer.h.9.mlp.c_proj.bias": "pytorch_model-00001-of-00002.bin",
|
| 552 |
+
"transformer.h.9.mlp.c_proj.weight": "pytorch_model-00001-of-00002.bin",
|
| 553 |
+
"transformer.ln_f.bias": "pytorch_model-00002-of-00002.bin",
|
| 554 |
+
"transformer.ln_f.weight": "pytorch_model-00002-of-00002.bin",
|
| 555 |
+
"transformer.wte.weight": "pytorch_model-00001-of-00002.bin"
|
| 556 |
+
}
|
| 557 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|endoftext|>",
|
| 4 |
+
"<fim_prefix>",
|
| 5 |
+
"<fim_middle>",
|
| 6 |
+
"<fim_suffix>",
|
| 7 |
+
"<fim_pad>",
|
| 8 |
+
"<filename>",
|
| 9 |
+
"<gh_stars>",
|
| 10 |
+
"<issue_start>",
|
| 11 |
+
"<issue_comment>",
|
| 12 |
+
"<issue_closed>",
|
| 13 |
+
"<jupyter_start>",
|
| 14 |
+
"<jupyter_text>",
|
| 15 |
+
"<jupyter_code>",
|
| 16 |
+
"<jupyter_output>",
|
| 17 |
+
"<empty_output>",
|
| 18 |
+
"<commit_before>",
|
| 19 |
+
"<commit_msg>",
|
| 20 |
+
"<commit_after>",
|
| 21 |
+
"<reponame>"
|
| 22 |
+
],
|
| 23 |
+
"bos_token": "<|endoftext|>",
|
| 24 |
+
"eos_token": "<|endoftext|>",
|
| 25 |
+
"pad_token": "<|endoftext|>",
|
| 26 |
+
"unk_token": "<|endoftext|>"
|
| 27 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"additional_special_tokens": [
|
| 4 |
+
"<|endoftext|>",
|
| 5 |
+
"<fim_prefix>",
|
| 6 |
+
"<fim_middle>",
|
| 7 |
+
"<fim_suffix>",
|
| 8 |
+
"<fim_pad>",
|
| 9 |
+
"<filename>",
|
| 10 |
+
"<gh_stars>",
|
| 11 |
+
"<issue_start>",
|
| 12 |
+
"<issue_comment>",
|
| 13 |
+
"<issue_closed>",
|
| 14 |
+
"<jupyter_start>",
|
| 15 |
+
"<jupyter_text>",
|
| 16 |
+
"<jupyter_code>",
|
| 17 |
+
"<jupyter_output>",
|
| 18 |
+
"<empty_output>",
|
| 19 |
+
"<commit_before>",
|
| 20 |
+
"<commit_msg>",
|
| 21 |
+
"<commit_after>",
|
| 22 |
+
"<reponame>"
|
| 23 |
+
],
|
| 24 |
+
"bos_token": "<|endoftext|>",
|
| 25 |
+
"clean_up_tokenization_spaces": true,
|
| 26 |
+
"eos_token": "<|endoftext|>",
|
| 27 |
+
"model_max_length": 8192,
|
| 28 |
+
"pad_token": "<|endoftext|>",
|
| 29 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 30 |
+
"unk_token": "<|endoftext|>",
|
| 31 |
+
"vocab_size": 70019
|
| 32 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|