Upload LLaMAForCausalLM
Browse files- config.json +33 -0
- configuration_llama.py +116 -0
- generation_config.json +10 -0
- modeling_llama.py +854 -0
- pytorch_model-00001-of-00002.bin +3 -0
- pytorch_model-00002-of-00002.bin +3 -0
- pytorch_model.bin.index.json +362 -0
config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "results_dump/llama2_chat_7B_seed_42_top_48_heads_alpha_15",
|
3 |
+
"architectures": [
|
4 |
+
"LLaMAForCausalLM"
|
5 |
+
],
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "configuration_llama.LLaMAConfig",
|
8 |
+
"AutoModelForCausalLM": "modeling_llama.LLaMAForCausalLM"
|
9 |
+
},
|
10 |
+
"bos_token_id": 1,
|
11 |
+
"eos_token_id": 2,
|
12 |
+
"hidden_act": "silu",
|
13 |
+
"hidden_size": 4096,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 11008,
|
16 |
+
"max_length": 4096,
|
17 |
+
"max_position_embeddings": 2048,
|
18 |
+
"model_type": "llama",
|
19 |
+
"num_attention_heads": 32,
|
20 |
+
"num_hidden_layers": 32,
|
21 |
+
"num_key_value_heads": 32,
|
22 |
+
"oproj_bias": true,
|
23 |
+
"output_head_hidden_states": false,
|
24 |
+
"pad_token_id": 0,
|
25 |
+
"pretraining_tp": 1,
|
26 |
+
"rms_norm_eps": 1e-05,
|
27 |
+
"rope_scaling": null,
|
28 |
+
"tie_word_embeddings": false,
|
29 |
+
"torch_dtype": "float16",
|
30 |
+
"transformers_version": "4.27.0",
|
31 |
+
"use_cache": true,
|
32 |
+
"vocab_size": 32000
|
33 |
+
}
|
configuration_llama.py
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
5 |
+
# and OPT implementations in this library. It has been modified from its
|
6 |
+
# original forms to accommodate minor architectural differences compared
|
7 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
8 |
+
#
|
9 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
+
# you may not use this file except in compliance with the License.
|
11 |
+
# You may obtain a copy of the License at
|
12 |
+
#
|
13 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14 |
+
#
|
15 |
+
# Unless required by applicable law or agreed to in writing, software
|
16 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
+
# See the License for the specific language governing permissions and
|
19 |
+
# limitations under the License.
|
20 |
+
""" LLaMA model configuration"""
|
21 |
+
|
22 |
+
from transformers.configuration_utils import PretrainedConfig
|
23 |
+
from transformers.utils import logging
|
24 |
+
|
25 |
+
|
26 |
+
logger = logging.get_logger(__name__)
|
27 |
+
|
28 |
+
LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
|
29 |
+
|
30 |
+
|
31 |
+
class LLaMAConfig(PretrainedConfig):
|
32 |
+
r"""
|
33 |
+
This is the configuration class to store the configuration of a [`~LLaMAModel`]. It is used to instantiate an LLaMA
|
34 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
35 |
+
defaults will yield a similar configuration to that of the LLaMA-7B.
|
36 |
+
|
37 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
38 |
+
documentation from [`PretrainedConfig`] for more information.
|
39 |
+
|
40 |
+
|
41 |
+
Args:
|
42 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
43 |
+
Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the
|
44 |
+
`inputs_ids` passed when calling [`~LLaMAModel`] or [`~TFLLaMAModel`].
|
45 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
46 |
+
Dimension of the hidden representations.
|
47 |
+
intermediate_size (`int`, *optional*, defaults to 11008):
|
48 |
+
Dimension of the MLP representations.
|
49 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
50 |
+
Number of hidden layers in the Transformer encoder.
|
51 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
52 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
53 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
54 |
+
The non-linear activation function (function or string) in the decoder.
|
55 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
56 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
57 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-12):
|
58 |
+
The epsilon used by the rms normalization layers.
|
59 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
60 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
61 |
+
relevant if `config.is_decoder=True`.
|
62 |
+
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
|
63 |
+
Whether to tie weight embeddings
|
64 |
+
Example:
|
65 |
+
|
66 |
+
```python
|
67 |
+
>>> from transformers import LLaMAModel, LLaMAConfig
|
68 |
+
|
69 |
+
>>> # Initializing a LLaMA llama-7b style configuration
|
70 |
+
>>> configuration = LLaMAConfig()
|
71 |
+
|
72 |
+
>>> # Initializing a model from the llama-7b style configuration
|
73 |
+
>>> model = LLaMAModel(configuration)
|
74 |
+
|
75 |
+
>>> # Accessing the model configuration
|
76 |
+
>>> configuration = model.config
|
77 |
+
```"""
|
78 |
+
model_type = "llama"
|
79 |
+
|
80 |
+
def __init__(
|
81 |
+
self,
|
82 |
+
vocab_size=32000,
|
83 |
+
hidden_size=4096,
|
84 |
+
intermediate_size=11008,
|
85 |
+
num_hidden_layers=32,
|
86 |
+
num_attention_heads=32,
|
87 |
+
hidden_act="silu",
|
88 |
+
initializer_range=0.02,
|
89 |
+
rms_norm_eps=1e-6,
|
90 |
+
use_cache=True,
|
91 |
+
pad_token_id=-1,
|
92 |
+
bos_token_id=0,
|
93 |
+
eos_token_id=1,
|
94 |
+
tie_word_embeddings=False,
|
95 |
+
output_head_hidden_states=False,
|
96 |
+
oproj_bias=False,
|
97 |
+
**kwargs,
|
98 |
+
):
|
99 |
+
self.vocab_size = vocab_size
|
100 |
+
self.hidden_size = hidden_size
|
101 |
+
self.intermediate_size = intermediate_size
|
102 |
+
self.num_hidden_layers = num_hidden_layers
|
103 |
+
self.num_attention_heads = num_attention_heads
|
104 |
+
self.hidden_act = hidden_act
|
105 |
+
self.initializer_range = initializer_range
|
106 |
+
self.rms_norm_eps = rms_norm_eps
|
107 |
+
self.use_cache = use_cache
|
108 |
+
self.output_head_hidden_states = output_head_hidden_states
|
109 |
+
self.oproj_bias = oproj_bias
|
110 |
+
super().__init__(
|
111 |
+
pad_token_id=pad_token_id,
|
112 |
+
bos_token_id=bos_token_id,
|
113 |
+
eos_token_id=eos_token_id,
|
114 |
+
tie_word_embeddings=tie_word_embeddings,
|
115 |
+
**kwargs,
|
116 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"max_length": 4096,
|
6 |
+
"pad_token_id": 0,
|
7 |
+
"temperature": 0.9,
|
8 |
+
"top_p": 0.6,
|
9 |
+
"transformers_version": "4.27.0"
|
10 |
+
}
|
modeling_llama.py
ADDED
@@ -0,0 +1,854 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
5 |
+
# and OPT implementations in this library. It has been modified from its
|
6 |
+
# original forms to accommodate minor architectural differences compared
|
7 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
8 |
+
#
|
9 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
+
# you may not use this file except in compliance with the License.
|
11 |
+
# You may obtain a copy of the License at
|
12 |
+
#
|
13 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14 |
+
#
|
15 |
+
# Unless required by applicable law or agreed to in writing, software
|
16 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
+
# See the License for the specific language governing permissions and
|
19 |
+
# limitations under the License.
|
20 |
+
""" PyTorch LLaMA model."""
|
21 |
+
import math
|
22 |
+
from typing import List, Optional, Tuple, Union
|
23 |
+
|
24 |
+
import torch
|
25 |
+
import torch.utils.checkpoint
|
26 |
+
from torch import nn
|
27 |
+
from torch.nn import CrossEntropyLoss
|
28 |
+
|
29 |
+
from transformers.activations import ACT2FN
|
30 |
+
from transformers.modeling_outputs import (
|
31 |
+
BaseModelOutputWithPast,
|
32 |
+
CausalLMOutputWithPast,
|
33 |
+
)
|
34 |
+
from transformers.modeling_utils import PreTrainedModel
|
35 |
+
from transformers.utils import (
|
36 |
+
add_code_sample_docstrings,
|
37 |
+
add_start_docstrings,
|
38 |
+
add_start_docstrings_to_model_forward,
|
39 |
+
logging,
|
40 |
+
replace_return_docstrings,
|
41 |
+
)
|
42 |
+
from .configuration_llama import LLaMAConfig
|
43 |
+
|
44 |
+
|
45 |
+
logger = logging.get_logger(__name__)
|
46 |
+
|
47 |
+
_CHECKPOINT_FOR_DOC = "llama-7b"
|
48 |
+
_CONFIG_FOR_DOC = "LLaMAConfig"
|
49 |
+
|
50 |
+
|
51 |
+
def _make_causal_mask(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0):
|
52 |
+
"""
|
53 |
+
Make causal mask used for bi-directional self-attention.
|
54 |
+
"""
|
55 |
+
bsz, tgt_len = input_ids_shape
|
56 |
+
mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min))
|
57 |
+
mask_cond = torch.arange(mask.size(-1))
|
58 |
+
mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
|
59 |
+
mask = mask.to(dtype)
|
60 |
+
|
61 |
+
if past_key_values_length > 0:
|
62 |
+
mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype), mask], dim=-1)
|
63 |
+
return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len + past_key_values_length)
|
64 |
+
|
65 |
+
|
66 |
+
def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
|
67 |
+
"""
|
68 |
+
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
|
69 |
+
"""
|
70 |
+
bsz, src_len = mask.size()
|
71 |
+
tgt_len = tgt_len if tgt_len is not None else src_len
|
72 |
+
|
73 |
+
expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
|
74 |
+
|
75 |
+
inverted_mask = 1.0 - expanded_mask
|
76 |
+
|
77 |
+
return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min)
|
78 |
+
|
79 |
+
|
80 |
+
class RMSNorm(nn.Module):
|
81 |
+
def __init__(self, hidden_size, eps=1e-6):
|
82 |
+
"""
|
83 |
+
RMSNorm is equivalent to T5LayerNorm
|
84 |
+
"""
|
85 |
+
super().__init__()
|
86 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
87 |
+
self.variance_epsilon = eps
|
88 |
+
|
89 |
+
def forward(self, hidden_states):
|
90 |
+
variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True)
|
91 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
92 |
+
|
93 |
+
# convert into half-precision if necessary
|
94 |
+
if self.weight.dtype in [torch.float16, torch.bfloat16]:
|
95 |
+
hidden_states = hidden_states.to(self.weight.dtype)
|
96 |
+
|
97 |
+
return self.weight * hidden_states
|
98 |
+
|
99 |
+
|
100 |
+
class RotaryEmbedding(torch.nn.Module):
|
101 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
|
102 |
+
super().__init__()
|
103 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float().to(device) / dim))
|
104 |
+
self.register_buffer("inv_freq", inv_freq)
|
105 |
+
|
106 |
+
# Build here to make `torch.jit.trace` work.
|
107 |
+
self.max_seq_len_cached = max_position_embeddings
|
108 |
+
t = torch.arange(self.max_seq_len_cached, device=self.inv_freq.device, dtype=self.inv_freq.dtype)
|
109 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
110 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
111 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
112 |
+
self.cos_cached = emb.cos()[None, None, :, :]
|
113 |
+
self.sin_cached = emb.sin()[None, None, :, :]
|
114 |
+
|
115 |
+
def forward(self, x, seq_len=None):
|
116 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
117 |
+
# This `if` block is unlikely to be run after we build sin/cos in `__init__`. Keep the logic here just in case.
|
118 |
+
if seq_len > self.max_seq_len_cached:
|
119 |
+
self.max_seq_len_cached = seq_len
|
120 |
+
t = torch.arange(self.max_seq_len_cached, device=x.device, dtype=self.inv_freq.dtype)
|
121 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
122 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
123 |
+
emb = torch.cat((freqs, freqs), dim=-1).to(x.device)
|
124 |
+
self.cos_cached = emb.cos()[None, None, :, :].to(dtype=x.dtype)
|
125 |
+
self.sin_cached = emb.sin()[None, None, :, :].to(dtype=x.dtype)
|
126 |
+
return (
|
127 |
+
self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype, device=x.device),
|
128 |
+
self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype, device=x.device),
|
129 |
+
)
|
130 |
+
|
131 |
+
|
132 |
+
def rotate_half(x):
|
133 |
+
"""Rotates half the hidden dims of the input."""
|
134 |
+
x1 = x[..., : x.shape[-1] // 2]
|
135 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
136 |
+
return torch.cat((-x2, x1), dim=-1)
|
137 |
+
|
138 |
+
|
139 |
+
def apply_rotary_pos_emb(q, k, cos, sin, offset: int = 0):
|
140 |
+
cos = cos[..., offset : q.shape[-2] + offset, :]
|
141 |
+
sin = sin[..., offset : q.shape[-2] + offset, :]
|
142 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
143 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
144 |
+
return q_embed, k_embed
|
145 |
+
|
146 |
+
|
147 |
+
class LLaMAMLP(nn.Module):
|
148 |
+
def __init__(
|
149 |
+
self,
|
150 |
+
hidden_size: int,
|
151 |
+
intermediate_size: int,
|
152 |
+
hidden_act: str,
|
153 |
+
):
|
154 |
+
super().__init__()
|
155 |
+
self.gate_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
|
156 |
+
self.down_proj = nn.Linear(intermediate_size, hidden_size, bias=False)
|
157 |
+
self.up_proj = nn.Linear(hidden_size, intermediate_size, bias=False)
|
158 |
+
self.act_fn = ACT2FN[hidden_act]
|
159 |
+
|
160 |
+
def forward(self, x):
|
161 |
+
return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
162 |
+
|
163 |
+
|
164 |
+
class LLaMAAttention(nn.Module):
|
165 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
166 |
+
|
167 |
+
def __init__(
|
168 |
+
self,
|
169 |
+
hidden_size: int,
|
170 |
+
num_heads: int,
|
171 |
+
oproj_bias: bool = False,
|
172 |
+
):
|
173 |
+
super().__init__()
|
174 |
+
self.hidden_size = hidden_size
|
175 |
+
self.num_heads = num_heads
|
176 |
+
self.head_dim = hidden_size // num_heads
|
177 |
+
|
178 |
+
if (self.head_dim * num_heads) != self.hidden_size:
|
179 |
+
raise ValueError(
|
180 |
+
f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
|
181 |
+
f" and `num_heads`: {num_heads})."
|
182 |
+
)
|
183 |
+
self.q_proj = nn.Linear(
|
184 |
+
hidden_size,
|
185 |
+
num_heads * self.head_dim,
|
186 |
+
bias=False,
|
187 |
+
)
|
188 |
+
self.k_proj = nn.Linear(
|
189 |
+
hidden_size,
|
190 |
+
num_heads * self.head_dim,
|
191 |
+
bias=False,
|
192 |
+
)
|
193 |
+
self.v_proj = nn.Linear(
|
194 |
+
hidden_size,
|
195 |
+
num_heads * self.head_dim,
|
196 |
+
bias=False,
|
197 |
+
)
|
198 |
+
|
199 |
+
self.att_out = nn.Identity()
|
200 |
+
self.value_out = nn.Identity()
|
201 |
+
self.head_out = nn.Identity()
|
202 |
+
|
203 |
+
self.o_proj = nn.Linear(
|
204 |
+
num_heads * self.head_dim,
|
205 |
+
hidden_size,
|
206 |
+
bias=oproj_bias,
|
207 |
+
)
|
208 |
+
self.rotary_emb = RotaryEmbedding(self.head_dim)
|
209 |
+
|
210 |
+
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
|
211 |
+
return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
212 |
+
|
213 |
+
def forward(
|
214 |
+
self,
|
215 |
+
hidden_states: torch.Tensor,
|
216 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
217 |
+
attention_mask: Optional[torch.Tensor] = None,
|
218 |
+
output_attentions: bool = False,
|
219 |
+
output_head_hidden_states: bool = False,
|
220 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
221 |
+
"""Input shape: Batch x Time x Channel"""
|
222 |
+
|
223 |
+
bsz, q_len, _ = hidden_states.size()
|
224 |
+
|
225 |
+
query_states = self.q_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
226 |
+
key_states = self.k_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
227 |
+
value_states = self.v_proj(hidden_states).view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
228 |
+
|
229 |
+
kv_seq_len = key_states.shape[-2]
|
230 |
+
offset = 0
|
231 |
+
if past_key_value is not None:
|
232 |
+
offset = past_key_value[0].shape[-2]
|
233 |
+
kv_seq_len += offset
|
234 |
+
cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
235 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, offset=offset)
|
236 |
+
# [bsz, nh, t, hd]
|
237 |
+
|
238 |
+
if past_key_value is not None:
|
239 |
+
# reuse k, v, self_attention
|
240 |
+
key_states = torch.cat([past_key_value[0], key_states], dim=2)
|
241 |
+
value_states = torch.cat([past_key_value[1], value_states], dim=2)
|
242 |
+
|
243 |
+
past_key_value = (key_states, value_states)
|
244 |
+
|
245 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
|
246 |
+
|
247 |
+
if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
|
248 |
+
raise ValueError(
|
249 |
+
f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
|
250 |
+
f" {attn_weights.size()}"
|
251 |
+
)
|
252 |
+
|
253 |
+
if attention_mask is not None:
|
254 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
255 |
+
raise ValueError(
|
256 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
257 |
+
)
|
258 |
+
attn_weights = attn_weights + attention_mask
|
259 |
+
attn_weights = torch.max(attn_weights, torch.tensor(torch.finfo(attn_weights.dtype).min))
|
260 |
+
|
261 |
+
# upcast attention to fp32
|
262 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
|
263 |
+
attn_weights = self.att_out(attn_weights)
|
264 |
+
value_states = self.value_out(value_states)
|
265 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
266 |
+
|
267 |
+
if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
|
268 |
+
raise ValueError(
|
269 |
+
f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
|
270 |
+
f" {attn_output.size()}"
|
271 |
+
)
|
272 |
+
|
273 |
+
attn_output = attn_output.transpose(1, 2)
|
274 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
|
275 |
+
attn_output = self.head_out(attn_output)
|
276 |
+
attn_output = self.o_proj(attn_output)
|
277 |
+
|
278 |
+
if not output_attentions:
|
279 |
+
attn_weights = None
|
280 |
+
|
281 |
+
return attn_output, attn_weights, past_key_value
|
282 |
+
|
283 |
+
|
284 |
+
class LLaMADecoderLayer(nn.Module):
|
285 |
+
def __init__(self, config: LLaMAConfig):
|
286 |
+
super().__init__()
|
287 |
+
self.hidden_size = config.hidden_size
|
288 |
+
self.self_attn = LLaMAAttention(
|
289 |
+
hidden_size=self.hidden_size,
|
290 |
+
num_heads=config.num_attention_heads,
|
291 |
+
oproj_bias=config.oproj_bias,
|
292 |
+
)
|
293 |
+
self.mlp = LLaMAMLP(
|
294 |
+
hidden_size=self.hidden_size,
|
295 |
+
intermediate_size=config.intermediate_size,
|
296 |
+
hidden_act=config.hidden_act,
|
297 |
+
)
|
298 |
+
self.input_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
299 |
+
self.post_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
300 |
+
|
301 |
+
def forward(
|
302 |
+
self,
|
303 |
+
hidden_states: torch.Tensor,
|
304 |
+
attention_mask: Optional[torch.Tensor] = None,
|
305 |
+
output_attentions: Optional[bool] = False,
|
306 |
+
use_cache: Optional[bool] = False,
|
307 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
308 |
+
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
309 |
+
"""
|
310 |
+
Args:
|
311 |
+
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
312 |
+
attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
|
313 |
+
`(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
|
314 |
+
output_attentions (`bool`, *optional*):
|
315 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
316 |
+
returned tensors for more detail.
|
317 |
+
use_cache (`bool`, *optional*):
|
318 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
|
319 |
+
(see `past_key_values`).
|
320 |
+
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
321 |
+
"""
|
322 |
+
|
323 |
+
residual = hidden_states
|
324 |
+
|
325 |
+
hidden_states = self.input_layernorm(hidden_states)
|
326 |
+
|
327 |
+
# Self Attention
|
328 |
+
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
329 |
+
hidden_states=hidden_states,
|
330 |
+
past_key_value=past_key_value,
|
331 |
+
attention_mask=attention_mask,
|
332 |
+
output_attentions=output_attentions,
|
333 |
+
)
|
334 |
+
|
335 |
+
hidden_states = residual + hidden_states
|
336 |
+
|
337 |
+
# Fully Connected
|
338 |
+
residual = hidden_states
|
339 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
340 |
+
hidden_states = self.mlp(hidden_states)
|
341 |
+
hidden_states = residual + hidden_states
|
342 |
+
|
343 |
+
outputs = [hidden_states,]
|
344 |
+
|
345 |
+
if output_attentions:
|
346 |
+
outputs += [self_attn_weights,]
|
347 |
+
|
348 |
+
if use_cache:
|
349 |
+
outputs += [present_key_value,]
|
350 |
+
|
351 |
+
return outputs
|
352 |
+
|
353 |
+
|
354 |
+
LLAMA_START_DOCSTRING = r"""
|
355 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
356 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
357 |
+
etc.)
|
358 |
+
|
359 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
360 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
361 |
+
and behavior.
|
362 |
+
|
363 |
+
Parameters:
|
364 |
+
config ([`LLaMAConfig`]):
|
365 |
+
Model configuration class with all the parameters of the model. Initializing with a config file does not
|
366 |
+
load the weights associated with the model, only the configuration. Check out the
|
367 |
+
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
368 |
+
"""
|
369 |
+
|
370 |
+
|
371 |
+
@add_start_docstrings(
|
372 |
+
"The bare OPT Model outputting raw hidden-states without any specific head on top.",
|
373 |
+
LLAMA_START_DOCSTRING,
|
374 |
+
)
|
375 |
+
class LLaMAPreTrainedModel(PreTrainedModel):
|
376 |
+
config_class = LLaMAConfig
|
377 |
+
base_model_prefix = "model"
|
378 |
+
supports_gradient_checkpointing = True
|
379 |
+
_no_split_modules = ["LLaMADecoderLayer"]
|
380 |
+
_keys_to_ignore_on_load_unexpected = [r"decoder\.version"]
|
381 |
+
|
382 |
+
def _init_weights(self, module):
|
383 |
+
std = self.config.initializer_range
|
384 |
+
if isinstance(module, nn.Linear):
|
385 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
386 |
+
if module.bias is not None:
|
387 |
+
module.bias.data.zero_()
|
388 |
+
elif isinstance(module, nn.Embedding):
|
389 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
390 |
+
if module.padding_idx is not None:
|
391 |
+
module.weight.data[module.padding_idx].zero_()
|
392 |
+
|
393 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
394 |
+
if isinstance(module, (LLaMADecoderLayer)):
|
395 |
+
module.gradient_checkpointing = value
|
396 |
+
|
397 |
+
|
398 |
+
LLAMA_INPUTS_DOCSTRING = r"""
|
399 |
+
Args:
|
400 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
401 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
|
402 |
+
it.
|
403 |
+
|
404 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
405 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
406 |
+
|
407 |
+
[What are input IDs?](../glossary#input-ids)
|
408 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
409 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
410 |
+
|
411 |
+
- 1 for tokens that are **not masked**,
|
412 |
+
- 0 for tokens that are **masked**.
|
413 |
+
|
414 |
+
[What are attention masks?](../glossary#attention-mask)
|
415 |
+
|
416 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
417 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
418 |
+
|
419 |
+
If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
|
420 |
+
`past_key_values`).
|
421 |
+
|
422 |
+
If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
|
423 |
+
and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
|
424 |
+
information on the default strategy.
|
425 |
+
|
426 |
+
- 1 indicates the head is **not masked**,
|
427 |
+
- 0 indicates the head is **masked**.
|
428 |
+
|
429 |
+
past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
430 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
|
431 |
+
`(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
|
432 |
+
`(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.
|
433 |
+
|
434 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
|
435 |
+
blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
|
436 |
+
|
437 |
+
If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those that
|
438 |
+
don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of all
|
439 |
+
`decoder_input_ids` of shape `(batch_size, sequence_length)`.
|
440 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
441 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
|
442 |
+
is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
|
443 |
+
model's internal embedding lookup matrix.
|
444 |
+
use_cache (`bool`, *optional*):
|
445 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
446 |
+
`past_key_values`).
|
447 |
+
output_attentions (`bool`, *optional*):
|
448 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
449 |
+
tensors for more detail.
|
450 |
+
output_hidden_states (`bool`, *optional*):
|
451 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
452 |
+
more detail.
|
453 |
+
return_dict (`bool`, *optional*):
|
454 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
455 |
+
"""
|
456 |
+
|
457 |
+
|
458 |
+
@add_start_docstrings(
|
459 |
+
"The bare LLaMA Model outputting raw hidden-states without any specific head on top.",
|
460 |
+
LLAMA_START_DOCSTRING,
|
461 |
+
)
|
462 |
+
class LLaMAModel(LLaMAPreTrainedModel):
|
463 |
+
"""
|
464 |
+
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`LLaMADecoderLayer`]
|
465 |
+
|
466 |
+
Args:
|
467 |
+
config: LLaMAConfig
|
468 |
+
"""
|
469 |
+
|
470 |
+
def __init__(self, config: LLaMAConfig):
|
471 |
+
super().__init__(config)
|
472 |
+
self.padding_idx = config.pad_token_id
|
473 |
+
self.vocab_size = config.vocab_size
|
474 |
+
|
475 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
476 |
+
self.layers = nn.ModuleList([LLaMADecoderLayer(config) for _ in range(config.num_hidden_layers)])
|
477 |
+
self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
478 |
+
|
479 |
+
self.gradient_checkpointing = False
|
480 |
+
# Initialize weights and apply final processing
|
481 |
+
self.post_init()
|
482 |
+
|
483 |
+
def get_input_embeddings(self):
|
484 |
+
return self.embed_tokens
|
485 |
+
|
486 |
+
def set_input_embeddings(self, value):
|
487 |
+
self.embed_tokens = value
|
488 |
+
|
489 |
+
# Copied from transformers.models.bart.modeling_bart.BartDecoder._prepare_decoder_attention_mask
|
490 |
+
def _prepare_decoder_attention_mask(self, attention_mask, input_shape, inputs_embeds, past_key_values_length):
|
491 |
+
# create causal mask
|
492 |
+
# [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
|
493 |
+
combined_attention_mask = None
|
494 |
+
if input_shape[-1] > 1:
|
495 |
+
combined_attention_mask = _make_causal_mask(
|
496 |
+
input_shape, inputs_embeds.dtype, past_key_values_length=past_key_values_length
|
497 |
+
).to(inputs_embeds.device)
|
498 |
+
|
499 |
+
if attention_mask is not None:
|
500 |
+
# [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
|
501 |
+
expanded_attn_mask = _expand_mask(attention_mask, inputs_embeds.dtype, tgt_len=input_shape[-1]).to(
|
502 |
+
inputs_embeds.device
|
503 |
+
)
|
504 |
+
combined_attention_mask = (
|
505 |
+
expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask + combined_attention_mask
|
506 |
+
)
|
507 |
+
|
508 |
+
return combined_attention_mask
|
509 |
+
|
510 |
+
def forward(
|
511 |
+
self,
|
512 |
+
input_ids: torch.LongTensor = None,
|
513 |
+
attention_mask: Optional[torch.Tensor] = None,
|
514 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
515 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
516 |
+
use_cache: Optional[bool] = None,
|
517 |
+
output_attentions: Optional[bool] = None,
|
518 |
+
output_hidden_states: Optional[bool] = None,
|
519 |
+
return_dict: Optional[bool] = None,
|
520 |
+
) -> Union[Tuple, BaseModelOutputWithPast]:
|
521 |
+
r"""
|
522 |
+
Args:
|
523 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
524 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
|
525 |
+
provide it.
|
526 |
+
|
527 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
528 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
529 |
+
|
530 |
+
[What are input IDs?](../glossary#input-ids)
|
531 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
532 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
533 |
+
|
534 |
+
- 1 for tokens that are **not masked**,
|
535 |
+
- 0 for tokens that are **masked**.
|
536 |
+
|
537 |
+
[What are attention masks?](../glossary#attention-mask)
|
538 |
+
past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
539 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
|
540 |
+
shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of
|
541 |
+
|
542 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the
|
543 |
+
cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
|
544 |
+
|
545 |
+
If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those
|
546 |
+
that don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of
|
547 |
+
all `decoder_input_ids` of shape `(batch_size, sequence_length)`.
|
548 |
+
use_cache (`bool`, *optional*):
|
549 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
550 |
+
`past_key_values`).
|
551 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
552 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation.
|
553 |
+
This is useful if you want more control over how to convert `input_ids` indices into associated vectors
|
554 |
+
than the model's internal embedding lookup matrix.
|
555 |
+
output_attentions (`bool`, *optional*):
|
556 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
557 |
+
returned tensors for more detail.
|
558 |
+
output_hidden_states (`bool`, *optional*):
|
559 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
560 |
+
for more detail.
|
561 |
+
return_dict (`bool`, *optional*):
|
562 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
563 |
+
"""
|
564 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
565 |
+
output_hidden_states = (
|
566 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
567 |
+
)
|
568 |
+
|
569 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
570 |
+
|
571 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
572 |
+
|
573 |
+
# retrieve input_ids and inputs_embeds
|
574 |
+
if input_ids is not None and inputs_embeds is not None:
|
575 |
+
raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
|
576 |
+
elif input_ids is not None:
|
577 |
+
input_shape = input_ids.size()
|
578 |
+
input_ids = input_ids.view(-1, input_shape[-1])
|
579 |
+
elif inputs_embeds is not None:
|
580 |
+
input_shape = inputs_embeds.size()[:-1]
|
581 |
+
else:
|
582 |
+
raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
|
583 |
+
|
584 |
+
past_key_values_length = past_key_values[0][0].shape[2] if past_key_values is not None else 0
|
585 |
+
|
586 |
+
if inputs_embeds is None:
|
587 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
588 |
+
|
589 |
+
# embed positions
|
590 |
+
if attention_mask is None:
|
591 |
+
attention_mask = torch.ones(inputs_embeds.shape[:2], dtype=torch.bool, device=inputs_embeds.device)
|
592 |
+
|
593 |
+
attention_mask = self._prepare_decoder_attention_mask(
|
594 |
+
attention_mask, input_shape, inputs_embeds, past_key_values_length
|
595 |
+
)
|
596 |
+
|
597 |
+
hidden_states = inputs_embeds
|
598 |
+
|
599 |
+
if self.gradient_checkpointing and self.training:
|
600 |
+
if use_cache:
|
601 |
+
logger.warning_once(
|
602 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
603 |
+
)
|
604 |
+
use_cache = False
|
605 |
+
|
606 |
+
# decoder layers
|
607 |
+
all_hidden_states = () if output_hidden_states else None
|
608 |
+
all_self_attns = () if output_attentions else None
|
609 |
+
next_decoder_cache = () if use_cache else None
|
610 |
+
|
611 |
+
for idx, decoder_layer in enumerate(self.layers):
|
612 |
+
if output_hidden_states:
|
613 |
+
all_hidden_states += (hidden_states,)
|
614 |
+
|
615 |
+
past_key_value = past_key_values[idx] if past_key_values is not None else None
|
616 |
+
|
617 |
+
if self.gradient_checkpointing and self.training:
|
618 |
+
|
619 |
+
def create_custom_forward(module):
|
620 |
+
def custom_forward(*inputs):
|
621 |
+
# None for past_key_value
|
622 |
+
return module(*inputs, output_attentions, None)
|
623 |
+
|
624 |
+
return custom_forward
|
625 |
+
|
626 |
+
layer_outputs = torch.utils.checkpoint.checkpoint(
|
627 |
+
create_custom_forward(decoder_layer),
|
628 |
+
hidden_states,
|
629 |
+
attention_mask,
|
630 |
+
None,
|
631 |
+
)
|
632 |
+
else:
|
633 |
+
layer_outputs = decoder_layer(
|
634 |
+
hidden_states,
|
635 |
+
attention_mask=attention_mask,
|
636 |
+
past_key_value=past_key_value,
|
637 |
+
output_attentions=output_attentions,
|
638 |
+
use_cache=use_cache,
|
639 |
+
)
|
640 |
+
|
641 |
+
hidden_states = layer_outputs[0]
|
642 |
+
|
643 |
+
if use_cache:
|
644 |
+
next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
|
645 |
+
|
646 |
+
if output_attentions:
|
647 |
+
all_self_attns += (layer_outputs[1],)
|
648 |
+
|
649 |
+
hidden_states = self.norm(hidden_states)
|
650 |
+
|
651 |
+
# add hidden states from the last decoder layer
|
652 |
+
if output_hidden_states:
|
653 |
+
all_hidden_states += (hidden_states,)
|
654 |
+
|
655 |
+
next_cache = next_decoder_cache if use_cache else None
|
656 |
+
if not return_dict:
|
657 |
+
return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
|
658 |
+
return BaseModelOutputWithPast(
|
659 |
+
last_hidden_state=hidden_states,
|
660 |
+
past_key_values=next_cache,
|
661 |
+
hidden_states=all_hidden_states,
|
662 |
+
attentions=all_self_attns,
|
663 |
+
)
|
664 |
+
|
665 |
+
|
666 |
+
class LLaMAForCausalLM(LLaMAPreTrainedModel):
|
667 |
+
_keys_to_ignore_on_load_missing = [r"lm_head.weight"]
|
668 |
+
|
669 |
+
def __init__(self, config):
|
670 |
+
super().__init__(config)
|
671 |
+
self.model = LLaMAModel(config)
|
672 |
+
|
673 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
674 |
+
|
675 |
+
# Initialize weights and apply final processing
|
676 |
+
self.post_init()
|
677 |
+
|
678 |
+
def get_input_embeddings(self):
|
679 |
+
return self.model.embed_tokens
|
680 |
+
|
681 |
+
def set_input_embeddings(self, value):
|
682 |
+
self.model.embed_tokens = value
|
683 |
+
|
684 |
+
def get_output_embeddings(self):
|
685 |
+
return self.lm_head
|
686 |
+
|
687 |
+
def set_output_embeddings(self, new_embeddings):
|
688 |
+
self.lm_head = new_embeddings
|
689 |
+
|
690 |
+
def set_decoder(self, decoder):
|
691 |
+
self.model = decoder
|
692 |
+
|
693 |
+
def get_decoder(self):
|
694 |
+
return self.model
|
695 |
+
|
696 |
+
@replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
|
697 |
+
def forward(
|
698 |
+
self,
|
699 |
+
input_ids: torch.LongTensor = None,
|
700 |
+
attention_mask: Optional[torch.Tensor] = None,
|
701 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
702 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
703 |
+
labels: Optional[torch.LongTensor] = None,
|
704 |
+
use_cache: Optional[bool] = None,
|
705 |
+
output_attentions: Optional[bool] = None,
|
706 |
+
output_hidden_states: Optional[bool] = None,
|
707 |
+
return_dict: Optional[bool] = None,
|
708 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
709 |
+
r"""
|
710 |
+
Args:
|
711 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
712 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
|
713 |
+
provide it.
|
714 |
+
|
715 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
716 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
717 |
+
|
718 |
+
[What are input IDs?](../glossary#input-ids)
|
719 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
720 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
721 |
+
|
722 |
+
- 1 for tokens that are **not masked**,
|
723 |
+
- 0 for tokens that are **masked**.
|
724 |
+
|
725 |
+
[What are attention masks?](../glossary#attention-mask)
|
726 |
+
past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
727 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
|
728 |
+
shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of
|
729 |
+
shape `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`. The two additional
|
730 |
+
tensors are only required when the model is used as a decoder in a Sequence to Sequence model.
|
731 |
+
|
732 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the
|
733 |
+
cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
|
734 |
+
|
735 |
+
If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those
|
736 |
+
that don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of
|
737 |
+
all `decoder_input_ids` of shape `(batch_size, sequence_length)`.
|
738 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
739 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation.
|
740 |
+
This is useful if you want more control over how to convert `input_ids` indices into associated vectors
|
741 |
+
than the model's internal embedding lookup matrix.
|
742 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
743 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
744 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
745 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
746 |
+
use_cache (`bool`, *optional*):
|
747 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
|
748 |
+
(see `past_key_values`).
|
749 |
+
output_attentions (`bool`, *optional*):
|
750 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
751 |
+
returned tensors for more detail.
|
752 |
+
output_hidden_states (`bool`, *optional*):
|
753 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
754 |
+
for more detail.
|
755 |
+
return_dict (`bool`, *optional*):
|
756 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
757 |
+
|
758 |
+
Returns:
|
759 |
+
|
760 |
+
Example:
|
761 |
+
|
762 |
+
```python
|
763 |
+
>>> from transformers import AutoTokenizer, LLaMAForCausalLM
|
764 |
+
|
765 |
+
>>> model = LLaMAForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
766 |
+
>>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
767 |
+
|
768 |
+
>>> prompt = "Hey, are you consciours? Can you talk to me?"
|
769 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
770 |
+
|
771 |
+
>>> # Generate
|
772 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
773 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
774 |
+
"Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."
|
775 |
+
```"""
|
776 |
+
|
777 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
778 |
+
output_hidden_states = (
|
779 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
780 |
+
)
|
781 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
782 |
+
|
783 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
784 |
+
outputs = self.model(
|
785 |
+
input_ids=input_ids,
|
786 |
+
attention_mask=attention_mask,
|
787 |
+
past_key_values=past_key_values,
|
788 |
+
inputs_embeds=inputs_embeds,
|
789 |
+
use_cache=use_cache,
|
790 |
+
output_attentions=output_attentions,
|
791 |
+
output_hidden_states=output_hidden_states,
|
792 |
+
return_dict=return_dict,
|
793 |
+
)
|
794 |
+
|
795 |
+
hidden_states = outputs[0]
|
796 |
+
logits = self.lm_head(hidden_states)
|
797 |
+
|
798 |
+
loss = None
|
799 |
+
if labels is not None:
|
800 |
+
# move labels to correct device to enable model parallelism
|
801 |
+
labels = labels.to(logits.device)
|
802 |
+
# Compute loss in fp32 to match with mesh-tf version
|
803 |
+
# https://github.com/EleutherAI/gpt-neo/blob/89ce74164da2fb16179106f54e2269b5da8db333/models/gpt2/gpt2.py#L179
|
804 |
+
logits = logits.to(torch.float32)
|
805 |
+
|
806 |
+
# Shift so that tokens < n predict n
|
807 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
808 |
+
shift_labels = labels[..., 1:].contiguous()
|
809 |
+
# Flatten the tokens
|
810 |
+
loss_fct = CrossEntropyLoss()
|
811 |
+
loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
|
812 |
+
|
813 |
+
logits = logits.to(hidden_states.dtype)
|
814 |
+
loss = loss.to(hidden_states.dtype)
|
815 |
+
|
816 |
+
if not return_dict:
|
817 |
+
output = (logits,) + outputs[1:]
|
818 |
+
return (loss,) + output if loss is not None else output
|
819 |
+
|
820 |
+
return CausalLMOutputWithPast(
|
821 |
+
loss=loss,
|
822 |
+
logits=logits,
|
823 |
+
past_key_values=outputs.past_key_values,
|
824 |
+
hidden_states=outputs.hidden_states,
|
825 |
+
attentions=outputs.attentions,
|
826 |
+
)
|
827 |
+
|
828 |
+
def prepare_inputs_for_generation(
|
829 |
+
self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
|
830 |
+
):
|
831 |
+
if past_key_values:
|
832 |
+
input_ids = input_ids[:, -1:]
|
833 |
+
|
834 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
835 |
+
if inputs_embeds is not None and past_key_values is None:
|
836 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
837 |
+
else:
|
838 |
+
model_inputs = {"input_ids": input_ids}
|
839 |
+
|
840 |
+
model_inputs.update(
|
841 |
+
{
|
842 |
+
"past_key_values": past_key_values,
|
843 |
+
"use_cache": kwargs.get("use_cache"),
|
844 |
+
"attention_mask": attention_mask,
|
845 |
+
}
|
846 |
+
)
|
847 |
+
return model_inputs
|
848 |
+
|
849 |
+
@staticmethod
|
850 |
+
def _reorder_cache(past_key_values, beam_idx):
|
851 |
+
reordered_past = ()
|
852 |
+
for layer_past in past_key_values:
|
853 |
+
reordered_past += (tuple(past_state.index_select(0, beam_idx) for past_state in layer_past),)
|
854 |
+
return reordered_past
|
pytorch_model-00001-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:70dd915d52aac155b19709f0669f3dec8ccdf418029898e069cd605c2c9e5a46
|
3 |
+
size 9976839242
|
pytorch_model-00002-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0cc4983aedd740c99ce32906a5515be80fce1650e3c14005422bcd90726c32b1
|
3 |
+
size 3500383715
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 13477101568
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "pytorch_model-00002-of-00002.bin",
|
7 |
+
"model.embed_tokens.weight": "pytorch_model-00001-of-00002.bin",
|
8 |
+
"model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
9 |
+
"model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
10 |
+
"model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
11 |
+
"model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
13 |
+
"model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
14 |
+
"model.layers.0.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
15 |
+
"model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
16 |
+
"model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
17 |
+
"model.layers.0.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
18 |
+
"model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
19 |
+
"model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
20 |
+
"model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
21 |
+
"model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
22 |
+
"model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
23 |
+
"model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
24 |
+
"model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
25 |
+
"model.layers.1.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
26 |
+
"model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
27 |
+
"model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
28 |
+
"model.layers.1.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
29 |
+
"model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
30 |
+
"model.layers.10.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
31 |
+
"model.layers.10.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
32 |
+
"model.layers.10.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
33 |
+
"model.layers.10.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
34 |
+
"model.layers.10.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
35 |
+
"model.layers.10.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
36 |
+
"model.layers.10.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
37 |
+
"model.layers.10.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
38 |
+
"model.layers.10.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
39 |
+
"model.layers.10.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
40 |
+
"model.layers.10.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
41 |
+
"model.layers.11.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
42 |
+
"model.layers.11.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
43 |
+
"model.layers.11.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
44 |
+
"model.layers.11.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
45 |
+
"model.layers.11.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
46 |
+
"model.layers.11.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
47 |
+
"model.layers.11.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
48 |
+
"model.layers.11.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
49 |
+
"model.layers.11.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
50 |
+
"model.layers.11.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
51 |
+
"model.layers.11.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
52 |
+
"model.layers.12.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
53 |
+
"model.layers.12.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
54 |
+
"model.layers.12.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
55 |
+
"model.layers.12.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
56 |
+
"model.layers.12.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
57 |
+
"model.layers.12.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
58 |
+
"model.layers.12.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
59 |
+
"model.layers.12.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
60 |
+
"model.layers.12.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
61 |
+
"model.layers.12.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
62 |
+
"model.layers.12.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
63 |
+
"model.layers.13.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
64 |
+
"model.layers.13.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
65 |
+
"model.layers.13.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
66 |
+
"model.layers.13.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
67 |
+
"model.layers.13.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
68 |
+
"model.layers.13.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
69 |
+
"model.layers.13.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
70 |
+
"model.layers.13.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
71 |
+
"model.layers.13.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
72 |
+
"model.layers.13.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
73 |
+
"model.layers.13.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
74 |
+
"model.layers.14.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
75 |
+
"model.layers.14.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
76 |
+
"model.layers.14.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
77 |
+
"model.layers.14.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
78 |
+
"model.layers.14.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
79 |
+
"model.layers.14.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
80 |
+
"model.layers.14.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
81 |
+
"model.layers.14.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
82 |
+
"model.layers.14.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
83 |
+
"model.layers.14.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
84 |
+
"model.layers.14.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
85 |
+
"model.layers.15.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
86 |
+
"model.layers.15.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
87 |
+
"model.layers.15.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
88 |
+
"model.layers.15.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
89 |
+
"model.layers.15.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
90 |
+
"model.layers.15.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
91 |
+
"model.layers.15.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
92 |
+
"model.layers.15.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
93 |
+
"model.layers.15.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
94 |
+
"model.layers.15.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
95 |
+
"model.layers.15.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
96 |
+
"model.layers.16.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
97 |
+
"model.layers.16.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
98 |
+
"model.layers.16.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
99 |
+
"model.layers.16.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
100 |
+
"model.layers.16.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
101 |
+
"model.layers.16.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
102 |
+
"model.layers.16.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
103 |
+
"model.layers.16.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
104 |
+
"model.layers.16.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
105 |
+
"model.layers.16.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
106 |
+
"model.layers.16.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
107 |
+
"model.layers.17.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
108 |
+
"model.layers.17.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
109 |
+
"model.layers.17.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
110 |
+
"model.layers.17.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
111 |
+
"model.layers.17.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
112 |
+
"model.layers.17.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
113 |
+
"model.layers.17.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
114 |
+
"model.layers.17.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
115 |
+
"model.layers.17.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
116 |
+
"model.layers.17.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
117 |
+
"model.layers.17.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
118 |
+
"model.layers.18.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
119 |
+
"model.layers.18.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
120 |
+
"model.layers.18.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
121 |
+
"model.layers.18.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
122 |
+
"model.layers.18.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
123 |
+
"model.layers.18.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
124 |
+
"model.layers.18.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
125 |
+
"model.layers.18.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
126 |
+
"model.layers.18.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
127 |
+
"model.layers.18.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
128 |
+
"model.layers.18.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
129 |
+
"model.layers.19.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
130 |
+
"model.layers.19.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
131 |
+
"model.layers.19.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
132 |
+
"model.layers.19.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
133 |
+
"model.layers.19.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
134 |
+
"model.layers.19.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
135 |
+
"model.layers.19.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
136 |
+
"model.layers.19.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
137 |
+
"model.layers.19.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
138 |
+
"model.layers.19.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
139 |
+
"model.layers.19.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
140 |
+
"model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
141 |
+
"model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
142 |
+
"model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
143 |
+
"model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
144 |
+
"model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
145 |
+
"model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
146 |
+
"model.layers.2.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
147 |
+
"model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
148 |
+
"model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
149 |
+
"model.layers.2.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
150 |
+
"model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
151 |
+
"model.layers.20.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
152 |
+
"model.layers.20.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
153 |
+
"model.layers.20.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
154 |
+
"model.layers.20.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
155 |
+
"model.layers.20.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
156 |
+
"model.layers.20.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
157 |
+
"model.layers.20.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
158 |
+
"model.layers.20.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
159 |
+
"model.layers.20.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
160 |
+
"model.layers.20.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
161 |
+
"model.layers.20.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
162 |
+
"model.layers.21.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
163 |
+
"model.layers.21.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
164 |
+
"model.layers.21.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
165 |
+
"model.layers.21.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
166 |
+
"model.layers.21.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
167 |
+
"model.layers.21.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
168 |
+
"model.layers.21.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
169 |
+
"model.layers.21.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
170 |
+
"model.layers.21.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
171 |
+
"model.layers.21.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
172 |
+
"model.layers.21.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
173 |
+
"model.layers.22.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
174 |
+
"model.layers.22.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
175 |
+
"model.layers.22.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
176 |
+
"model.layers.22.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
177 |
+
"model.layers.22.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
178 |
+
"model.layers.22.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
179 |
+
"model.layers.22.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
180 |
+
"model.layers.22.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
181 |
+
"model.layers.22.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
182 |
+
"model.layers.22.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
183 |
+
"model.layers.22.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
184 |
+
"model.layers.23.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
185 |
+
"model.layers.23.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
186 |
+
"model.layers.23.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
187 |
+
"model.layers.23.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
188 |
+
"model.layers.23.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
189 |
+
"model.layers.23.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
190 |
+
"model.layers.23.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
191 |
+
"model.layers.23.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
192 |
+
"model.layers.23.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
193 |
+
"model.layers.23.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
194 |
+
"model.layers.23.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
195 |
+
"model.layers.24.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
196 |
+
"model.layers.24.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
197 |
+
"model.layers.24.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
198 |
+
"model.layers.24.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
199 |
+
"model.layers.24.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
200 |
+
"model.layers.24.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
201 |
+
"model.layers.24.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
202 |
+
"model.layers.24.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
203 |
+
"model.layers.24.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
204 |
+
"model.layers.24.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
205 |
+
"model.layers.24.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
206 |
+
"model.layers.25.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
207 |
+
"model.layers.25.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
208 |
+
"model.layers.25.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
209 |
+
"model.layers.25.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
210 |
+
"model.layers.25.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
211 |
+
"model.layers.25.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
212 |
+
"model.layers.25.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
213 |
+
"model.layers.25.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
214 |
+
"model.layers.25.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
215 |
+
"model.layers.25.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
216 |
+
"model.layers.25.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
217 |
+
"model.layers.26.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
218 |
+
"model.layers.26.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
219 |
+
"model.layers.26.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
220 |
+
"model.layers.26.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
221 |
+
"model.layers.26.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
222 |
+
"model.layers.26.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
223 |
+
"model.layers.26.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
224 |
+
"model.layers.26.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
225 |
+
"model.layers.26.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
226 |
+
"model.layers.26.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
227 |
+
"model.layers.26.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
228 |
+
"model.layers.27.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
229 |
+
"model.layers.27.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
230 |
+
"model.layers.27.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
231 |
+
"model.layers.27.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
232 |
+
"model.layers.27.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
233 |
+
"model.layers.27.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
234 |
+
"model.layers.27.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
235 |
+
"model.layers.27.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
236 |
+
"model.layers.27.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
237 |
+
"model.layers.27.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
238 |
+
"model.layers.27.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
239 |
+
"model.layers.28.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
240 |
+
"model.layers.28.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
241 |
+
"model.layers.28.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
242 |
+
"model.layers.28.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
243 |
+
"model.layers.28.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
244 |
+
"model.layers.28.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
245 |
+
"model.layers.28.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
246 |
+
"model.layers.28.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
247 |
+
"model.layers.28.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
248 |
+
"model.layers.28.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
249 |
+
"model.layers.28.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
250 |
+
"model.layers.29.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
251 |
+
"model.layers.29.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
252 |
+
"model.layers.29.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
253 |
+
"model.layers.29.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
254 |
+
"model.layers.29.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
255 |
+
"model.layers.29.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
256 |
+
"model.layers.29.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
257 |
+
"model.layers.29.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
258 |
+
"model.layers.29.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
259 |
+
"model.layers.29.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
260 |
+
"model.layers.29.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
261 |
+
"model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
262 |
+
"model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
263 |
+
"model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
264 |
+
"model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
265 |
+
"model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
266 |
+
"model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
267 |
+
"model.layers.3.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
268 |
+
"model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
269 |
+
"model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
270 |
+
"model.layers.3.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
271 |
+
"model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
272 |
+
"model.layers.30.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
273 |
+
"model.layers.30.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
274 |
+
"model.layers.30.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
275 |
+
"model.layers.30.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
276 |
+
"model.layers.30.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
277 |
+
"model.layers.30.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
278 |
+
"model.layers.30.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
279 |
+
"model.layers.30.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
280 |
+
"model.layers.30.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
281 |
+
"model.layers.30.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
282 |
+
"model.layers.30.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
283 |
+
"model.layers.31.input_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
284 |
+
"model.layers.31.mlp.down_proj.weight": "pytorch_model-00002-of-00002.bin",
|
285 |
+
"model.layers.31.mlp.gate_proj.weight": "pytorch_model-00002-of-00002.bin",
|
286 |
+
"model.layers.31.mlp.up_proj.weight": "pytorch_model-00002-of-00002.bin",
|
287 |
+
"model.layers.31.post_attention_layernorm.weight": "pytorch_model-00002-of-00002.bin",
|
288 |
+
"model.layers.31.self_attn.k_proj.weight": "pytorch_model-00002-of-00002.bin",
|
289 |
+
"model.layers.31.self_attn.o_proj.bias": "pytorch_model-00002-of-00002.bin",
|
290 |
+
"model.layers.31.self_attn.o_proj.weight": "pytorch_model-00002-of-00002.bin",
|
291 |
+
"model.layers.31.self_attn.q_proj.weight": "pytorch_model-00002-of-00002.bin",
|
292 |
+
"model.layers.31.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00002.bin",
|
293 |
+
"model.layers.31.self_attn.v_proj.weight": "pytorch_model-00002-of-00002.bin",
|
294 |
+
"model.layers.4.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
295 |
+
"model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
296 |
+
"model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
297 |
+
"model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
298 |
+
"model.layers.4.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
299 |
+
"model.layers.4.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
300 |
+
"model.layers.4.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
301 |
+
"model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
302 |
+
"model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
303 |
+
"model.layers.4.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
304 |
+
"model.layers.4.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
305 |
+
"model.layers.5.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
306 |
+
"model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
307 |
+
"model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
308 |
+
"model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
309 |
+
"model.layers.5.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
310 |
+
"model.layers.5.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
311 |
+
"model.layers.5.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
312 |
+
"model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
313 |
+
"model.layers.5.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
314 |
+
"model.layers.5.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
315 |
+
"model.layers.5.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
316 |
+
"model.layers.6.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
317 |
+
"model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
318 |
+
"model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
319 |
+
"model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
320 |
+
"model.layers.6.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
321 |
+
"model.layers.6.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
322 |
+
"model.layers.6.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
323 |
+
"model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
324 |
+
"model.layers.6.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
325 |
+
"model.layers.6.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
326 |
+
"model.layers.6.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
327 |
+
"model.layers.7.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
328 |
+
"model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
329 |
+
"model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
330 |
+
"model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
331 |
+
"model.layers.7.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
332 |
+
"model.layers.7.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
333 |
+
"model.layers.7.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
334 |
+
"model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
335 |
+
"model.layers.7.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
336 |
+
"model.layers.7.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
337 |
+
"model.layers.7.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
338 |
+
"model.layers.8.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
339 |
+
"model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
340 |
+
"model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
341 |
+
"model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
342 |
+
"model.layers.8.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
343 |
+
"model.layers.8.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
344 |
+
"model.layers.8.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
345 |
+
"model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
346 |
+
"model.layers.8.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
347 |
+
"model.layers.8.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
348 |
+
"model.layers.8.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
349 |
+
"model.layers.9.input_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
350 |
+
"model.layers.9.mlp.down_proj.weight": "pytorch_model-00001-of-00002.bin",
|
351 |
+
"model.layers.9.mlp.gate_proj.weight": "pytorch_model-00001-of-00002.bin",
|
352 |
+
"model.layers.9.mlp.up_proj.weight": "pytorch_model-00001-of-00002.bin",
|
353 |
+
"model.layers.9.post_attention_layernorm.weight": "pytorch_model-00001-of-00002.bin",
|
354 |
+
"model.layers.9.self_attn.k_proj.weight": "pytorch_model-00001-of-00002.bin",
|
355 |
+
"model.layers.9.self_attn.o_proj.bias": "pytorch_model-00001-of-00002.bin",
|
356 |
+
"model.layers.9.self_attn.o_proj.weight": "pytorch_model-00001-of-00002.bin",
|
357 |
+
"model.layers.9.self_attn.q_proj.weight": "pytorch_model-00001-of-00002.bin",
|
358 |
+
"model.layers.9.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00002.bin",
|
359 |
+
"model.layers.9.self_attn.v_proj.weight": "pytorch_model-00001-of-00002.bin",
|
360 |
+
"model.norm.weight": "pytorch_model-00002-of-00002.bin"
|
361 |
+
}
|
362 |
+
}
|