LoneStriker
commited on
Commit
•
b255944
1
Parent(s):
6ebe680
Upload folder using huggingface_hub
Browse files- BAAI-Aquila-Model-License-Agreement.pdf +0 -0
- README.md +47 -0
- README_zh.md +50 -0
- config.json +25 -0
- configuration_aquila.py +128 -0
- generation_config.json +7 -0
- huggingface-metadata.txt +86 -0
- log.jpeg +0 -0
- modeling_aquila.py +1146 -0
- output-00001-of-00003.safetensors +3 -0
- output-00002-of-00003.safetensors +3 -0
- output-00003-of-00003.safetensors +3 -0
- predict.py +475 -0
- pytorch_model.bin.index.json +810 -0
- special_tokens_map.json +6 -0
- tokenizer.json +0 -0
- tokenizer_config.json +9 -0
- vocab.json +0 -0
BAAI-Aquila-Model-License-Agreement.pdf
ADDED
Binary file (227 kB). View file
|
|
README.md
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
---
|
4 |
+
|
5 |
+
|
6 |
+
![Aquila_logo](./log.jpeg)
|
7 |
+
|
8 |
+
|
9 |
+
<h4 align="center">
|
10 |
+
<p>
|
11 |
+
<b>English</b> |
|
12 |
+
<a href="https://huggingface.co/BAAI/AquilaChat2-70B-Expr/blob/main/README_zh.md">简体中文</a>
|
13 |
+
</p>
|
14 |
+
</h4>
|
15 |
+
|
16 |
+
|
17 |
+
We opensource our **Aquila2** series, now including **Aquila2**, the base language models, namely **Aquila2-7B**, **Aquila2-34B** and **Aquila2-70B-Expr** , as well as **AquilaChat2**, the chat models, namely **AquilaChat2-7B**, **AquilaChat2-34B** and **AquilaChat2-70B-Expr**, as well as the long-text chat models, namely **AquilaChat2-7B-16k** and **AquilaChat2-34B-16k**
|
18 |
+
|
19 |
+
The additional details of the Aquila model will be presented in the official technical report. Please stay tuned for updates on official channels.
|
20 |
+
|
21 |
+
## Quick Start
|
22 |
+
|
23 |
+
### 1. Inference
|
24 |
+
|
25 |
+
```python
|
26 |
+
import torch
|
27 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
28 |
+
from transformers import BitsAndBytesConfig
|
29 |
+
|
30 |
+
model_info = "BAAI/Aquila2-70B-Expr"
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
|
32 |
+
model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True)
|
33 |
+
model.eval()
|
34 |
+
text = "请给出10个要到北京旅游的理由。"
|
35 |
+
tokens = tokenizer.encode_plus(text)['input_ids']
|
36 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
37 |
+
stop_tokens = ["###", "[UNK]", "</s>"]
|
38 |
+
with torch.no_grad():
|
39 |
+
out = model.generate(tokens, do_sample=True, max_length=512, eos_token_id=100007, bad_words_ids=[[tokenizer.encode(token)[0] for token in stop_tokens]])[0]
|
40 |
+
out = tokenizer.decode(out.cpu().numpy().tolist())
|
41 |
+
print(out)
|
42 |
+
```
|
43 |
+
|
44 |
+
|
45 |
+
## License
|
46 |
+
|
47 |
+
Aquila2 series open-source model is licensed under [ BAAI Aquila Model Licence Agreement](https://huggingface.co/BAAI/Aquila2-70B-Expr/blob/main/BAAI-Aquila-Model-License-Agreement.pdf)
|
README_zh.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
---
|
4 |
+
|
5 |
+
|
6 |
+
![Aquila_logo](./log.jpeg)
|
7 |
+
|
8 |
+
|
9 |
+
<h4 align="center">
|
10 |
+
<p>
|
11 |
+
<a href="https://huggingface.co/BAAI/Aquila2-70B-Expr/blob/main/README.md">English</a>
|
12 |
+
<b>简体中文</b> |
|
13 |
+
</p>
|
14 |
+
</h4>
|
15 |
+
|
16 |
+
# 悟道·天鹰(Aquila2)
|
17 |
+
|
18 |
+
我们开源了我们的 **Aquila2** 系列,现在包括基础语言模型 **Aquila2-7B**,**Aquila2-34B** 和 **Aquila2-70B-Expr** ,对话模型 **AquilaChat2-7B**,**AquilaChat2-34B** 和**AquilaChat2-70B-Expr** ,长文本对话模型**AquilaChat2-7B-16k** 和 **AquilaChat2-34B-16k**
|
19 |
+
|
20 |
+
悟道 · 天鹰 Aquila 模型的更多细节将在官方技术报告中呈现。请关注官方渠道更新。
|
21 |
+
|
22 |
+
## 快速开始使用
|
23 |
+
|
24 |
+
## 使用方式/How to use
|
25 |
+
|
26 |
+
### 1. 推理/Inference
|
27 |
+
|
28 |
+
```python
|
29 |
+
import torch
|
30 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
31 |
+
from transformers import BitsAndBytesConfig
|
32 |
+
|
33 |
+
model_info = "BAAI/Aquila2-70B-Expr"
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
|
35 |
+
model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True)
|
36 |
+
model.eval()
|
37 |
+
text = "请给出10个要到北京旅游的理由。"
|
38 |
+
tokens = tokenizer.encode_plus(text)['input_ids']
|
39 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
40 |
+
stop_tokens = ["###", "[UNK]", "</s>"]
|
41 |
+
with torch.no_grad():
|
42 |
+
out = model.generate(tokens, do_sample=True, max_length=512, eos_token_id=100007, bad_words_ids=[[tokenizer.encode(token)[0] for token in stop_tokens]])[0]
|
43 |
+
out = tokenizer.decode(out.cpu().numpy().tolist())
|
44 |
+
print(out)
|
45 |
+
```
|
46 |
+
|
47 |
+
|
48 |
+
## 证书/License
|
49 |
+
|
50 |
+
Aquila2系列开源模型使用 [智源Aquila系列模型许可协议](https://huggingface.co/BAAI/Aquila2-70B-Expr/blob/main/BAAI-Aquila-Model-License-Agreement.pdf)
|
config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"AquilaForCausalLM"
|
4 |
+
],
|
5 |
+
"bos_token_id": 100006,
|
6 |
+
"eos_token_id": 100007,
|
7 |
+
"hidden_act": "silu",
|
8 |
+
"hidden_size": 8192,
|
9 |
+
"initializer_range": 0.02,
|
10 |
+
"intermediate_size": 28672,
|
11 |
+
"max_position_embeddings": 4096,
|
12 |
+
"model_type": "aquila",
|
13 |
+
"num_attention_heads": 64,
|
14 |
+
"num_hidden_layers": 80,
|
15 |
+
"num_key_value_heads": 8,
|
16 |
+
"pad_token_id": 0,
|
17 |
+
"pretraining_tp": 1,
|
18 |
+
"rms_norm_eps": 1e-05,
|
19 |
+
"rope_scaling": null,
|
20 |
+
"tie_word_embeddings": false,
|
21 |
+
"torch_dtype": "bfloat16",
|
22 |
+
"transformers_version": "4.31.0",
|
23 |
+
"use_cache": true,
|
24 |
+
"vocab_size": 100008
|
25 |
+
}
|
configuration_aquila.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 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 |
+
""" Aquila model configuration"""
|
21 |
+
|
22 |
+
from transformers import PretrainedConfig
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
class AquilaConfig(PretrainedConfig):
|
27 |
+
r"""
|
28 |
+
This is the configuration class to store the configuration of a [`AquilaModel`]. It is used to instantiate an Aquila
|
29 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
30 |
+
defaults will yield a similar configuration to that of the Aquila-7B.
|
31 |
+
|
32 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
33 |
+
documentation from [`PretrainedConfig`] for more information.
|
34 |
+
|
35 |
+
|
36 |
+
Args:
|
37 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
38 |
+
Vocabulary size of the Aquila model. Defines the number of different tokens that can be represented by the
|
39 |
+
`inputs_ids` passed when calling [`AquilaModel`]
|
40 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
41 |
+
Dimension of the hidden representations.
|
42 |
+
intermediate_size (`int`, *optional*, defaults to 11008):
|
43 |
+
Dimension of the MLP representations.
|
44 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
45 |
+
Number of hidden layers in the Transformer encoder.
|
46 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
48 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
49 |
+
The non-linear activation function (function or string) in the decoder.
|
50 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
51 |
+
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
52 |
+
just in case (e.g., 512 or 1024 or 2048).
|
53 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
54 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
55 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-12):
|
56 |
+
The epsilon used by the rms normalization layers.
|
57 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
58 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
59 |
+
relevant if `config.is_decoder=True`.
|
60 |
+
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
|
61 |
+
Whether to tie weight embeddings
|
62 |
+
Example:
|
63 |
+
|
64 |
+
```python
|
65 |
+
>>> from transformers import AquilaModel, AquilaConfig
|
66 |
+
|
67 |
+
>>> # Initializing a Aquila aquila-7b style configuration
|
68 |
+
>>> configuration = AquilaConfig()
|
69 |
+
|
70 |
+
>>> # Initializing a model from the aquila-7b style configuration
|
71 |
+
>>> model = AquilaModel(configuration)
|
72 |
+
|
73 |
+
>>> # Accessing the model configuration
|
74 |
+
>>> configuration = model.config
|
75 |
+
```"""
|
76 |
+
model_type = "aquila"
|
77 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
78 |
+
|
79 |
+
def __init__(
|
80 |
+
self,
|
81 |
+
vocab_size=100008,
|
82 |
+
hidden_size=4096,
|
83 |
+
intermediate_size=11008,
|
84 |
+
num_hidden_layers=32,
|
85 |
+
num_attention_heads=32,
|
86 |
+
num_key_value_heads=None,
|
87 |
+
hidden_act="silu",
|
88 |
+
max_position_embeddings=2048,
|
89 |
+
initializer_range=0.02,
|
90 |
+
rms_norm_eps=1e-6,
|
91 |
+
use_cache=True,
|
92 |
+
pad_token_id=0,
|
93 |
+
bos_token_id=1,
|
94 |
+
eos_token_id=2,
|
95 |
+
pretraining_tp=1,
|
96 |
+
tie_word_embeddings=False,
|
97 |
+
rope_theta=10000.0,
|
98 |
+
rope_scaling=None,
|
99 |
+
**kwargs,
|
100 |
+
):
|
101 |
+
self.vocab_size = vocab_size
|
102 |
+
self.max_position_embeddings = max_position_embeddings
|
103 |
+
self.hidden_size = hidden_size
|
104 |
+
self.intermediate_size = intermediate_size
|
105 |
+
self.num_hidden_layers = num_hidden_layers
|
106 |
+
|
107 |
+
# for backward compatibility
|
108 |
+
if num_key_value_heads is None:
|
109 |
+
num_key_value_heads = num_attention_heads
|
110 |
+
|
111 |
+
self.num_key_value_heads = num_key_value_heads
|
112 |
+
|
113 |
+
self.num_attention_heads = num_attention_heads
|
114 |
+
self.hidden_act = hidden_act
|
115 |
+
self.initializer_range = initializer_range
|
116 |
+
self.rms_norm_eps = rms_norm_eps
|
117 |
+
self.pretraining_tp = pretraining_tp
|
118 |
+
self.use_cache = use_cache
|
119 |
+
self.rope_theta = rope_theta
|
120 |
+
self.rope_scaling = rope_scaling
|
121 |
+
|
122 |
+
super().__init__(
|
123 |
+
pad_token_id=pad_token_id,
|
124 |
+
bos_token_id=bos_token_id,
|
125 |
+
eos_token_id=eos_token_id,
|
126 |
+
tie_word_embeddings=tie_word_embeddings,
|
127 |
+
**kwargs,
|
128 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 100006,
|
4 |
+
"eos_token_id": 100007,
|
5 |
+
"pad_token_id": 0,
|
6 |
+
"transformers_version": "4.31.0"
|
7 |
+
}
|
huggingface-metadata.txt
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
url: https://huggingface.co/BAAI/Aquila2-70B-Expr
|
2 |
+
branch: main
|
3 |
+
download date: 2023-11-30 15:21:24
|
4 |
+
sha256sum:
|
5 |
+
8f96f3093f76082311ea1912427d9a6218577202073a18dcb51f1e9aa3df54cf pytorch_model-00001-of-00082.bin
|
6 |
+
b63956f2042fe23e19257957a0cc15ac07d70ee0d9a445e70a98d5bbb9fcf3da pytorch_model-00002-of-00082.bin
|
7 |
+
e3237e3735d1a0b5310a61401d28d255cfd003268853305008de390fb7944f78 pytorch_model-00003-of-00082.bin
|
8 |
+
2d653923a37402c77bbd28d9e17ad965eb71547e273e0070ffd46c17d529f754 pytorch_model-00004-of-00082.bin
|
9 |
+
ef33757e5603c3000d759a9ca9434c49cb7c959d875f7dc544037f4e3f8535df pytorch_model-00005-of-00082.bin
|
10 |
+
47a8087d6e242dcedd07d0f1b587fefea7dee0c15cedb8e51148d2fb2a0ab0bd pytorch_model-00006-of-00082.bin
|
11 |
+
e6cb64f486453fa0b0b542ad4a0abe6efff4eb37c9a0667c58dde75db5d82557 pytorch_model-00007-of-00082.bin
|
12 |
+
70d8d170e08b0279800e3c3e2c9c881b077baa67dc27bc3e03dc90dbebf3a858 pytorch_model-00008-of-00082.bin
|
13 |
+
b5afbff759ede35b0486dee907331b0a225ec3b1046f4329ea86175de0fd66fe pytorch_model-00009-of-00082.bin
|
14 |
+
5341f7ab124dab5207fb47c675f4ac5d16aa1836398ba3c14403b32529cf81c3 pytorch_model-00010-of-00082.bin
|
15 |
+
a7d4e73ec7e816647bdc5bfce38b183325285cc4f35297767547e9cffbe13b76 pytorch_model-00011-of-00082.bin
|
16 |
+
1e84f68b52bd984faa71e25f28c866f830995a5fa8817297b3d36b283df57d23 pytorch_model-00012-of-00082.bin
|
17 |
+
71a41f02b87b6853395086590f356f40760ad430f6e321280dd0f99bfe0378b6 pytorch_model-00013-of-00082.bin
|
18 |
+
edd008264cfbdb30e70e86b2cb6db5593be091de8d6747a4f4c31ec71be32136 pytorch_model-00014-of-00082.bin
|
19 |
+
74044181edea6b3e2a760d0a68058c1c98381ea3018abbff1c8140f816730322 pytorch_model-00015-of-00082.bin
|
20 |
+
665f19feebeb1b080c71cedca92579a4220f8f2fe5f386d54b5f034f8e3236e6 pytorch_model-00016-of-00082.bin
|
21 |
+
1647448e7616692874457f01a3d0cd0d1f1763348bfc79cf80e4f240a21b5bfc pytorch_model-00017-of-00082.bin
|
22 |
+
74f0efb8b70c923e1b277e78f2cb2fcd7996662159195e4085a420ee78e2feef pytorch_model-00018-of-00082.bin
|
23 |
+
1338024a596922c968c4588ffbd466b3026e92c3c927094859bfc6772e789190 pytorch_model-00019-of-00082.bin
|
24 |
+
64fa4e0a3922455979c23df8c976e6e20d245d744471ff34f41c550718329fcc pytorch_model-00020-of-00082.bin
|
25 |
+
a7d9da7ec8d3ed925b9f7a3dcea2f6d6c8aafef6acdaf2c0fe11b9d9080fbf96 pytorch_model-00021-of-00082.bin
|
26 |
+
413420444e15bc6c837cd94cb3651fcae0a5653dd728950f135b745866b9285a pytorch_model-00022-of-00082.bin
|
27 |
+
688e740dd262e62eab9c8ec13db48ca146627e6ad6559956b2390bad6c6d5524 pytorch_model-00023-of-00082.bin
|
28 |
+
d2f919d80355f82ffbff8e75befd19857ce1edf495575b8595458bc797e59d94 pytorch_model-00024-of-00082.bin
|
29 |
+
64139884fb7d0e8832c4ca17e8a8aab134294db03b2ed6fb64299c8cf7a6648a pytorch_model-00025-of-00082.bin
|
30 |
+
908456cd52ac23313140d1c2746c8f7f7111f0068065bd5d023041b1da1c043d pytorch_model-00026-of-00082.bin
|
31 |
+
7d94bd3cff8baa0c28f9001cd2cfa79db36e5d71db0740e066241f5ab5a20217 pytorch_model-00027-of-00082.bin
|
32 |
+
8645d7d7e5ffc0f90285c3b588b5caadb07a26001bafc3ed7e9e1f3c5b376d78 pytorch_model-00028-of-00082.bin
|
33 |
+
ed6201c3648eb6c20cc3f77e33943e3b8de3bde73a3b1166e3d10b7f9c89c7a9 pytorch_model-00029-of-00082.bin
|
34 |
+
b2e0a0512fcc5061e47119c42e5a7b9f952d9eda3b374729d2eaf905e45d5cfb pytorch_model-00030-of-00082.bin
|
35 |
+
d857c778282753a6903f3ba5dfce9c45943e7c6b2e6752e701d59e64aac43402 pytorch_model-00031-of-00082.bin
|
36 |
+
6b011d859e563ba5fcc82da7f61b7a3a634f413e086feb350fa788b1d8474df3 pytorch_model-00032-of-00082.bin
|
37 |
+
085e45f87bd9d329280934ac65b4a878b50b0d6efece96edd6a698930784d29b pytorch_model-00033-of-00082.bin
|
38 |
+
c1f4708779c5cb4314bc88e1269623c24f921f503fcbabea5a466a2026d9bbf6 pytorch_model-00034-of-00082.bin
|
39 |
+
295117fa92fe643534d3e36804bc4ffaaf4cf0b6ee8f40c1a1c2288d554d8cb8 pytorch_model-00035-of-00082.bin
|
40 |
+
d47f9f1662220de7546ca3d4249788ed07172ede0b9c513e2154691fb3b46ee0 pytorch_model-00036-of-00082.bin
|
41 |
+
09078e9009c1f6a937f63b12540a22c750b1e8a0f9ca773ed463949b0804d99c pytorch_model-00037-of-00082.bin
|
42 |
+
90cf080d32bfb921c4d94701f795aa15ad0da5df5f2dc27c68266f1c5324a9a0 pytorch_model-00038-of-00082.bin
|
43 |
+
eae206f6796d1241ffbed956354a2ae9f8ce133b88dfa699de278f6ca7f9c19d pytorch_model-00039-of-00082.bin
|
44 |
+
5376bbb81bc343ba4f141cc33c153285e99608d4ef841f891a3195604c3200a0 pytorch_model-00040-of-00082.bin
|
45 |
+
2befa2a635e16a40222780735a3462a3d4688a09bea79e37551fcd20d38afe34 pytorch_model-00041-of-00082.bin
|
46 |
+
ba0913841c97c5068a1dd9d77cc5349db56c3eb74adb1e4aaec86038a7fb6130 pytorch_model-00042-of-00082.bin
|
47 |
+
a48322adedd398c9332c690053334bcfd5ac899657c308ccb0211af200fac7d1 pytorch_model-00043-of-00082.bin
|
48 |
+
d564119e03706a15e4af36ae1c819c4ea677a0fcab17a0cf0798f852c5526654 pytorch_model-00044-of-00082.bin
|
49 |
+
5413ece30b057d2120db396a063bb717ed41ebcd87456e10b7dfeac7cc4a0fc5 pytorch_model-00045-of-00082.bin
|
50 |
+
755c4ed92688545864533360f9525fe22e1aca5a5e874ed305a77c16e1c88f06 pytorch_model-00046-of-00082.bin
|
51 |
+
fec26d3764fd5b5cf0c3a9420e92b9fbf8fc934cffb68b6b1ddbfbb98a61b9ca pytorch_model-00047-of-00082.bin
|
52 |
+
86a3656ebd55b18e503d8c3be77cf4cbaf72eca3c655069f6204bf163209e3f8 pytorch_model-00048-of-00082.bin
|
53 |
+
66a971a3652da2ce539d3322225d6f547b4dccf499ab278ca398e4bbfd8f034d pytorch_model-00049-of-00082.bin
|
54 |
+
cb1e8f0c0defcc9e2e595981a1dd2ccc1d94faa1c14365095ef7c046e6acc9ce pytorch_model-00050-of-00082.bin
|
55 |
+
0ad3d9811bac6de69cf62dca58435e534723d73c6cbbb85f37437cc28885532d pytorch_model-00051-of-00082.bin
|
56 |
+
2c7bf71606d4887cf5fa19d89db203c693963797aec946506942dc99ea2ec7bb pytorch_model-00052-of-00082.bin
|
57 |
+
ce981f93c771be4ac9fb6e9f004b91d60648dab14f19dbd443f9109a111e9259 pytorch_model-00053-of-00082.bin
|
58 |
+
d9e665bb7dddb64f5ba273f2c7081422d4ce63a1b222b5bdd52af804e64144b5 pytorch_model-00054-of-00082.bin
|
59 |
+
32aef820129b196582de29485f6dde4cdcad4912f508c72a0a4fd96b6551ac3a pytorch_model-00055-of-00082.bin
|
60 |
+
f6bf87667052183055a7355b37bbb5a27cbc179eab84324f20c074216e153eda pytorch_model-00056-of-00082.bin
|
61 |
+
18bdfb14f4bd994e8326a3f7f46f26d4b74fb86d1cde101e5e1db70368a2a237 pytorch_model-00057-of-00082.bin
|
62 |
+
937ca1028e9bdb027597941c291932a53cd542507f178631f57b9b5613dd31fa pytorch_model-00058-of-00082.bin
|
63 |
+
6982058011a7c37f2b62ba77cf88f0e85b165349275f0c0a3d5455c959ffd28a pytorch_model-00059-of-00082.bin
|
64 |
+
8555c47072aae39be1555f8b5978b9d283ad06e8522f25373437679932b46b69 pytorch_model-00060-of-00082.bin
|
65 |
+
08d8f4b366c80a635b4630df1fad47f3ced3cb1aeb5b3e0245b0c49908816e23 pytorch_model-00061-of-00082.bin
|
66 |
+
3655b9020ed244df565f8a0a75f07244ef63f0ff47606e48e74cc335371724bc pytorch_model-00062-of-00082.bin
|
67 |
+
96cce529716c4fcbc2ea9fe6f2d0d9cbfc1a086c6b3bea1cbb6c13202e74390b pytorch_model-00063-of-00082.bin
|
68 |
+
b3204806d0c2eff3d05412689bcbf1c1080de880b3e3cce3a2f39f82706b8507 pytorch_model-00064-of-00082.bin
|
69 |
+
0604041fa9ab92166a464877f32a6227a2012903d8cb1b9244938cf8b6955791 pytorch_model-00065-of-00082.bin
|
70 |
+
8623d48d235d111b5744c47691c59ff54342e5564cc6ee0bd80c55f2b39b0200 pytorch_model-00066-of-00082.bin
|
71 |
+
ba421cd767ddfeeffbbd4ddd1c4cfbc565de1ec287addea28c0ae21ca83c1361 pytorch_model-00067-of-00082.bin
|
72 |
+
c9a01342d1cf511fecf4c30bd3e663e21e1541e434ed77d8fe97d2a3c09bb47a pytorch_model-00068-of-00082.bin
|
73 |
+
cd783c71100b7757e1dfbd8a583873e51f0bb9684f8372b5892c3bbd8d1db85d pytorch_model-00069-of-00082.bin
|
74 |
+
21b3c0decc8fae6762353ac158ae049e0f492ccf0c5d132e3e43ea469e001c74 pytorch_model-00070-of-00082.bin
|
75 |
+
8938b65e742f4790a65bc39084e92fb59b596675e0f9ed3dfc31c4cd3f60012f pytorch_model-00071-of-00082.bin
|
76 |
+
6114cc0e85060669b71ada97dc9034bcd9b1782752e68f842ac51bdcec5d72b4 pytorch_model-00072-of-00082.bin
|
77 |
+
763c73cd10bb8458f09010a440230b0f9b39e09dde51f921f070598e0d8d4b7b pytorch_model-00073-of-00082.bin
|
78 |
+
d61ddc2e5fb46bd20b06809339389aeffdd1d7fd587de7440ed7e51918bbdd85 pytorch_model-00074-of-00082.bin
|
79 |
+
0cdc96766f51e1343c8b4bfad649fa91a0391b8dc0df1892ea5e1f4f5c8a8ec7 pytorch_model-00075-of-00082.bin
|
80 |
+
08b6ccdbb376b85f0233e4ac5e938dda2544d705ad7a0a918b147ab051131b49 pytorch_model-00076-of-00082.bin
|
81 |
+
3daba0754e20cf912ab40eafb931db591afea8d40422ce4ddcbbb8cb0b26ea36 pytorch_model-00077-of-00082.bin
|
82 |
+
ef08823a64d3a834aa9cca3764d72ea78b34155e2934667e66cdcaf4d1c65ba6 pytorch_model-00078-of-00082.bin
|
83 |
+
3b6a4406fe2650ff2900f613ae42a7a25620fcadd98ce9a411fd9a356acf6cee pytorch_model-00079-of-00082.bin
|
84 |
+
192f3dbdc196eade7715002379d1aac1b8e59e4e37741c5a5b04563b34446425 pytorch_model-00080-of-00082.bin
|
85 |
+
6eed903a25de3e95793b3326936f73ae849c3462448f5e9a869525c29ee504fe pytorch_model-00081-of-00082.bin
|
86 |
+
bc54a402233e8a221ed995a9a527bef14502cae8ff71bc43bd86fa2da35d91da pytorch_model-00082-of-00082.bin
|
log.jpeg
ADDED
modeling_aquila.py
ADDED
@@ -0,0 +1,1146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 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 Aquila 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 BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
28 |
+
|
29 |
+
from transformers.activations import ACT2FN
|
30 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
|
31 |
+
from transformers.modeling_utils import PreTrainedModel
|
32 |
+
from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
|
33 |
+
from .configuration_aquila import AquilaConfig
|
34 |
+
from transformers import (
|
35 |
+
LogitsProcessorList,
|
36 |
+
MinLengthLogitsProcessor,
|
37 |
+
TopKLogitsWarper,
|
38 |
+
TemperatureLogitsWarper,
|
39 |
+
TopPLogitsWarper,
|
40 |
+
StoppingCriteriaList,
|
41 |
+
MaxLengthCriteria,
|
42 |
+
BitsAndBytesConfig,
|
43 |
+
)
|
44 |
+
|
45 |
+
logger = logging.get_logger(__name__)
|
46 |
+
|
47 |
+
_CONFIG_FOR_DOC = "AquilaConfig"
|
48 |
+
|
49 |
+
|
50 |
+
# Copied from transformers.models.bart.modeling_bart._make_causal_mask
|
51 |
+
def _make_causal_mask(
|
52 |
+
input_ids_shape: torch.Size, dtype: torch.dtype, device: torch.device, past_key_values_length: int = 0
|
53 |
+
):
|
54 |
+
"""
|
55 |
+
Make causal mask used for bi-directional self-attention.
|
56 |
+
"""
|
57 |
+
bsz, tgt_len = input_ids_shape
|
58 |
+
mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min, device=device), device=device)
|
59 |
+
mask_cond = torch.arange(mask.size(-1), device=device)
|
60 |
+
mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
|
61 |
+
mask = mask.to(dtype)
|
62 |
+
|
63 |
+
if past_key_values_length > 0:
|
64 |
+
mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype, device=device), mask], dim=-1)
|
65 |
+
return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len + past_key_values_length)
|
66 |
+
|
67 |
+
|
68 |
+
# Copied from transformers.models.bart.modeling_bart._expand_mask
|
69 |
+
def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
|
70 |
+
"""
|
71 |
+
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
|
72 |
+
"""
|
73 |
+
bsz, src_len = mask.size()
|
74 |
+
tgt_len = tgt_len if tgt_len is not None else src_len
|
75 |
+
|
76 |
+
expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
|
77 |
+
|
78 |
+
inverted_mask = 1.0 - expanded_mask
|
79 |
+
|
80 |
+
return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min)
|
81 |
+
|
82 |
+
|
83 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaRMSNorm with Llama->Aquila
|
84 |
+
class AquilaRMSNorm(nn.Module):
|
85 |
+
def __init__(self, hidden_size, eps=1e-6):
|
86 |
+
"""
|
87 |
+
AquilaRMSNorm is equivalent to T5LayerNorm
|
88 |
+
"""
|
89 |
+
super().__init__()
|
90 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
91 |
+
self.variance_epsilon = eps
|
92 |
+
|
93 |
+
def forward(self, hidden_states):
|
94 |
+
input_dtype = hidden_states.dtype
|
95 |
+
variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True)
|
96 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
97 |
+
|
98 |
+
return (self.weight * hidden_states).to(input_dtype)
|
99 |
+
|
100 |
+
|
101 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaRotaryEmbedding with Llama->Aquila
|
102 |
+
class AquilaRotaryEmbedding(torch.nn.Module):
|
103 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
|
104 |
+
super().__init__()
|
105 |
+
|
106 |
+
self.dim = dim
|
107 |
+
self.max_position_embeddings = max_position_embeddings
|
108 |
+
self.base = base
|
109 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
110 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
111 |
+
|
112 |
+
# Build here to make `torch.jit.trace` work.
|
113 |
+
self._set_cos_sin_cache(
|
114 |
+
seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
|
115 |
+
)
|
116 |
+
|
117 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
118 |
+
self.max_seq_len_cached = seq_len
|
119 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
120 |
+
|
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)
|
124 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
125 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
126 |
+
|
127 |
+
def forward(self, x, seq_len=None):
|
128 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
129 |
+
if seq_len > self.max_seq_len_cached:
|
130 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
|
131 |
+
|
132 |
+
return (
|
133 |
+
self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
134 |
+
self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
135 |
+
)
|
136 |
+
|
137 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaLinearScalingRotaryEmbedding with Llama->Aquila
|
138 |
+
class AquilaLinearScalingRotaryEmbedding(AquilaRotaryEmbedding):
|
139 |
+
"""AquilaRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
|
140 |
+
|
141 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
142 |
+
self.scaling_factor = scaling_factor
|
143 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
144 |
+
|
145 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
146 |
+
self.max_seq_len_cached = seq_len
|
147 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
148 |
+
t = t / self.scaling_factor
|
149 |
+
|
150 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
151 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
152 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
153 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
154 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
155 |
+
|
156 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaDynamicNTKScalingRotaryEmbedding with Llama->Aquila
|
157 |
+
class AquilaDynamicNTKScalingRotaryEmbedding(AquilaRotaryEmbedding):
|
158 |
+
"""AquilaRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
|
159 |
+
|
160 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
|
161 |
+
self.scaling_factor = scaling_factor
|
162 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
163 |
+
|
164 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
165 |
+
self.max_seq_len_cached = seq_len
|
166 |
+
|
167 |
+
if seq_len > self.max_position_embeddings:
|
168 |
+
base = self.base * (
|
169 |
+
(self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
|
170 |
+
) ** (self.dim / (self.dim - 2))
|
171 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
172 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
173 |
+
|
174 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
|
175 |
+
|
176 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
177 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
178 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
179 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
180 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
181 |
+
|
182 |
+
|
183 |
+
def rotate_half(x):
|
184 |
+
"""Rotates half the hidden dims of the input."""
|
185 |
+
x1 = x[..., : x.shape[-1] // 2]
|
186 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
187 |
+
return torch.cat((-x2, x1), dim=-1)
|
188 |
+
|
189 |
+
|
190 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
191 |
+
# The first two dimensions of cos and sin are always 1, so we can `squeeze` them.
|
192 |
+
cos = cos.squeeze(1).squeeze(0) # [seq_len, dim]
|
193 |
+
sin = sin.squeeze(1).squeeze(0) # [seq_len, dim]
|
194 |
+
cos = cos[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
195 |
+
sin = sin[position_ids].unsqueeze(1) # [bs, 1, seq_len, dim]
|
196 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
197 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
198 |
+
return q_embed, k_embed
|
199 |
+
|
200 |
+
|
201 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaMLP with Llama->Aquila
|
202 |
+
class AquilaMLP(nn.Module):
|
203 |
+
def __init__(self, config):
|
204 |
+
super().__init__()
|
205 |
+
self.config = config
|
206 |
+
self.hidden_size = config.hidden_size
|
207 |
+
self.intermediate_size = config.intermediate_size
|
208 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
209 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
210 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
211 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
212 |
+
|
213 |
+
def forward(self, x):
|
214 |
+
if self.config.pretraining_tp > 1:
|
215 |
+
slice = self.intermediate_size // self.config.pretraining_tp
|
216 |
+
gate_proj_slices = self.gate_proj.weight.split(slice, dim=0)
|
217 |
+
up_proj_slices = self.up_proj.weight.split(slice, dim=0)
|
218 |
+
down_proj_slices = self.down_proj.weight.split(slice, dim=1)
|
219 |
+
|
220 |
+
gate_proj = torch.cat(
|
221 |
+
[F.linear(x, gate_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1
|
222 |
+
)
|
223 |
+
up_proj = torch.cat([F.linear(x, up_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
|
224 |
+
|
225 |
+
intermediate_states = (self.act_fn(gate_proj) * up_proj).split(slice, dim=2)
|
226 |
+
down_proj = [
|
227 |
+
F.linear(intermediate_states[i], down_proj_slices[i]) for i in range(self.config.pretraining_tp)
|
228 |
+
]
|
229 |
+
down_proj = sum(down_proj)
|
230 |
+
else:
|
231 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
232 |
+
|
233 |
+
return down_proj
|
234 |
+
|
235 |
+
|
236 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
237 |
+
"""
|
238 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
239 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
240 |
+
"""
|
241 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
242 |
+
if n_rep == 1:
|
243 |
+
return hidden_states
|
244 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
245 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
246 |
+
|
247 |
+
|
248 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaAttention with Llama->Aquila
|
249 |
+
class AquilaAttention(nn.Module):
|
250 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
251 |
+
def __init__(self, config: AquilaConfig):
|
252 |
+
super().__init__()
|
253 |
+
self.config = config
|
254 |
+
self.hidden_size = config.hidden_size
|
255 |
+
self.num_heads = config.num_attention_heads
|
256 |
+
self.head_dim = self.hidden_size // self.num_heads
|
257 |
+
self.num_key_value_heads = config.num_key_value_heads
|
258 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
259 |
+
self.max_position_embeddings = config.max_position_embeddings
|
260 |
+
self.rope_theta = config.rope_theta
|
261 |
+
|
262 |
+
if (self.head_dim * self.num_heads) != self.hidden_size:
|
263 |
+
raise ValueError(
|
264 |
+
f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
|
265 |
+
f" and `num_heads`: {self.num_heads})."
|
266 |
+
)
|
267 |
+
self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
|
268 |
+
self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
|
269 |
+
self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
|
270 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
|
271 |
+
self._init_rope()
|
272 |
+
|
273 |
+
def _init_rope(self):
|
274 |
+
if self.config.rope_scaling is None:
|
275 |
+
self.rotary_emb = AquilaRotaryEmbedding(
|
276 |
+
self.head_dim,
|
277 |
+
max_position_embeddings=self.max_position_embeddings,
|
278 |
+
base=self.rope_theta,
|
279 |
+
)
|
280 |
+
else:
|
281 |
+
scaling_type = self.config.rope_scaling["type"]
|
282 |
+
scaling_factor = self.config.rope_scaling["factor"]
|
283 |
+
if scaling_type == "linear":
|
284 |
+
self.rotary_emb = AquilaLinearScalingRotaryEmbedding(
|
285 |
+
self.head_dim,
|
286 |
+
max_position_embeddings=self.max_position_embeddings,
|
287 |
+
scaling_factor=scaling_factor,
|
288 |
+
base=self.rope_theta,
|
289 |
+
)
|
290 |
+
elif scaling_type == "dynamic":
|
291 |
+
self.rotary_emb = AquilaDynamicNTKScalingRotaryEmbedding(
|
292 |
+
self.head_dim,
|
293 |
+
max_position_embeddings=self.max_position_embeddings,
|
294 |
+
scaling_factor=scaling_factor,
|
295 |
+
base=self.rope_theta,
|
296 |
+
)
|
297 |
+
else:
|
298 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
299 |
+
|
300 |
+
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
|
301 |
+
return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
302 |
+
|
303 |
+
def forward(
|
304 |
+
self,
|
305 |
+
hidden_states: torch.Tensor,
|
306 |
+
attention_mask: Optional[torch.Tensor] = None,
|
307 |
+
position_ids: Optional[torch.LongTensor] = None,
|
308 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
309 |
+
output_attentions: bool = False,
|
310 |
+
use_cache: bool = False,
|
311 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
312 |
+
bsz, q_len, _ = hidden_states.size()
|
313 |
+
|
314 |
+
if self.config.pretraining_tp > 1:
|
315 |
+
key_value_slicing = (self.num_key_value_heads * self.head_dim) // self.config.pretraining_tp
|
316 |
+
query_slices = self.q_proj.weight.split(
|
317 |
+
(self.num_heads * self.head_dim) // self.config.pretraining_tp, dim=0
|
318 |
+
)
|
319 |
+
key_slices = self.k_proj.weight.split(key_value_slicing, dim=0)
|
320 |
+
value_slices = self.v_proj.weight.split(key_value_slicing, dim=0)
|
321 |
+
|
322 |
+
query_states = [F.linear(hidden_states, query_slices[i]) for i in range(self.config.pretraining_tp)]
|
323 |
+
query_states = torch.cat(query_states, dim=-1)
|
324 |
+
|
325 |
+
key_states = [F.linear(hidden_states, key_slices[i]) for i in range(self.config.pretraining_tp)]
|
326 |
+
key_states = torch.cat(key_states, dim=-1)
|
327 |
+
|
328 |
+
value_states = [F.linear(hidden_states, value_slices[i]) for i in range(self.config.pretraining_tp)]
|
329 |
+
value_states = torch.cat(value_states, dim=-1)
|
330 |
+
|
331 |
+
else:
|
332 |
+
query_states = self.q_proj(hidden_states)
|
333 |
+
key_states = self.k_proj(hidden_states)
|
334 |
+
value_states = self.v_proj(hidden_states)
|
335 |
+
|
336 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
337 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
338 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
339 |
+
|
340 |
+
kv_seq_len = key_states.shape[-2]
|
341 |
+
if past_key_value is not None:
|
342 |
+
kv_seq_len += past_key_value[0].shape[-2]
|
343 |
+
cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
344 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
345 |
+
|
346 |
+
if past_key_value is not None:
|
347 |
+
# reuse k, v, self_attention
|
348 |
+
key_states = torch.cat([past_key_value[0], key_states], dim=2)
|
349 |
+
value_states = torch.cat([past_key_value[1], value_states], dim=2)
|
350 |
+
|
351 |
+
past_key_value = (key_states, value_states) if use_cache else None
|
352 |
+
|
353 |
+
# repeat k/v heads if n_kv_heads < n_heads
|
354 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
355 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
356 |
+
|
357 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
|
358 |
+
attn_weights = torch.clamp(attn_weights, min=-1024., max=1024.)
|
359 |
+
if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
|
360 |
+
raise ValueError(
|
361 |
+
f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
|
362 |
+
f" {attn_weights.size()}"
|
363 |
+
)
|
364 |
+
|
365 |
+
if attention_mask is not None:
|
366 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
367 |
+
raise ValueError(
|
368 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
369 |
+
)
|
370 |
+
attn_weights = attn_weights + attention_mask
|
371 |
+
|
372 |
+
# upcast attention to fp32
|
373 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
|
374 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
375 |
+
|
376 |
+
if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
|
377 |
+
raise ValueError(
|
378 |
+
f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
|
379 |
+
f" {attn_output.size()}"
|
380 |
+
)
|
381 |
+
|
382 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
383 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
|
384 |
+
|
385 |
+
if self.config.pretraining_tp > 1:
|
386 |
+
attn_output = attn_output.split(self.hidden_size // self.config.pretraining_tp, dim=2)
|
387 |
+
o_proj_slices = self.o_proj.weight.split(self.hidden_size // self.config.pretraining_tp, dim=1)
|
388 |
+
attn_output = sum([F.linear(attn_output[i], o_proj_slices[i]) for i in range(self.config.pretraining_tp)])
|
389 |
+
else:
|
390 |
+
attn_output = self.o_proj(attn_output)
|
391 |
+
|
392 |
+
if not output_attentions:
|
393 |
+
attn_weights = None
|
394 |
+
|
395 |
+
return attn_output, attn_weights, past_key_value
|
396 |
+
|
397 |
+
|
398 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaDecoderLayer with Llama->Aquila
|
399 |
+
class AquilaDecoderLayer(nn.Module):
|
400 |
+
def __init__(self, config: AquilaConfig):
|
401 |
+
super().__init__()
|
402 |
+
self.hidden_size = config.hidden_size
|
403 |
+
self.self_attn = AquilaAttention(config=config)
|
404 |
+
self.mlp = AquilaMLP(config)
|
405 |
+
self.input_layernorm = AquilaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
406 |
+
self.post_attention_layernorm = AquilaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
407 |
+
|
408 |
+
def forward(
|
409 |
+
self,
|
410 |
+
hidden_states: torch.Tensor,
|
411 |
+
attention_mask: Optional[torch.Tensor] = None,
|
412 |
+
position_ids: Optional[torch.LongTensor] = None,
|
413 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
414 |
+
output_attentions: Optional[bool] = False,
|
415 |
+
use_cache: Optional[bool] = False,
|
416 |
+
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
417 |
+
"""
|
418 |
+
Args:
|
419 |
+
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
420 |
+
attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
|
421 |
+
`(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
|
422 |
+
output_attentions (`bool`, *optional*):
|
423 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
424 |
+
returned tensors for more detail.
|
425 |
+
use_cache (`bool`, *optional*):
|
426 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
|
427 |
+
(see `past_key_values`).
|
428 |
+
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
429 |
+
"""
|
430 |
+
|
431 |
+
residual = hidden_states
|
432 |
+
|
433 |
+
hidden_states = self.input_layernorm(hidden_states)
|
434 |
+
|
435 |
+
# Self Attention
|
436 |
+
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
437 |
+
hidden_states=hidden_states,
|
438 |
+
attention_mask=attention_mask,
|
439 |
+
position_ids=position_ids,
|
440 |
+
past_key_value=past_key_value,
|
441 |
+
output_attentions=output_attentions,
|
442 |
+
use_cache=use_cache,
|
443 |
+
)
|
444 |
+
hidden_states = residual + hidden_states
|
445 |
+
|
446 |
+
# Fully Connected
|
447 |
+
residual = hidden_states
|
448 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
449 |
+
hidden_states = self.mlp(hidden_states)
|
450 |
+
hidden_states = residual + hidden_states
|
451 |
+
|
452 |
+
outputs = (hidden_states,)
|
453 |
+
|
454 |
+
if output_attentions:
|
455 |
+
outputs += (self_attn_weights,)
|
456 |
+
|
457 |
+
if use_cache:
|
458 |
+
outputs += (present_key_value,)
|
459 |
+
|
460 |
+
return outputs
|
461 |
+
|
462 |
+
AQUILA_START_DOCSTRING = r"""
|
463 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
464 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
465 |
+
etc.)
|
466 |
+
|
467 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
468 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
469 |
+
and behavior.
|
470 |
+
|
471 |
+
Parameters:
|
472 |
+
config ([`AquilaConfig`]):
|
473 |
+
Model configuration class with all the parameters of the model. Initializing with a config file does not
|
474 |
+
load the weights associated with the model, only the configuration. Check out the
|
475 |
+
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
476 |
+
"""
|
477 |
+
|
478 |
+
|
479 |
+
@add_start_docstrings(
|
480 |
+
"The bare Aquila Model outputting raw hidden-states without any specific head on top.",
|
481 |
+
AQUILA_START_DOCSTRING,
|
482 |
+
)
|
483 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaPreTrainedModel with Llama->Aquila
|
484 |
+
class AquilaPreTrainedModel(PreTrainedModel):
|
485 |
+
config_class = AquilaConfig
|
486 |
+
base_model_prefix = "model"
|
487 |
+
supports_gradient_checkpointing = True
|
488 |
+
_no_split_modules = ["AquilaDecoderLayer"]
|
489 |
+
_skip_keys_device_placement = "past_key_values"
|
490 |
+
|
491 |
+
def _init_weights(self, module):
|
492 |
+
std = self.config.initializer_range
|
493 |
+
if isinstance(module, nn.Linear):
|
494 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
495 |
+
if module.bias is not None:
|
496 |
+
module.bias.data.zero_()
|
497 |
+
elif isinstance(module, nn.Embedding):
|
498 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
499 |
+
if module.padding_idx is not None:
|
500 |
+
module.weight.data[module.padding_idx].zero_()
|
501 |
+
|
502 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
503 |
+
if isinstance(module, AquilaModel):
|
504 |
+
module.gradient_checkpointing = value
|
505 |
+
|
506 |
+
|
507 |
+
AQUILA_INPUTS_DOCSTRING = r"""
|
508 |
+
Args:
|
509 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
510 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
|
511 |
+
it.
|
512 |
+
|
513 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
514 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
515 |
+
|
516 |
+
[What are input IDs?](../glossary#input-ids)
|
517 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
518 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
519 |
+
|
520 |
+
- 1 for tokens that are **not masked**,
|
521 |
+
- 0 for tokens that are **masked**.
|
522 |
+
|
523 |
+
[What are attention masks?](../glossary#attention-mask)
|
524 |
+
|
525 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
526 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
527 |
+
|
528 |
+
If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
|
529 |
+
`past_key_values`).
|
530 |
+
|
531 |
+
If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
|
532 |
+
and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
|
533 |
+
information on the default strategy.
|
534 |
+
|
535 |
+
- 1 indicates the head is **not masked**,
|
536 |
+
- 0 indicates the head is **masked**.
|
537 |
+
position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
538 |
+
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
539 |
+
config.n_positions - 1]`.
|
540 |
+
|
541 |
+
[What are position IDs?](../glossary#position-ids)
|
542 |
+
past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
543 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
|
544 |
+
`(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
|
545 |
+
`(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.
|
546 |
+
|
547 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
|
548 |
+
blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
|
549 |
+
|
550 |
+
If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those that
|
551 |
+
don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of all
|
552 |
+
`decoder_input_ids` of shape `(batch_size, sequence_length)`.
|
553 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
554 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
|
555 |
+
is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
|
556 |
+
model's internal embedding lookup matrix.
|
557 |
+
use_cache (`bool`, *optional*):
|
558 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
559 |
+
`past_key_values`).
|
560 |
+
output_attentions (`bool`, *optional*):
|
561 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
562 |
+
tensors for more detail.
|
563 |
+
output_hidden_states (`bool`, *optional*):
|
564 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
565 |
+
more detail.
|
566 |
+
return_dict (`bool`, *optional*):
|
567 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
568 |
+
"""
|
569 |
+
|
570 |
+
|
571 |
+
@add_start_docstrings(
|
572 |
+
"The bare Aquila Model outputting raw hidden-states without any specific head on top.",
|
573 |
+
AQUILA_START_DOCSTRING,
|
574 |
+
)
|
575 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaModel with LLAMA->AQUILA,Llama->Aquila
|
576 |
+
class AquilaModel(AquilaPreTrainedModel):
|
577 |
+
"""
|
578 |
+
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`AquilaDecoderLayer`]
|
579 |
+
|
580 |
+
Args:
|
581 |
+
config: AquilaConfig
|
582 |
+
"""
|
583 |
+
|
584 |
+
def __init__(self, config: AquilaConfig):
|
585 |
+
super().__init__(config)
|
586 |
+
self.padding_idx = config.pad_token_id
|
587 |
+
self.vocab_size = config.vocab_size
|
588 |
+
|
589 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
590 |
+
self.layers = nn.ModuleList([AquilaDecoderLayer(config) for _ in range(config.num_hidden_layers)])
|
591 |
+
self.norm = AquilaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
592 |
+
|
593 |
+
self.gradient_checkpointing = False
|
594 |
+
# Initialize weights and apply final processing
|
595 |
+
self.post_init()
|
596 |
+
|
597 |
+
def get_input_embeddings(self):
|
598 |
+
return self.embed_tokens
|
599 |
+
|
600 |
+
def set_input_embeddings(self, value):
|
601 |
+
self.embed_tokens = value
|
602 |
+
|
603 |
+
def _prepare_decoder_attention_mask(self, attention_mask, input_shape, inputs_embeds, past_key_values_length):
|
604 |
+
# create causal mask
|
605 |
+
# [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
|
606 |
+
combined_attention_mask = None
|
607 |
+
if input_shape[-1] > 1:
|
608 |
+
combined_attention_mask = _make_causal_mask(
|
609 |
+
input_shape,
|
610 |
+
inputs_embeds.dtype,
|
611 |
+
device=inputs_embeds.device,
|
612 |
+
past_key_values_length=past_key_values_length,
|
613 |
+
)
|
614 |
+
|
615 |
+
if attention_mask is not None:
|
616 |
+
# [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
|
617 |
+
expanded_attn_mask = _expand_mask(attention_mask, inputs_embeds.dtype, tgt_len=input_shape[-1]).to(
|
618 |
+
inputs_embeds.device
|
619 |
+
)
|
620 |
+
combined_attention_mask = (
|
621 |
+
expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask + combined_attention_mask
|
622 |
+
)
|
623 |
+
|
624 |
+
return combined_attention_mask
|
625 |
+
|
626 |
+
@add_start_docstrings_to_model_forward(AQUILA_INPUTS_DOCSTRING)
|
627 |
+
def forward(
|
628 |
+
self,
|
629 |
+
input_ids: torch.LongTensor = None,
|
630 |
+
attention_mask: Optional[torch.Tensor] = None,
|
631 |
+
position_ids: Optional[torch.LongTensor] = None,
|
632 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
633 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
634 |
+
use_cache: Optional[bool] = None,
|
635 |
+
output_attentions: Optional[bool] = None,
|
636 |
+
output_hidden_states: Optional[bool] = None,
|
637 |
+
return_dict: Optional[bool] = None,
|
638 |
+
) -> Union[Tuple, BaseModelOutputWithPast]:
|
639 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
640 |
+
output_hidden_states = (
|
641 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
642 |
+
)
|
643 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
644 |
+
|
645 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
646 |
+
|
647 |
+
# retrieve input_ids and inputs_embeds
|
648 |
+
if input_ids is not None and inputs_embeds is not None:
|
649 |
+
raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
|
650 |
+
elif input_ids is not None:
|
651 |
+
batch_size, seq_length = input_ids.shape
|
652 |
+
elif inputs_embeds is not None:
|
653 |
+
batch_size, seq_length, _ = inputs_embeds.shape
|
654 |
+
else:
|
655 |
+
raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
|
656 |
+
|
657 |
+
seq_length_with_past = seq_length
|
658 |
+
past_key_values_length = 0
|
659 |
+
|
660 |
+
if past_key_values is not None:
|
661 |
+
past_key_values_length = past_key_values[0][0].shape[2]
|
662 |
+
seq_length_with_past = seq_length_with_past + past_key_values_length
|
663 |
+
|
664 |
+
if position_ids is None:
|
665 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
666 |
+
position_ids = torch.arange(
|
667 |
+
past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
|
668 |
+
)
|
669 |
+
position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
|
670 |
+
else:
|
671 |
+
position_ids = position_ids.view(-1, seq_length).long()
|
672 |
+
|
673 |
+
if inputs_embeds is None:
|
674 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
675 |
+
# embed positions
|
676 |
+
if attention_mask is None:
|
677 |
+
attention_mask = torch.ones(
|
678 |
+
(batch_size, seq_length_with_past), dtype=torch.bool, device=inputs_embeds.device
|
679 |
+
)
|
680 |
+
attention_mask = self._prepare_decoder_attention_mask(
|
681 |
+
attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length
|
682 |
+
)
|
683 |
+
|
684 |
+
hidden_states = inputs_embeds
|
685 |
+
|
686 |
+
if self.gradient_checkpointing and self.training:
|
687 |
+
if use_cache:
|
688 |
+
logger.warning_once(
|
689 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
690 |
+
)
|
691 |
+
use_cache = False
|
692 |
+
|
693 |
+
# decoder layers
|
694 |
+
all_hidden_states = () if output_hidden_states else None
|
695 |
+
all_self_attns = () if output_attentions else None
|
696 |
+
next_decoder_cache = () if use_cache else None
|
697 |
+
|
698 |
+
for idx, decoder_layer in enumerate(self.layers):
|
699 |
+
if output_hidden_states:
|
700 |
+
all_hidden_states += (hidden_states,)
|
701 |
+
|
702 |
+
past_key_value = past_key_values[idx] if past_key_values is not None else None
|
703 |
+
|
704 |
+
if self.gradient_checkpointing and self.training:
|
705 |
+
|
706 |
+
def create_custom_forward(module):
|
707 |
+
def custom_forward(*inputs):
|
708 |
+
# None for past_key_value
|
709 |
+
return module(*inputs, past_key_value, output_attentions)
|
710 |
+
|
711 |
+
return custom_forward
|
712 |
+
|
713 |
+
layer_outputs = torch.utils.checkpoint.checkpoint(
|
714 |
+
create_custom_forward(decoder_layer),
|
715 |
+
hidden_states,
|
716 |
+
attention_mask,
|
717 |
+
position_ids,
|
718 |
+
)
|
719 |
+
else:
|
720 |
+
layer_outputs = decoder_layer(
|
721 |
+
hidden_states,
|
722 |
+
attention_mask=attention_mask,
|
723 |
+
position_ids=position_ids,
|
724 |
+
past_key_value=past_key_value,
|
725 |
+
output_attentions=output_attentions,
|
726 |
+
use_cache=use_cache,
|
727 |
+
)
|
728 |
+
|
729 |
+
hidden_states = layer_outputs[0]
|
730 |
+
|
731 |
+
if use_cache:
|
732 |
+
next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
|
733 |
+
|
734 |
+
if output_attentions:
|
735 |
+
all_self_attns += (layer_outputs[1],)
|
736 |
+
|
737 |
+
hidden_states = self.norm(hidden_states)
|
738 |
+
|
739 |
+
# add hidden states from the last decoder layer
|
740 |
+
if output_hidden_states:
|
741 |
+
all_hidden_states += (hidden_states,)
|
742 |
+
|
743 |
+
next_cache = next_decoder_cache if use_cache else None
|
744 |
+
if not return_dict:
|
745 |
+
return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
|
746 |
+
return BaseModelOutputWithPast(
|
747 |
+
last_hidden_state=hidden_states,
|
748 |
+
past_key_values=next_cache,
|
749 |
+
hidden_states=all_hidden_states,
|
750 |
+
attentions=all_self_attns,
|
751 |
+
)
|
752 |
+
|
753 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM with LLAMA->AQUILA,Llama->Aquila
|
754 |
+
class AquilaForCausalLM(AquilaPreTrainedModel):
|
755 |
+
_tied_weights_keys = ["lm_head.weight"]
|
756 |
+
|
757 |
+
def __init__(self, config):
|
758 |
+
super().__init__(config)
|
759 |
+
self.model = AquilaModel(config)
|
760 |
+
self.vocab_size = config.vocab_size
|
761 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
762 |
+
|
763 |
+
# Initialize weights and apply final processing
|
764 |
+
self.post_init()
|
765 |
+
|
766 |
+
def get_input_embeddings(self):
|
767 |
+
return self.model.embed_tokens
|
768 |
+
|
769 |
+
def set_input_embeddings(self, value):
|
770 |
+
self.model.embed_tokens = value
|
771 |
+
|
772 |
+
def get_output_embeddings(self):
|
773 |
+
return self.lm_head
|
774 |
+
|
775 |
+
def set_output_embeddings(self, new_embeddings):
|
776 |
+
self.lm_head = new_embeddings
|
777 |
+
|
778 |
+
def set_decoder(self, decoder):
|
779 |
+
self.model = decoder
|
780 |
+
|
781 |
+
def get_decoder(self):
|
782 |
+
return self.model
|
783 |
+
|
784 |
+
@add_start_docstrings_to_model_forward(AQUILA_INPUTS_DOCSTRING)
|
785 |
+
@replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
|
786 |
+
def forward(
|
787 |
+
self,
|
788 |
+
input_ids: torch.LongTensor = None,
|
789 |
+
attention_mask: Optional[torch.Tensor] = None,
|
790 |
+
position_ids: Optional[torch.LongTensor] = None,
|
791 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
792 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
793 |
+
labels: Optional[torch.LongTensor] = None,
|
794 |
+
use_cache: Optional[bool] = None,
|
795 |
+
output_attentions: Optional[bool] = None,
|
796 |
+
output_hidden_states: Optional[bool] = None,
|
797 |
+
return_dict: Optional[bool] = None,
|
798 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
799 |
+
r"""
|
800 |
+
Args:
|
801 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
802 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
803 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
804 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
805 |
+
|
806 |
+
Returns:
|
807 |
+
|
808 |
+
Example:
|
809 |
+
|
810 |
+
```python
|
811 |
+
>>> from transformers import AutoTokenizer, AquilaForCausalLM
|
812 |
+
|
813 |
+
>>> model = AquilaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
814 |
+
>>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
815 |
+
|
816 |
+
>>> prompt = "Hey, are you consciours? Can you talk to me?"
|
817 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
818 |
+
|
819 |
+
>>> # Generate
|
820 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
821 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
822 |
+
"Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."
|
823 |
+
```"""
|
824 |
+
|
825 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
826 |
+
output_hidden_states = (
|
827 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
828 |
+
)
|
829 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
830 |
+
|
831 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
832 |
+
outputs = self.model(
|
833 |
+
input_ids=input_ids,
|
834 |
+
attention_mask=attention_mask,
|
835 |
+
position_ids=position_ids,
|
836 |
+
past_key_values=past_key_values,
|
837 |
+
inputs_embeds=inputs_embeds,
|
838 |
+
use_cache=use_cache,
|
839 |
+
output_attentions=output_attentions,
|
840 |
+
output_hidden_states=output_hidden_states,
|
841 |
+
return_dict=return_dict,
|
842 |
+
)
|
843 |
+
|
844 |
+
hidden_states = outputs[0]
|
845 |
+
if self.config.pretraining_tp > 1:
|
846 |
+
lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
|
847 |
+
logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
|
848 |
+
logits = torch.cat(logits, dim=-1)
|
849 |
+
else:
|
850 |
+
logits = self.lm_head(hidden_states)
|
851 |
+
logits = logits.float()
|
852 |
+
|
853 |
+
loss = None
|
854 |
+
if labels is not None:
|
855 |
+
# Shift so that tokens < n predict n
|
856 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
857 |
+
shift_labels = labels[..., 1:].contiguous()
|
858 |
+
# Flatten the tokens
|
859 |
+
loss_fct = CrossEntropyLoss()
|
860 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
861 |
+
shift_labels = shift_labels.view(-1)
|
862 |
+
# Enable model parallelism
|
863 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
864 |
+
loss = loss_fct(shift_logits, shift_labels)
|
865 |
+
|
866 |
+
if not return_dict:
|
867 |
+
output = (logits,) + outputs[1:]
|
868 |
+
return (loss,) + output if loss is not None else output
|
869 |
+
|
870 |
+
return CausalLMOutputWithPast(
|
871 |
+
loss=loss,
|
872 |
+
logits=logits,
|
873 |
+
past_key_values=outputs.past_key_values,
|
874 |
+
hidden_states=outputs.hidden_states,
|
875 |
+
attentions=outputs.attentions,
|
876 |
+
)
|
877 |
+
|
878 |
+
def prepare_inputs_for_generation(
|
879 |
+
self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
|
880 |
+
):
|
881 |
+
if past_key_values:
|
882 |
+
input_ids = input_ids[:, -1:]
|
883 |
+
|
884 |
+
position_ids = kwargs.get("position_ids", None)
|
885 |
+
if attention_mask is not None and position_ids is None:
|
886 |
+
# create position_ids on the fly for batch generation
|
887 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
888 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
889 |
+
if past_key_values:
|
890 |
+
position_ids = position_ids[:, -1].unsqueeze(-1)
|
891 |
+
|
892 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
893 |
+
if inputs_embeds is not None and past_key_values is None:
|
894 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
895 |
+
else:
|
896 |
+
model_inputs = {"input_ids": input_ids}
|
897 |
+
|
898 |
+
model_inputs.update(
|
899 |
+
{
|
900 |
+
"position_ids": position_ids,
|
901 |
+
"past_key_values": past_key_values,
|
902 |
+
"use_cache": kwargs.get("use_cache"),
|
903 |
+
"attention_mask": attention_mask,
|
904 |
+
}
|
905 |
+
)
|
906 |
+
return model_inputs
|
907 |
+
|
908 |
+
@staticmethod
|
909 |
+
def _reorder_cache(past_key_values, beam_idx):
|
910 |
+
reordered_past = ()
|
911 |
+
for layer_past in past_key_values:
|
912 |
+
reordered_past += (
|
913 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
|
914 |
+
)
|
915 |
+
return reordered_past
|
916 |
+
|
917 |
+
def predict(self, text, tokenizer=None,
|
918 |
+
max_gen_len=200, top_p=0.95,
|
919 |
+
seed=1234, topk=100,
|
920 |
+
temperature=0.9,
|
921 |
+
sft=True, convo_template = "aquila-chat",
|
922 |
+
device = "cuda"):
|
923 |
+
|
924 |
+
vocab = tokenizer.get_vocab()
|
925 |
+
#device = device
|
926 |
+
id2word = {v:k for k, v in vocab.items()}
|
927 |
+
|
928 |
+
|
929 |
+
set_random_seed(seed)
|
930 |
+
if temperature == 0:
|
931 |
+
topk = 1
|
932 |
+
temperature = 1.0
|
933 |
+
if sft:
|
934 |
+
tokens = covert_prompt_to_input_ids_with_history(text, history=[], tokenizer=tokenizer, max_token=2048, convo_template=convo_template)
|
935 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
936 |
+
else :
|
937 |
+
tokens = tokenizer.encode_plus(text)["input_ids"]
|
938 |
+
print(tokenizer.decode(tokens))
|
939 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
940 |
+
input_length = len(tokens[0])
|
941 |
+
with torch.no_grad():
|
942 |
+
|
943 |
+
# instantiate logits processors
|
944 |
+
logits_processor = LogitsProcessorList(
|
945 |
+
[
|
946 |
+
MinLengthLogitsProcessor(1, eos_token_id=100007),
|
947 |
+
]
|
948 |
+
)
|
949 |
+
# instantiate logits processors
|
950 |
+
logits_warper = LogitsProcessorList(
|
951 |
+
[
|
952 |
+
TopPLogitsWarper(top_p),
|
953 |
+
TopKLogitsWarper(topk),
|
954 |
+
TemperatureLogitsWarper(temperature),
|
955 |
+
|
956 |
+
]
|
957 |
+
)
|
958 |
+
|
959 |
+
stopping_criteria = StoppingCriteriaList([MaxLengthCriteria(max_length=input_length + max_gen_len)])
|
960 |
+
out = self.sample(
|
961 |
+
tokens,
|
962 |
+
logits_processor=logits_processor,
|
963 |
+
logits_warper=logits_warper,
|
964 |
+
stopping_criteria=stopping_criteria,
|
965 |
+
return_dict_in_generate=True,
|
966 |
+
output_scores=True,
|
967 |
+
)
|
968 |
+
|
969 |
+
|
970 |
+
# print(out)
|
971 |
+
out_ids = out["sequences"][0][input_length:].cpu().numpy()
|
972 |
+
|
973 |
+
out_scores = out["scores"]
|
974 |
+
|
975 |
+
out_scores = torch.cat(out_scores, dim=0)
|
976 |
+
out_scores = torch.nn.functional.softmax(out_scores, dim=-1).cpu().numpy()
|
977 |
+
|
978 |
+
probs = []
|
979 |
+
for i in range(len(out_ids)):
|
980 |
+
probs.append(float(out_scores[i][out_ids[i]]))
|
981 |
+
|
982 |
+
# print(f"probs is {probs}")
|
983 |
+
|
984 |
+
convert_tokens = []
|
985 |
+
for t in out_ids:
|
986 |
+
if t == 100006:
|
987 |
+
convert_tokens.append("[CLS]")
|
988 |
+
else :
|
989 |
+
convert_tokens.append(id2word.get(t, "[unkonwn_token]"))
|
990 |
+
|
991 |
+
out_text = tokenizer.decode(out_ids.tolist())
|
992 |
+
|
993 |
+
|
994 |
+
out = out_text
|
995 |
+
|
996 |
+
if "###" in out:
|
997 |
+
special_index = out.index("###")
|
998 |
+
out = out[: special_index]
|
999 |
+
token_length = len(tokenizer.encode_plus(out)["input_ids"])
|
1000 |
+
convert_tokens = convert_tokens[:token_length]
|
1001 |
+
probs = probs[:token_length]
|
1002 |
+
|
1003 |
+
if "[UNK]" in out:
|
1004 |
+
special_index = out.index("[UNK]")
|
1005 |
+
out = out[:special_index]
|
1006 |
+
token_length = len(tokenizer.encode_plus(out)["input_ids"])
|
1007 |
+
convert_tokens = convert_tokens[:token_length]
|
1008 |
+
probs = probs[:token_length]
|
1009 |
+
|
1010 |
+
if "</s>" in out:
|
1011 |
+
special_index = out.index("</s>")
|
1012 |
+
out = out[: special_index]
|
1013 |
+
token_length = len(tokenizer.encode_plus(out)["input_ids"])
|
1014 |
+
convert_tokens = convert_tokens[:token_length]
|
1015 |
+
probs = probs[:token_length]
|
1016 |
+
|
1017 |
+
if len(out) > 0 and out[0] == " ":
|
1018 |
+
out = out[1:]
|
1019 |
+
|
1020 |
+
convert_tokens = convert_tokens[1:]
|
1021 |
+
probs = probs[1:]
|
1022 |
+
return out
|
1023 |
+
|
1024 |
+
@add_start_docstrings(
|
1025 |
+
"""
|
1026 |
+
The LLaMa Model transformer with a sequence classification head on top (linear layer).
|
1027 |
+
|
1028 |
+
[`AquilaForSequenceClassification`] uses the last token in order to do the classification, as other causal models
|
1029 |
+
(e.g. GPT-2) do.
|
1030 |
+
|
1031 |
+
Since it does classification on the last token, it requires to know the position of the last token. If a
|
1032 |
+
`pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
|
1033 |
+
no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
|
1034 |
+
padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
|
1035 |
+
each row of the batch).
|
1036 |
+
""",
|
1037 |
+
AQUILA_START_DOCSTRING,
|
1038 |
+
)
|
1039 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForSequenceClassification with LLAMA->AQUILA,Llama->Aquila
|
1040 |
+
class AquilaForSequenceClassification(AquilaPreTrainedModel):
|
1041 |
+
_keys_to_ignore_on_load_missing = [r"lm_head.weight"]
|
1042 |
+
|
1043 |
+
def __init__(self, config):
|
1044 |
+
super().__init__(config)
|
1045 |
+
self.num_labels = config.num_labels
|
1046 |
+
self.model = AquilaModel(config)
|
1047 |
+
self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
|
1048 |
+
|
1049 |
+
# Initialize weights and apply final processing
|
1050 |
+
self.post_init()
|
1051 |
+
|
1052 |
+
def get_input_embeddings(self):
|
1053 |
+
return self.model.embed_tokens
|
1054 |
+
|
1055 |
+
def set_input_embeddings(self, value):
|
1056 |
+
self.model.embed_tokens = value
|
1057 |
+
|
1058 |
+
@add_start_docstrings_to_model_forward(AQUILA_INPUTS_DOCSTRING)
|
1059 |
+
def forward(
|
1060 |
+
self,
|
1061 |
+
input_ids: torch.LongTensor = None,
|
1062 |
+
attention_mask: Optional[torch.Tensor] = None,
|
1063 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1064 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
1065 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1066 |
+
labels: Optional[torch.LongTensor] = None,
|
1067 |
+
use_cache: Optional[bool] = None,
|
1068 |
+
output_attentions: Optional[bool] = None,
|
1069 |
+
output_hidden_states: Optional[bool] = None,
|
1070 |
+
return_dict: Optional[bool] = None,
|
1071 |
+
) -> Union[Tuple, SequenceClassifierOutputWithPast]:
|
1072 |
+
r"""
|
1073 |
+
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
1074 |
+
Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
|
1075 |
+
config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
|
1076 |
+
`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
|
1077 |
+
"""
|
1078 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
1079 |
+
|
1080 |
+
transformer_outputs = self.model(
|
1081 |
+
input_ids,
|
1082 |
+
attention_mask=attention_mask,
|
1083 |
+
position_ids=position_ids,
|
1084 |
+
past_key_values=past_key_values,
|
1085 |
+
inputs_embeds=inputs_embeds,
|
1086 |
+
use_cache=use_cache,
|
1087 |
+
output_attentions=output_attentions,
|
1088 |
+
output_hidden_states=output_hidden_states,
|
1089 |
+
return_dict=return_dict,
|
1090 |
+
)
|
1091 |
+
hidden_states = transformer_outputs[0]
|
1092 |
+
logits = self.score(hidden_states)
|
1093 |
+
|
1094 |
+
if input_ids is not None:
|
1095 |
+
batch_size = input_ids.shape[0]
|
1096 |
+
else:
|
1097 |
+
batch_size = inputs_embeds.shape[0]
|
1098 |
+
|
1099 |
+
if self.config.pad_token_id is None and batch_size != 1:
|
1100 |
+
raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
|
1101 |
+
if self.config.pad_token_id is None:
|
1102 |
+
sequence_lengths = -1
|
1103 |
+
else:
|
1104 |
+
if input_ids is not None:
|
1105 |
+
sequence_lengths = (torch.eq(input_ids, self.config.pad_token_id).long().argmax(-1) - 1).to(
|
1106 |
+
logits.device
|
1107 |
+
)
|
1108 |
+
else:
|
1109 |
+
sequence_lengths = -1
|
1110 |
+
|
1111 |
+
pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
|
1112 |
+
|
1113 |
+
loss = None
|
1114 |
+
if labels is not None:
|
1115 |
+
labels = labels.to(logits.device)
|
1116 |
+
if self.config.problem_type is None:
|
1117 |
+
if self.num_labels == 1:
|
1118 |
+
self.config.problem_type = "regression"
|
1119 |
+
elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
|
1120 |
+
self.config.problem_type = "single_label_classification"
|
1121 |
+
else:
|
1122 |
+
self.config.problem_type = "multi_label_classification"
|
1123 |
+
|
1124 |
+
if self.config.problem_type == "regression":
|
1125 |
+
loss_fct = MSELoss()
|
1126 |
+
if self.num_labels == 1:
|
1127 |
+
loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
|
1128 |
+
else:
|
1129 |
+
loss = loss_fct(pooled_logits, labels)
|
1130 |
+
elif self.config.problem_type == "single_label_classification":
|
1131 |
+
loss_fct = CrossEntropyLoss()
|
1132 |
+
loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
|
1133 |
+
elif self.config.problem_type == "multi_label_classification":
|
1134 |
+
loss_fct = BCEWithLogitsLoss()
|
1135 |
+
loss = loss_fct(pooled_logits, labels)
|
1136 |
+
if not return_dict:
|
1137 |
+
output = (pooled_logits,) + transformer_outputs[1:]
|
1138 |
+
return ((loss,) + output) if loss is not None else output
|
1139 |
+
|
1140 |
+
return SequenceClassifierOutputWithPast(
|
1141 |
+
loss=loss,
|
1142 |
+
logits=pooled_logits,
|
1143 |
+
past_key_values=transformer_outputs.past_key_values,
|
1144 |
+
hidden_states=transformer_outputs.hidden_states,
|
1145 |
+
attentions=transformer_outputs.attentions,
|
1146 |
+
)
|
output-00001-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:85e1eb625412bd839e9ab3860e82cecae1153a4729012b6cce67bb1877095804
|
3 |
+
size 8545197352
|
output-00002-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b3c8d6e959d3c7690fa39c48c453688fb3fa5179c38d80caf689325587856cd1
|
3 |
+
size 8546475928
|
output-00003-of-00003.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f15b062055af08957174ec332c0bd0ca994758b7cf97dab2f540d9da7f284936
|
3 |
+
size 7914967848
|
predict.py
ADDED
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Copied from https://github.com/lm-sys/FastChat.
|
3 |
+
Later we will contribute our changes into it.
|
4 |
+
"""
|
5 |
+
import dataclasses
|
6 |
+
from enum import auto, IntEnum
|
7 |
+
from typing import List, Any, Dict
|
8 |
+
import math
|
9 |
+
from typing import List, Optional, Tuple, Union
|
10 |
+
import random
|
11 |
+
import numpy as np
|
12 |
+
|
13 |
+
import torch
|
14 |
+
import torch.utils.checkpoint
|
15 |
+
from torch import nn
|
16 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
17 |
+
|
18 |
+
from transformers.activations import ACT2FN
|
19 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
|
20 |
+
from transformers.modeling_utils import PreTrainedModel
|
21 |
+
from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
|
22 |
+
from transformers import (
|
23 |
+
LogitsProcessorList,
|
24 |
+
MinLengthLogitsProcessor,
|
25 |
+
TopKLogitsWarper,
|
26 |
+
TemperatureLogitsWarper,
|
27 |
+
TopPLogitsWarper,
|
28 |
+
StoppingCriteriaList,
|
29 |
+
MaxLengthCriteria,
|
30 |
+
BitsAndBytesConfig,
|
31 |
+
)
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
class SeparatorStyle(IntEnum):
|
36 |
+
"""Separator styles."""
|
37 |
+
|
38 |
+
ADD_COLON_SINGLE = auto()
|
39 |
+
ADD_COLON_TWO = auto()
|
40 |
+
ADD_COLON_SPACE_SINGLE = auto()
|
41 |
+
NO_COLON_SINGLE = auto()
|
42 |
+
NO_COLON_TWO = auto()
|
43 |
+
ADD_NEW_LINE_SINGLE = auto()
|
44 |
+
|
45 |
+
|
46 |
+
@dataclasses.dataclass
|
47 |
+
class Conversation:
|
48 |
+
"""A class that manages prompt templates and keeps all conversation history."""
|
49 |
+
|
50 |
+
# The name of this template
|
51 |
+
name: str
|
52 |
+
# The template of the system prompt
|
53 |
+
system_template: str = "{system_message}"
|
54 |
+
# The system message
|
55 |
+
system_message: str = ""
|
56 |
+
# The names of two roles
|
57 |
+
roles: List[str] = (("USER", "ASSISTANT"),)
|
58 |
+
# All messages. Each item is (role, message).
|
59 |
+
messages: List[List[str]] = ()
|
60 |
+
# The number of few shot examples
|
61 |
+
offset: int = 0
|
62 |
+
# The separator style and configurations
|
63 |
+
sep_style: SeparatorStyle = SeparatorStyle.ADD_COLON_SINGLE
|
64 |
+
sep: str = "\n"
|
65 |
+
sep2: str = None
|
66 |
+
# Stop criteria (the default one is EOS token)
|
67 |
+
stop_str: str = None
|
68 |
+
# Stops generation if meeting any token in this list
|
69 |
+
stop_token_ids: List[int] = None
|
70 |
+
|
71 |
+
def get_prompt(self) -> str:
|
72 |
+
"""Get the prompt for generation."""
|
73 |
+
system_prompt = self.system_template.format(system_message=self.system_message)
|
74 |
+
if self.sep_style == SeparatorStyle.ADD_COLON_SINGLE:
|
75 |
+
ret = system_prompt + self.sep
|
76 |
+
for role, message in self.messages:
|
77 |
+
if message:
|
78 |
+
ret += role + ": " + message + self.sep
|
79 |
+
else:
|
80 |
+
ret += role + ":"
|
81 |
+
return ret
|
82 |
+
elif self.sep_style == SeparatorStyle.ADD_COLON_TWO:
|
83 |
+
seps = [self.sep, self.sep2]
|
84 |
+
ret = system_prompt + seps[0]
|
85 |
+
for i, (role, message) in enumerate(self.messages):
|
86 |
+
if message:
|
87 |
+
ret += role + ": " + message + seps[i % 2]
|
88 |
+
else:
|
89 |
+
ret += role + ":"
|
90 |
+
return ret
|
91 |
+
elif self.sep_style == SeparatorStyle.ADD_COLON_SPACE_SINGLE:
|
92 |
+
ret = system_prompt + self.sep
|
93 |
+
for role, message in self.messages:
|
94 |
+
if message:
|
95 |
+
ret += role + ": " + message + self.sep
|
96 |
+
else:
|
97 |
+
ret += role + ": " # must be end with a space
|
98 |
+
return ret
|
99 |
+
elif self.sep_style == SeparatorStyle.ADD_NEW_LINE_SINGLE:
|
100 |
+
ret = "" if system_prompt == "" else system_prompt + self.sep
|
101 |
+
for role, message in self.messages:
|
102 |
+
if message:
|
103 |
+
ret += role + "\n" + message + self.sep
|
104 |
+
else:
|
105 |
+
ret += role + "\n"
|
106 |
+
return ret
|
107 |
+
elif self.sep_style == SeparatorStyle.NO_COLON_SINGLE:
|
108 |
+
ret = system_prompt
|
109 |
+
for role, message in self.messages:
|
110 |
+
if message:
|
111 |
+
ret += role + message + self.sep
|
112 |
+
else:
|
113 |
+
ret += role
|
114 |
+
return ret
|
115 |
+
elif self.sep_style == SeparatorStyle.NO_COLON_TWO:
|
116 |
+
seps = [self.sep, self.sep2]
|
117 |
+
ret = system_prompt
|
118 |
+
for i, (role, message) in enumerate(self.messages):
|
119 |
+
if message:
|
120 |
+
ret += role + message + seps[i % 2]
|
121 |
+
else:
|
122 |
+
ret += role
|
123 |
+
return ret
|
124 |
+
|
125 |
+
def set_system_message(self, system_message: str):
|
126 |
+
"""Set the system message."""
|
127 |
+
self.system_message = system_message
|
128 |
+
|
129 |
+
def append_message(self, role: str, message: str):
|
130 |
+
"""Append a new message."""
|
131 |
+
self.messages.append([role, message])
|
132 |
+
|
133 |
+
def update_last_message(self, message: str):
|
134 |
+
"""Update the last output.
|
135 |
+
|
136 |
+
The last message is typically set to be None when constructing the prompt,
|
137 |
+
so we need to update it in-place after getting the response from a model.
|
138 |
+
"""
|
139 |
+
self.messages[-1][1] = message
|
140 |
+
|
141 |
+
def copy(self):
|
142 |
+
return Conversation(
|
143 |
+
name=self.name,
|
144 |
+
system_template=self.system_template,
|
145 |
+
system_message=self.system_message,
|
146 |
+
roles=self.roles,
|
147 |
+
messages=[[x, y] for x, y in self.messages],
|
148 |
+
offset=self.offset,
|
149 |
+
sep_style=self.sep_style,
|
150 |
+
sep=self.sep,
|
151 |
+
sep2=self.sep2,
|
152 |
+
stop_str=self.stop_str,
|
153 |
+
stop_token_ids=self.stop_token_ids,
|
154 |
+
)
|
155 |
+
|
156 |
+
def dict(self):
|
157 |
+
return {
|
158 |
+
"template_name": self.name,
|
159 |
+
"system_message": self.system_message,
|
160 |
+
"roles": self.roles,
|
161 |
+
"messages": self.messages,
|
162 |
+
"offset": self.offset,
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
# A global registry for all conversation templates
|
167 |
+
conv_templates: Dict[str, Conversation] = {}
|
168 |
+
|
169 |
+
|
170 |
+
def register_conv_template(template: Conversation, override: bool = False):
|
171 |
+
"""Register a new conversation template."""
|
172 |
+
if not override:
|
173 |
+
assert (
|
174 |
+
template.name not in conv_templates
|
175 |
+
), f"{template.name} has been registered."
|
176 |
+
|
177 |
+
conv_templates[template.name] = template
|
178 |
+
|
179 |
+
|
180 |
+
def get_conv_template(name: str) -> Conversation:
|
181 |
+
"""Get a conversation template."""
|
182 |
+
return conv_templates[name].copy()
|
183 |
+
|
184 |
+
def get_conversation_template(model_path: str) -> Conversation:
|
185 |
+
"""Get the default conversation template."""
|
186 |
+
if "aquila-v1" in model_path:
|
187 |
+
return get_conv_template("aquila-v1")
|
188 |
+
elif "aquila-v2" in model_path:
|
189 |
+
return get_conv_template("aquila-v2")
|
190 |
+
elif "aquila-chat" in model_path:
|
191 |
+
return get_conv_template("aquila-chat")
|
192 |
+
elif "aquila-legacy" in model_path:
|
193 |
+
return get_conv_template("aquila-legacy")
|
194 |
+
else:
|
195 |
+
return get_conv_template("aquila")
|
196 |
+
|
197 |
+
# AquilaChat default template
|
198 |
+
# source: https://github.com/FlagAI-Open/FlagAI/blob/master/examples/Aquila/Aquila-chat/cyg_conversation.py
|
199 |
+
register_conv_template(
|
200 |
+
Conversation(
|
201 |
+
name="aquila-chat",
|
202 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. "
|
203 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
204 |
+
roles=("Human", "Assistant", "System"),
|
205 |
+
messages=(),
|
206 |
+
offset=0,
|
207 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
208 |
+
sep="###",
|
209 |
+
sep2="",
|
210 |
+
stop_str=["###", "</s>", "[UNK]"],
|
211 |
+
)
|
212 |
+
)
|
213 |
+
|
214 |
+
register_conv_template(
|
215 |
+
Conversation(
|
216 |
+
name="aquila-legacy",
|
217 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. "
|
218 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
219 |
+
roles=("### Human: ", "### Assistant: ", "System"),
|
220 |
+
messages=(),
|
221 |
+
offset=0,
|
222 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
223 |
+
sep="\n",
|
224 |
+
sep2="</s>",
|
225 |
+
stop_str=["</s>", "[UNK]"],
|
226 |
+
)
|
227 |
+
)
|
228 |
+
|
229 |
+
register_conv_template(
|
230 |
+
Conversation(
|
231 |
+
name="aquila",
|
232 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. "
|
233 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
234 |
+
roles=("Human", "Assistant", "System"),
|
235 |
+
messages=(),
|
236 |
+
offset=0,
|
237 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
238 |
+
sep="###",
|
239 |
+
sep2="</s>",
|
240 |
+
stop_str=["</s>", "[UNK]"],
|
241 |
+
)
|
242 |
+
)
|
243 |
+
|
244 |
+
register_conv_template(
|
245 |
+
Conversation(
|
246 |
+
name="aquila-v1",
|
247 |
+
roles=("<|startofpiece|>", "<|endofpiece|>", ""),
|
248 |
+
messages=(),
|
249 |
+
offset=0,
|
250 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
251 |
+
sep="",
|
252 |
+
sep2="</s>",
|
253 |
+
stop_str=["</s>", "<|endoftext|>"],
|
254 |
+
)
|
255 |
+
)
|
256 |
+
|
257 |
+
register_conv_template(
|
258 |
+
Conversation(
|
259 |
+
name="aquila-v2",
|
260 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. "
|
261 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
262 |
+
roles=("<|startofpiece|>", "<|endofpiece|>", ""),
|
263 |
+
messages=(),
|
264 |
+
offset=0,
|
265 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
266 |
+
sep="",
|
267 |
+
sep2="</s>",
|
268 |
+
stop_str=["</s>", "<|endoftext|>", "<|startofpiece|>", "<|endofpiece|>"],
|
269 |
+
)
|
270 |
+
)
|
271 |
+
|
272 |
+
|
273 |
+
if __name__ == "__main__":
|
274 |
+
print("aquila template:")
|
275 |
+
conv = get_conv_template("aquila")
|
276 |
+
conv.append_message(conv.roles[0], "Hello!")
|
277 |
+
conv.append_message(conv.roles[1], "Hi!")
|
278 |
+
conv.append_message(conv.roles[0], "How are you?")
|
279 |
+
conv.append_message(conv.roles[1], None)
|
280 |
+
print(conv.get_prompt())
|
281 |
+
|
282 |
+
print("\n")
|
283 |
+
|
284 |
+
print("aquila-chat template:")
|
285 |
+
conv = get_conv_template("aquila-chat")
|
286 |
+
conv.append_message(conv.roles[0], "Hello!")
|
287 |
+
conv.append_message(conv.roles[1], "Hi!")
|
288 |
+
conv.append_message(conv.roles[0], "How are you?")
|
289 |
+
conv.append_message(conv.roles[1], None)
|
290 |
+
print(conv.get_prompt())
|
291 |
+
|
292 |
+
print("\n")
|
293 |
+
|
294 |
+
print("aquila-v1 template:")
|
295 |
+
conv = get_conv_template("aquila-v1")
|
296 |
+
conv.append_message(conv.roles[0], "Hello!")
|
297 |
+
conv.append_message(conv.roles[1], "Hi!")
|
298 |
+
conv.append_message(conv.roles[0], "How are you?")
|
299 |
+
conv.append_message(conv.roles[1], None)
|
300 |
+
print(conv.get_prompt())
|
301 |
+
|
302 |
+
print("\n")
|
303 |
+
|
304 |
+
print("aquila-legacy template:")
|
305 |
+
conv = get_conv_template("aquila-legacy")
|
306 |
+
conv.append_message(conv.roles[0], "Hello!")
|
307 |
+
conv.append_message(conv.roles[1], "Hi!")
|
308 |
+
conv.append_message(conv.roles[0], "How are you?")
|
309 |
+
conv.append_message(conv.roles[1], None)
|
310 |
+
print(conv.get_prompt())
|
311 |
+
|
312 |
+
print("\n")
|
313 |
+
|
314 |
+
print("aquila-v2 template:")
|
315 |
+
conv = get_conv_template("aquila-v2")
|
316 |
+
conv.append_message(conv.roles[0], "Hello!")
|
317 |
+
conv.append_message(conv.roles[1], "Hi!")
|
318 |
+
conv.append_message(conv.roles[0], "How are you?")
|
319 |
+
conv.append_message(conv.roles[1], None)
|
320 |
+
print(conv.get_prompt())
|
321 |
+
|
322 |
+
print("\n")
|
323 |
+
|
324 |
+
|
325 |
+
def set_random_seed(seed):
|
326 |
+
"""Set random seed for reproducability."""
|
327 |
+
if seed is not None and seed > 0:
|
328 |
+
random.seed(seed)
|
329 |
+
np.random.seed(seed)
|
330 |
+
torch.manual_seed(seed)
|
331 |
+
|
332 |
+
def covert_prompt_to_input_ids_with_history(text, history, tokenizer, max_token, convo_template="aquila-chat"):
|
333 |
+
# aquila-chat as default
|
334 |
+
conv = get_conv_template(convo_template)
|
335 |
+
|
336 |
+
conv.append_message(conv.roles[1], None)
|
337 |
+
conv.append_message(conv.roles[0], text)
|
338 |
+
|
339 |
+
example = tokenizer.encode_plus(f"{conv.get_prompt()} ", None, max_length=None)['input_ids']
|
340 |
+
|
341 |
+
if history is None or not isinstance(history, list):
|
342 |
+
history = []
|
343 |
+
|
344 |
+
while(len(history) > 0 and (len(example) < max_token)):
|
345 |
+
tmp = history.pop()
|
346 |
+
if tmp[0] == 'ASSISTANT':
|
347 |
+
conv.append_message(conv.roles[1], tmp[1])
|
348 |
+
else:
|
349 |
+
conv.append_message(conv.roles[0], tmp[1])
|
350 |
+
example = tokenizer.encode_plus(f"{conv.get_prompt()} ", None, max_length=None)['input_ids']
|
351 |
+
|
352 |
+
if len(example) >= max_token:
|
353 |
+
conv.messages.pop()
|
354 |
+
conv.messages = conv.messages[::-1]
|
355 |
+
print('model in:', conv.get_prompt())
|
356 |
+
example = tokenizer.encode_plus(f"{conv.get_prompt()} ", None, max_length=None)['input_ids']
|
357 |
+
|
358 |
+
return example
|
359 |
+
|
360 |
+
def predict(model, text, tokenizer=None,
|
361 |
+
max_gen_len=200, top_p=0.9,
|
362 |
+
seed=123, topk=15,
|
363 |
+
temperature=1.0,
|
364 |
+
sft=True, convo_template = "",
|
365 |
+
device = "cuda",
|
366 |
+
model_name="AquilaChat2-7B",
|
367 |
+
history=None,
|
368 |
+
**kwargs):
|
369 |
+
|
370 |
+
vocab = tokenizer.get_vocab()
|
371 |
+
|
372 |
+
id2word = {v:k for k, v in vocab.items()}
|
373 |
+
|
374 |
+
|
375 |
+
template_map = {"AquilaChat2-7B": "aquila-v1",
|
376 |
+
"AquilaChat2-34B": "aquila-legacy",
|
377 |
+
"AquilaChat2-70B-Expr": "aquila-v2",
|
378 |
+
"AquilaChat2-7B-16K": "aquila",
|
379 |
+
"AquilaChat2-34B-16K": "aquila"}
|
380 |
+
if not convo_template:
|
381 |
+
convo_template=template_map.get(model_name, "aquila-chat")
|
382 |
+
|
383 |
+
set_random_seed(seed)
|
384 |
+
if temperature == 0:
|
385 |
+
topk = 1
|
386 |
+
temperature = 1.0
|
387 |
+
if sft:
|
388 |
+
tokens = covert_prompt_to_input_ids_with_history(text, history=history, tokenizer=tokenizer, max_token=20480, convo_template=convo_template)
|
389 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
390 |
+
else :
|
391 |
+
tokens = tokenizer.encode_plus(text)["input_ids"]
|
392 |
+
print(tokenizer.decode(tokens))
|
393 |
+
tokens = torch.tensor(tokens)[None,].to(device)
|
394 |
+
input_length = len(tokens[0])
|
395 |
+
with torch.no_grad():
|
396 |
+
|
397 |
+
# instantiate logits processors
|
398 |
+
logits_processor = LogitsProcessorList(
|
399 |
+
[
|
400 |
+
MinLengthLogitsProcessor(1, eos_token_id=100007),
|
401 |
+
]
|
402 |
+
)
|
403 |
+
# instantiate logits processors
|
404 |
+
logits_warper = LogitsProcessorList(
|
405 |
+
[
|
406 |
+
TopPLogitsWarper(top_p),
|
407 |
+
TopKLogitsWarper(topk),
|
408 |
+
TemperatureLogitsWarper(temperature),
|
409 |
+
|
410 |
+
]
|
411 |
+
)
|
412 |
+
|
413 |
+
stopping_criteria = StoppingCriteriaList([MaxLengthCriteria(max_length=input_length + max_gen_len)])
|
414 |
+
out = model.sample(
|
415 |
+
tokens,
|
416 |
+
logits_processor=logits_processor,
|
417 |
+
logits_warper=logits_warper,
|
418 |
+
stopping_criteria=stopping_criteria,
|
419 |
+
return_dict_in_generate=True,
|
420 |
+
output_scores=True,
|
421 |
+
)
|
422 |
+
|
423 |
+
|
424 |
+
# print(out)
|
425 |
+
out_ids = out["sequences"][0][input_length:].cpu().numpy()
|
426 |
+
|
427 |
+
out_scores = out["scores"]
|
428 |
+
|
429 |
+
out_scores = torch.cat(out_scores, dim=0)
|
430 |
+
out_scores = torch.nn.functional.softmax(out_scores, dim=-1).cpu().numpy()
|
431 |
+
|
432 |
+
probs = []
|
433 |
+
for i in range(len(out_ids)):
|
434 |
+
probs.append(float(out_scores[i][out_ids[i]]))
|
435 |
+
|
436 |
+
# print(f"probs is {probs}")
|
437 |
+
|
438 |
+
convert_tokens = []
|
439 |
+
for t in out_ids:
|
440 |
+
if t == 100006:
|
441 |
+
convert_tokens.append("[CLS]")
|
442 |
+
else :
|
443 |
+
convert_tokens.append(id2word.get(t, "[unkonwn_token]"))
|
444 |
+
|
445 |
+
out_text = tokenizer.decode(out_ids.tolist())
|
446 |
+
|
447 |
+
|
448 |
+
out = out_text
|
449 |
+
|
450 |
+
if "[UNK]" in out:
|
451 |
+
special_index = out.index("[UNK]")
|
452 |
+
out = out[:special_index]
|
453 |
+
token_length = len(tokenizer.encode_plus(out)["input_ids"])
|
454 |
+
convert_tokens = convert_tokens[:token_length]
|
455 |
+
probs = probs[:token_length]
|
456 |
+
|
457 |
+
if "</s>" in out:
|
458 |
+
special_index = out.index("</s>")
|
459 |
+
out = out[: special_index]
|
460 |
+
token_length = len(tokenizer.encode_plus(out)["input_ids"])
|
461 |
+
convert_tokens = convert_tokens[:token_length]
|
462 |
+
probs = probs[:token_length]
|
463 |
+
|
464 |
+
if len(out) > 0 and out[0] == " ":
|
465 |
+
out = out[1:]
|
466 |
+
|
467 |
+
convert_tokens = convert_tokens[1:]
|
468 |
+
probs = probs[1:]
|
469 |
+
|
470 |
+
if isinstance(history, list):
|
471 |
+
# Update history
|
472 |
+
history.insert(0, ('ASSISTANT', out))
|
473 |
+
history.insert(0, ('USER', text))
|
474 |
+
|
475 |
+
return out
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,810 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 140181803008
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "pytorch_model-00082-of-00082.bin",
|
7 |
+
"model.embed_tokens.weight": "pytorch_model-00001-of-00082.bin",
|
8 |
+
"model.layers.0.input_layernorm.weight": "pytorch_model-00002-of-00082.bin",
|
9 |
+
"model.layers.0.mlp.down_proj.weight": "pytorch_model-00002-of-00082.bin",
|
10 |
+
"model.layers.0.mlp.gate_proj.weight": "pytorch_model-00002-of-00082.bin",
|
11 |
+
"model.layers.0.mlp.up_proj.weight": "pytorch_model-00002-of-00082.bin",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "pytorch_model-00002-of-00082.bin",
|
13 |
+
"model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00082.bin",
|
14 |
+
"model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00082.bin",
|
15 |
+
"model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00082.bin",
|
16 |
+
"model.layers.0.self_attn.rotary_emb.inv_freq": "pytorch_model-00001-of-00082.bin",
|
17 |
+
"model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00082.bin",
|
18 |
+
"model.layers.1.input_layernorm.weight": "pytorch_model-00003-of-00082.bin",
|
19 |
+
"model.layers.1.mlp.down_proj.weight": "pytorch_model-00003-of-00082.bin",
|
20 |
+
"model.layers.1.mlp.gate_proj.weight": "pytorch_model-00003-of-00082.bin",
|
21 |
+
"model.layers.1.mlp.up_proj.weight": "pytorch_model-00003-of-00082.bin",
|
22 |
+
"model.layers.1.post_attention_layernorm.weight": "pytorch_model-00003-of-00082.bin",
|
23 |
+
"model.layers.1.self_attn.k_proj.weight": "pytorch_model-00002-of-00082.bin",
|
24 |
+
"model.layers.1.self_attn.o_proj.weight": "pytorch_model-00002-of-00082.bin",
|
25 |
+
"model.layers.1.self_attn.q_proj.weight": "pytorch_model-00002-of-00082.bin",
|
26 |
+
"model.layers.1.self_attn.rotary_emb.inv_freq": "pytorch_model-00002-of-00082.bin",
|
27 |
+
"model.layers.1.self_attn.v_proj.weight": "pytorch_model-00002-of-00082.bin",
|
28 |
+
"model.layers.10.input_layernorm.weight": "pytorch_model-00012-of-00082.bin",
|
29 |
+
"model.layers.10.mlp.down_proj.weight": "pytorch_model-00012-of-00082.bin",
|
30 |
+
"model.layers.10.mlp.gate_proj.weight": "pytorch_model-00012-of-00082.bin",
|
31 |
+
"model.layers.10.mlp.up_proj.weight": "pytorch_model-00012-of-00082.bin",
|
32 |
+
"model.layers.10.post_attention_layernorm.weight": "pytorch_model-00012-of-00082.bin",
|
33 |
+
"model.layers.10.self_attn.k_proj.weight": "pytorch_model-00011-of-00082.bin",
|
34 |
+
"model.layers.10.self_attn.o_proj.weight": "pytorch_model-00011-of-00082.bin",
|
35 |
+
"model.layers.10.self_attn.q_proj.weight": "pytorch_model-00011-of-00082.bin",
|
36 |
+
"model.layers.10.self_attn.rotary_emb.inv_freq": "pytorch_model-00011-of-00082.bin",
|
37 |
+
"model.layers.10.self_attn.v_proj.weight": "pytorch_model-00011-of-00082.bin",
|
38 |
+
"model.layers.11.input_layernorm.weight": "pytorch_model-00013-of-00082.bin",
|
39 |
+
"model.layers.11.mlp.down_proj.weight": "pytorch_model-00013-of-00082.bin",
|
40 |
+
"model.layers.11.mlp.gate_proj.weight": "pytorch_model-00013-of-00082.bin",
|
41 |
+
"model.layers.11.mlp.up_proj.weight": "pytorch_model-00013-of-00082.bin",
|
42 |
+
"model.layers.11.post_attention_layernorm.weight": "pytorch_model-00013-of-00082.bin",
|
43 |
+
"model.layers.11.self_attn.k_proj.weight": "pytorch_model-00012-of-00082.bin",
|
44 |
+
"model.layers.11.self_attn.o_proj.weight": "pytorch_model-00012-of-00082.bin",
|
45 |
+
"model.layers.11.self_attn.q_proj.weight": "pytorch_model-00012-of-00082.bin",
|
46 |
+
"model.layers.11.self_attn.rotary_emb.inv_freq": "pytorch_model-00012-of-00082.bin",
|
47 |
+
"model.layers.11.self_attn.v_proj.weight": "pytorch_model-00012-of-00082.bin",
|
48 |
+
"model.layers.12.input_layernorm.weight": "pytorch_model-00014-of-00082.bin",
|
49 |
+
"model.layers.12.mlp.down_proj.weight": "pytorch_model-00014-of-00082.bin",
|
50 |
+
"model.layers.12.mlp.gate_proj.weight": "pytorch_model-00014-of-00082.bin",
|
51 |
+
"model.layers.12.mlp.up_proj.weight": "pytorch_model-00014-of-00082.bin",
|
52 |
+
"model.layers.12.post_attention_layernorm.weight": "pytorch_model-00014-of-00082.bin",
|
53 |
+
"model.layers.12.self_attn.k_proj.weight": "pytorch_model-00013-of-00082.bin",
|
54 |
+
"model.layers.12.self_attn.o_proj.weight": "pytorch_model-00013-of-00082.bin",
|
55 |
+
"model.layers.12.self_attn.q_proj.weight": "pytorch_model-00013-of-00082.bin",
|
56 |
+
"model.layers.12.self_attn.rotary_emb.inv_freq": "pytorch_model-00013-of-00082.bin",
|
57 |
+
"model.layers.12.self_attn.v_proj.weight": "pytorch_model-00013-of-00082.bin",
|
58 |
+
"model.layers.13.input_layernorm.weight": "pytorch_model-00015-of-00082.bin",
|
59 |
+
"model.layers.13.mlp.down_proj.weight": "pytorch_model-00015-of-00082.bin",
|
60 |
+
"model.layers.13.mlp.gate_proj.weight": "pytorch_model-00015-of-00082.bin",
|
61 |
+
"model.layers.13.mlp.up_proj.weight": "pytorch_model-00015-of-00082.bin",
|
62 |
+
"model.layers.13.post_attention_layernorm.weight": "pytorch_model-00015-of-00082.bin",
|
63 |
+
"model.layers.13.self_attn.k_proj.weight": "pytorch_model-00014-of-00082.bin",
|
64 |
+
"model.layers.13.self_attn.o_proj.weight": "pytorch_model-00014-of-00082.bin",
|
65 |
+
"model.layers.13.self_attn.q_proj.weight": "pytorch_model-00014-of-00082.bin",
|
66 |
+
"model.layers.13.self_attn.rotary_emb.inv_freq": "pytorch_model-00014-of-00082.bin",
|
67 |
+
"model.layers.13.self_attn.v_proj.weight": "pytorch_model-00014-of-00082.bin",
|
68 |
+
"model.layers.14.input_layernorm.weight": "pytorch_model-00016-of-00082.bin",
|
69 |
+
"model.layers.14.mlp.down_proj.weight": "pytorch_model-00016-of-00082.bin",
|
70 |
+
"model.layers.14.mlp.gate_proj.weight": "pytorch_model-00016-of-00082.bin",
|
71 |
+
"model.layers.14.mlp.up_proj.weight": "pytorch_model-00016-of-00082.bin",
|
72 |
+
"model.layers.14.post_attention_layernorm.weight": "pytorch_model-00016-of-00082.bin",
|
73 |
+
"model.layers.14.self_attn.k_proj.weight": "pytorch_model-00015-of-00082.bin",
|
74 |
+
"model.layers.14.self_attn.o_proj.weight": "pytorch_model-00015-of-00082.bin",
|
75 |
+
"model.layers.14.self_attn.q_proj.weight": "pytorch_model-00015-of-00082.bin",
|
76 |
+
"model.layers.14.self_attn.rotary_emb.inv_freq": "pytorch_model-00015-of-00082.bin",
|
77 |
+
"model.layers.14.self_attn.v_proj.weight": "pytorch_model-00015-of-00082.bin",
|
78 |
+
"model.layers.15.input_layernorm.weight": "pytorch_model-00017-of-00082.bin",
|
79 |
+
"model.layers.15.mlp.down_proj.weight": "pytorch_model-00017-of-00082.bin",
|
80 |
+
"model.layers.15.mlp.gate_proj.weight": "pytorch_model-00017-of-00082.bin",
|
81 |
+
"model.layers.15.mlp.up_proj.weight": "pytorch_model-00017-of-00082.bin",
|
82 |
+
"model.layers.15.post_attention_layernorm.weight": "pytorch_model-00017-of-00082.bin",
|
83 |
+
"model.layers.15.self_attn.k_proj.weight": "pytorch_model-00016-of-00082.bin",
|
84 |
+
"model.layers.15.self_attn.o_proj.weight": "pytorch_model-00016-of-00082.bin",
|
85 |
+
"model.layers.15.self_attn.q_proj.weight": "pytorch_model-00016-of-00082.bin",
|
86 |
+
"model.layers.15.self_attn.rotary_emb.inv_freq": "pytorch_model-00016-of-00082.bin",
|
87 |
+
"model.layers.15.self_attn.v_proj.weight": "pytorch_model-00016-of-00082.bin",
|
88 |
+
"model.layers.16.input_layernorm.weight": "pytorch_model-00018-of-00082.bin",
|
89 |
+
"model.layers.16.mlp.down_proj.weight": "pytorch_model-00018-of-00082.bin",
|
90 |
+
"model.layers.16.mlp.gate_proj.weight": "pytorch_model-00018-of-00082.bin",
|
91 |
+
"model.layers.16.mlp.up_proj.weight": "pytorch_model-00018-of-00082.bin",
|
92 |
+
"model.layers.16.post_attention_layernorm.weight": "pytorch_model-00018-of-00082.bin",
|
93 |
+
"model.layers.16.self_attn.k_proj.weight": "pytorch_model-00017-of-00082.bin",
|
94 |
+
"model.layers.16.self_attn.o_proj.weight": "pytorch_model-00017-of-00082.bin",
|
95 |
+
"model.layers.16.self_attn.q_proj.weight": "pytorch_model-00017-of-00082.bin",
|
96 |
+
"model.layers.16.self_attn.rotary_emb.inv_freq": "pytorch_model-00017-of-00082.bin",
|
97 |
+
"model.layers.16.self_attn.v_proj.weight": "pytorch_model-00017-of-00082.bin",
|
98 |
+
"model.layers.17.input_layernorm.weight": "pytorch_model-00019-of-00082.bin",
|
99 |
+
"model.layers.17.mlp.down_proj.weight": "pytorch_model-00019-of-00082.bin",
|
100 |
+
"model.layers.17.mlp.gate_proj.weight": "pytorch_model-00019-of-00082.bin",
|
101 |
+
"model.layers.17.mlp.up_proj.weight": "pytorch_model-00019-of-00082.bin",
|
102 |
+
"model.layers.17.post_attention_layernorm.weight": "pytorch_model-00019-of-00082.bin",
|
103 |
+
"model.layers.17.self_attn.k_proj.weight": "pytorch_model-00018-of-00082.bin",
|
104 |
+
"model.layers.17.self_attn.o_proj.weight": "pytorch_model-00018-of-00082.bin",
|
105 |
+
"model.layers.17.self_attn.q_proj.weight": "pytorch_model-00018-of-00082.bin",
|
106 |
+
"model.layers.17.self_attn.rotary_emb.inv_freq": "pytorch_model-00018-of-00082.bin",
|
107 |
+
"model.layers.17.self_attn.v_proj.weight": "pytorch_model-00018-of-00082.bin",
|
108 |
+
"model.layers.18.input_layernorm.weight": "pytorch_model-00020-of-00082.bin",
|
109 |
+
"model.layers.18.mlp.down_proj.weight": "pytorch_model-00020-of-00082.bin",
|
110 |
+
"model.layers.18.mlp.gate_proj.weight": "pytorch_model-00020-of-00082.bin",
|
111 |
+
"model.layers.18.mlp.up_proj.weight": "pytorch_model-00020-of-00082.bin",
|
112 |
+
"model.layers.18.post_attention_layernorm.weight": "pytorch_model-00020-of-00082.bin",
|
113 |
+
"model.layers.18.self_attn.k_proj.weight": "pytorch_model-00019-of-00082.bin",
|
114 |
+
"model.layers.18.self_attn.o_proj.weight": "pytorch_model-00019-of-00082.bin",
|
115 |
+
"model.layers.18.self_attn.q_proj.weight": "pytorch_model-00019-of-00082.bin",
|
116 |
+
"model.layers.18.self_attn.rotary_emb.inv_freq": "pytorch_model-00019-of-00082.bin",
|
117 |
+
"model.layers.18.self_attn.v_proj.weight": "pytorch_model-00019-of-00082.bin",
|
118 |
+
"model.layers.19.input_layernorm.weight": "pytorch_model-00021-of-00082.bin",
|
119 |
+
"model.layers.19.mlp.down_proj.weight": "pytorch_model-00021-of-00082.bin",
|
120 |
+
"model.layers.19.mlp.gate_proj.weight": "pytorch_model-00021-of-00082.bin",
|
121 |
+
"model.layers.19.mlp.up_proj.weight": "pytorch_model-00021-of-00082.bin",
|
122 |
+
"model.layers.19.post_attention_layernorm.weight": "pytorch_model-00021-of-00082.bin",
|
123 |
+
"model.layers.19.self_attn.k_proj.weight": "pytorch_model-00020-of-00082.bin",
|
124 |
+
"model.layers.19.self_attn.o_proj.weight": "pytorch_model-00020-of-00082.bin",
|
125 |
+
"model.layers.19.self_attn.q_proj.weight": "pytorch_model-00020-of-00082.bin",
|
126 |
+
"model.layers.19.self_attn.rotary_emb.inv_freq": "pytorch_model-00020-of-00082.bin",
|
127 |
+
"model.layers.19.self_attn.v_proj.weight": "pytorch_model-00020-of-00082.bin",
|
128 |
+
"model.layers.2.input_layernorm.weight": "pytorch_model-00004-of-00082.bin",
|
129 |
+
"model.layers.2.mlp.down_proj.weight": "pytorch_model-00004-of-00082.bin",
|
130 |
+
"model.layers.2.mlp.gate_proj.weight": "pytorch_model-00004-of-00082.bin",
|
131 |
+
"model.layers.2.mlp.up_proj.weight": "pytorch_model-00004-of-00082.bin",
|
132 |
+
"model.layers.2.post_attention_layernorm.weight": "pytorch_model-00004-of-00082.bin",
|
133 |
+
"model.layers.2.self_attn.k_proj.weight": "pytorch_model-00003-of-00082.bin",
|
134 |
+
"model.layers.2.self_attn.o_proj.weight": "pytorch_model-00003-of-00082.bin",
|
135 |
+
"model.layers.2.self_attn.q_proj.weight": "pytorch_model-00003-of-00082.bin",
|
136 |
+
"model.layers.2.self_attn.rotary_emb.inv_freq": "pytorch_model-00003-of-00082.bin",
|
137 |
+
"model.layers.2.self_attn.v_proj.weight": "pytorch_model-00003-of-00082.bin",
|
138 |
+
"model.layers.20.input_layernorm.weight": "pytorch_model-00022-of-00082.bin",
|
139 |
+
"model.layers.20.mlp.down_proj.weight": "pytorch_model-00022-of-00082.bin",
|
140 |
+
"model.layers.20.mlp.gate_proj.weight": "pytorch_model-00022-of-00082.bin",
|
141 |
+
"model.layers.20.mlp.up_proj.weight": "pytorch_model-00022-of-00082.bin",
|
142 |
+
"model.layers.20.post_attention_layernorm.weight": "pytorch_model-00022-of-00082.bin",
|
143 |
+
"model.layers.20.self_attn.k_proj.weight": "pytorch_model-00021-of-00082.bin",
|
144 |
+
"model.layers.20.self_attn.o_proj.weight": "pytorch_model-00021-of-00082.bin",
|
145 |
+
"model.layers.20.self_attn.q_proj.weight": "pytorch_model-00021-of-00082.bin",
|
146 |
+
"model.layers.20.self_attn.rotary_emb.inv_freq": "pytorch_model-00021-of-00082.bin",
|
147 |
+
"model.layers.20.self_attn.v_proj.weight": "pytorch_model-00021-of-00082.bin",
|
148 |
+
"model.layers.21.input_layernorm.weight": "pytorch_model-00023-of-00082.bin",
|
149 |
+
"model.layers.21.mlp.down_proj.weight": "pytorch_model-00023-of-00082.bin",
|
150 |
+
"model.layers.21.mlp.gate_proj.weight": "pytorch_model-00023-of-00082.bin",
|
151 |
+
"model.layers.21.mlp.up_proj.weight": "pytorch_model-00023-of-00082.bin",
|
152 |
+
"model.layers.21.post_attention_layernorm.weight": "pytorch_model-00023-of-00082.bin",
|
153 |
+
"model.layers.21.self_attn.k_proj.weight": "pytorch_model-00022-of-00082.bin",
|
154 |
+
"model.layers.21.self_attn.o_proj.weight": "pytorch_model-00022-of-00082.bin",
|
155 |
+
"model.layers.21.self_attn.q_proj.weight": "pytorch_model-00022-of-00082.bin",
|
156 |
+
"model.layers.21.self_attn.rotary_emb.inv_freq": "pytorch_model-00022-of-00082.bin",
|
157 |
+
"model.layers.21.self_attn.v_proj.weight": "pytorch_model-00022-of-00082.bin",
|
158 |
+
"model.layers.22.input_layernorm.weight": "pytorch_model-00024-of-00082.bin",
|
159 |
+
"model.layers.22.mlp.down_proj.weight": "pytorch_model-00024-of-00082.bin",
|
160 |
+
"model.layers.22.mlp.gate_proj.weight": "pytorch_model-00024-of-00082.bin",
|
161 |
+
"model.layers.22.mlp.up_proj.weight": "pytorch_model-00024-of-00082.bin",
|
162 |
+
"model.layers.22.post_attention_layernorm.weight": "pytorch_model-00024-of-00082.bin",
|
163 |
+
"model.layers.22.self_attn.k_proj.weight": "pytorch_model-00023-of-00082.bin",
|
164 |
+
"model.layers.22.self_attn.o_proj.weight": "pytorch_model-00023-of-00082.bin",
|
165 |
+
"model.layers.22.self_attn.q_proj.weight": "pytorch_model-00023-of-00082.bin",
|
166 |
+
"model.layers.22.self_attn.rotary_emb.inv_freq": "pytorch_model-00023-of-00082.bin",
|
167 |
+
"model.layers.22.self_attn.v_proj.weight": "pytorch_model-00023-of-00082.bin",
|
168 |
+
"model.layers.23.input_layernorm.weight": "pytorch_model-00025-of-00082.bin",
|
169 |
+
"model.layers.23.mlp.down_proj.weight": "pytorch_model-00025-of-00082.bin",
|
170 |
+
"model.layers.23.mlp.gate_proj.weight": "pytorch_model-00025-of-00082.bin",
|
171 |
+
"model.layers.23.mlp.up_proj.weight": "pytorch_model-00025-of-00082.bin",
|
172 |
+
"model.layers.23.post_attention_layernorm.weight": "pytorch_model-00025-of-00082.bin",
|
173 |
+
"model.layers.23.self_attn.k_proj.weight": "pytorch_model-00024-of-00082.bin",
|
174 |
+
"model.layers.23.self_attn.o_proj.weight": "pytorch_model-00024-of-00082.bin",
|
175 |
+
"model.layers.23.self_attn.q_proj.weight": "pytorch_model-00024-of-00082.bin",
|
176 |
+
"model.layers.23.self_attn.rotary_emb.inv_freq": "pytorch_model-00024-of-00082.bin",
|
177 |
+
"model.layers.23.self_attn.v_proj.weight": "pytorch_model-00024-of-00082.bin",
|
178 |
+
"model.layers.24.input_layernorm.weight": "pytorch_model-00026-of-00082.bin",
|
179 |
+
"model.layers.24.mlp.down_proj.weight": "pytorch_model-00026-of-00082.bin",
|
180 |
+
"model.layers.24.mlp.gate_proj.weight": "pytorch_model-00026-of-00082.bin",
|
181 |
+
"model.layers.24.mlp.up_proj.weight": "pytorch_model-00026-of-00082.bin",
|
182 |
+
"model.layers.24.post_attention_layernorm.weight": "pytorch_model-00026-of-00082.bin",
|
183 |
+
"model.layers.24.self_attn.k_proj.weight": "pytorch_model-00025-of-00082.bin",
|
184 |
+
"model.layers.24.self_attn.o_proj.weight": "pytorch_model-00025-of-00082.bin",
|
185 |
+
"model.layers.24.self_attn.q_proj.weight": "pytorch_model-00025-of-00082.bin",
|
186 |
+
"model.layers.24.self_attn.rotary_emb.inv_freq": "pytorch_model-00025-of-00082.bin",
|
187 |
+
"model.layers.24.self_attn.v_proj.weight": "pytorch_model-00025-of-00082.bin",
|
188 |
+
"model.layers.25.input_layernorm.weight": "pytorch_model-00027-of-00082.bin",
|
189 |
+
"model.layers.25.mlp.down_proj.weight": "pytorch_model-00027-of-00082.bin",
|
190 |
+
"model.layers.25.mlp.gate_proj.weight": "pytorch_model-00027-of-00082.bin",
|
191 |
+
"model.layers.25.mlp.up_proj.weight": "pytorch_model-00027-of-00082.bin",
|
192 |
+
"model.layers.25.post_attention_layernorm.weight": "pytorch_model-00027-of-00082.bin",
|
193 |
+
"model.layers.25.self_attn.k_proj.weight": "pytorch_model-00026-of-00082.bin",
|
194 |
+
"model.layers.25.self_attn.o_proj.weight": "pytorch_model-00026-of-00082.bin",
|
195 |
+
"model.layers.25.self_attn.q_proj.weight": "pytorch_model-00026-of-00082.bin",
|
196 |
+
"model.layers.25.self_attn.rotary_emb.inv_freq": "pytorch_model-00026-of-00082.bin",
|
197 |
+
"model.layers.25.self_attn.v_proj.weight": "pytorch_model-00026-of-00082.bin",
|
198 |
+
"model.layers.26.input_layernorm.weight": "pytorch_model-00028-of-00082.bin",
|
199 |
+
"model.layers.26.mlp.down_proj.weight": "pytorch_model-00028-of-00082.bin",
|
200 |
+
"model.layers.26.mlp.gate_proj.weight": "pytorch_model-00028-of-00082.bin",
|
201 |
+
"model.layers.26.mlp.up_proj.weight": "pytorch_model-00028-of-00082.bin",
|
202 |
+
"model.layers.26.post_attention_layernorm.weight": "pytorch_model-00028-of-00082.bin",
|
203 |
+
"model.layers.26.self_attn.k_proj.weight": "pytorch_model-00027-of-00082.bin",
|
204 |
+
"model.layers.26.self_attn.o_proj.weight": "pytorch_model-00027-of-00082.bin",
|
205 |
+
"model.layers.26.self_attn.q_proj.weight": "pytorch_model-00027-of-00082.bin",
|
206 |
+
"model.layers.26.self_attn.rotary_emb.inv_freq": "pytorch_model-00027-of-00082.bin",
|
207 |
+
"model.layers.26.self_attn.v_proj.weight": "pytorch_model-00027-of-00082.bin",
|
208 |
+
"model.layers.27.input_layernorm.weight": "pytorch_model-00029-of-00082.bin",
|
209 |
+
"model.layers.27.mlp.down_proj.weight": "pytorch_model-00029-of-00082.bin",
|
210 |
+
"model.layers.27.mlp.gate_proj.weight": "pytorch_model-00029-of-00082.bin",
|
211 |
+
"model.layers.27.mlp.up_proj.weight": "pytorch_model-00029-of-00082.bin",
|
212 |
+
"model.layers.27.post_attention_layernorm.weight": "pytorch_model-00029-of-00082.bin",
|
213 |
+
"model.layers.27.self_attn.k_proj.weight": "pytorch_model-00028-of-00082.bin",
|
214 |
+
"model.layers.27.self_attn.o_proj.weight": "pytorch_model-00028-of-00082.bin",
|
215 |
+
"model.layers.27.self_attn.q_proj.weight": "pytorch_model-00028-of-00082.bin",
|
216 |
+
"model.layers.27.self_attn.rotary_emb.inv_freq": "pytorch_model-00028-of-00082.bin",
|
217 |
+
"model.layers.27.self_attn.v_proj.weight": "pytorch_model-00028-of-00082.bin",
|
218 |
+
"model.layers.28.input_layernorm.weight": "pytorch_model-00030-of-00082.bin",
|
219 |
+
"model.layers.28.mlp.down_proj.weight": "pytorch_model-00030-of-00082.bin",
|
220 |
+
"model.layers.28.mlp.gate_proj.weight": "pytorch_model-00030-of-00082.bin",
|
221 |
+
"model.layers.28.mlp.up_proj.weight": "pytorch_model-00030-of-00082.bin",
|
222 |
+
"model.layers.28.post_attention_layernorm.weight": "pytorch_model-00030-of-00082.bin",
|
223 |
+
"model.layers.28.self_attn.k_proj.weight": "pytorch_model-00029-of-00082.bin",
|
224 |
+
"model.layers.28.self_attn.o_proj.weight": "pytorch_model-00029-of-00082.bin",
|
225 |
+
"model.layers.28.self_attn.q_proj.weight": "pytorch_model-00029-of-00082.bin",
|
226 |
+
"model.layers.28.self_attn.rotary_emb.inv_freq": "pytorch_model-00029-of-00082.bin",
|
227 |
+
"model.layers.28.self_attn.v_proj.weight": "pytorch_model-00029-of-00082.bin",
|
228 |
+
"model.layers.29.input_layernorm.weight": "pytorch_model-00031-of-00082.bin",
|
229 |
+
"model.layers.29.mlp.down_proj.weight": "pytorch_model-00031-of-00082.bin",
|
230 |
+
"model.layers.29.mlp.gate_proj.weight": "pytorch_model-00031-of-00082.bin",
|
231 |
+
"model.layers.29.mlp.up_proj.weight": "pytorch_model-00031-of-00082.bin",
|
232 |
+
"model.layers.29.post_attention_layernorm.weight": "pytorch_model-00031-of-00082.bin",
|
233 |
+
"model.layers.29.self_attn.k_proj.weight": "pytorch_model-00030-of-00082.bin",
|
234 |
+
"model.layers.29.self_attn.o_proj.weight": "pytorch_model-00030-of-00082.bin",
|
235 |
+
"model.layers.29.self_attn.q_proj.weight": "pytorch_model-00030-of-00082.bin",
|
236 |
+
"model.layers.29.self_attn.rotary_emb.inv_freq": "pytorch_model-00030-of-00082.bin",
|
237 |
+
"model.layers.29.self_attn.v_proj.weight": "pytorch_model-00030-of-00082.bin",
|
238 |
+
"model.layers.3.input_layernorm.weight": "pytorch_model-00005-of-00082.bin",
|
239 |
+
"model.layers.3.mlp.down_proj.weight": "pytorch_model-00005-of-00082.bin",
|
240 |
+
"model.layers.3.mlp.gate_proj.weight": "pytorch_model-00005-of-00082.bin",
|
241 |
+
"model.layers.3.mlp.up_proj.weight": "pytorch_model-00005-of-00082.bin",
|
242 |
+
"model.layers.3.post_attention_layernorm.weight": "pytorch_model-00005-of-00082.bin",
|
243 |
+
"model.layers.3.self_attn.k_proj.weight": "pytorch_model-00004-of-00082.bin",
|
244 |
+
"model.layers.3.self_attn.o_proj.weight": "pytorch_model-00004-of-00082.bin",
|
245 |
+
"model.layers.3.self_attn.q_proj.weight": "pytorch_model-00004-of-00082.bin",
|
246 |
+
"model.layers.3.self_attn.rotary_emb.inv_freq": "pytorch_model-00004-of-00082.bin",
|
247 |
+
"model.layers.3.self_attn.v_proj.weight": "pytorch_model-00004-of-00082.bin",
|
248 |
+
"model.layers.30.input_layernorm.weight": "pytorch_model-00032-of-00082.bin",
|
249 |
+
"model.layers.30.mlp.down_proj.weight": "pytorch_model-00032-of-00082.bin",
|
250 |
+
"model.layers.30.mlp.gate_proj.weight": "pytorch_model-00032-of-00082.bin",
|
251 |
+
"model.layers.30.mlp.up_proj.weight": "pytorch_model-00032-of-00082.bin",
|
252 |
+
"model.layers.30.post_attention_layernorm.weight": "pytorch_model-00032-of-00082.bin",
|
253 |
+
"model.layers.30.self_attn.k_proj.weight": "pytorch_model-00031-of-00082.bin",
|
254 |
+
"model.layers.30.self_attn.o_proj.weight": "pytorch_model-00031-of-00082.bin",
|
255 |
+
"model.layers.30.self_attn.q_proj.weight": "pytorch_model-00031-of-00082.bin",
|
256 |
+
"model.layers.30.self_attn.rotary_emb.inv_freq": "pytorch_model-00031-of-00082.bin",
|
257 |
+
"model.layers.30.self_attn.v_proj.weight": "pytorch_model-00031-of-00082.bin",
|
258 |
+
"model.layers.31.input_layernorm.weight": "pytorch_model-00033-of-00082.bin",
|
259 |
+
"model.layers.31.mlp.down_proj.weight": "pytorch_model-00033-of-00082.bin",
|
260 |
+
"model.layers.31.mlp.gate_proj.weight": "pytorch_model-00033-of-00082.bin",
|
261 |
+
"model.layers.31.mlp.up_proj.weight": "pytorch_model-00033-of-00082.bin",
|
262 |
+
"model.layers.31.post_attention_layernorm.weight": "pytorch_model-00033-of-00082.bin",
|
263 |
+
"model.layers.31.self_attn.k_proj.weight": "pytorch_model-00032-of-00082.bin",
|
264 |
+
"model.layers.31.self_attn.o_proj.weight": "pytorch_model-00032-of-00082.bin",
|
265 |
+
"model.layers.31.self_attn.q_proj.weight": "pytorch_model-00032-of-00082.bin",
|
266 |
+
"model.layers.31.self_attn.rotary_emb.inv_freq": "pytorch_model-00032-of-00082.bin",
|
267 |
+
"model.layers.31.self_attn.v_proj.weight": "pytorch_model-00032-of-00082.bin",
|
268 |
+
"model.layers.32.input_layernorm.weight": "pytorch_model-00034-of-00082.bin",
|
269 |
+
"model.layers.32.mlp.down_proj.weight": "pytorch_model-00034-of-00082.bin",
|
270 |
+
"model.layers.32.mlp.gate_proj.weight": "pytorch_model-00034-of-00082.bin",
|
271 |
+
"model.layers.32.mlp.up_proj.weight": "pytorch_model-00034-of-00082.bin",
|
272 |
+
"model.layers.32.post_attention_layernorm.weight": "pytorch_model-00034-of-00082.bin",
|
273 |
+
"model.layers.32.self_attn.k_proj.weight": "pytorch_model-00033-of-00082.bin",
|
274 |
+
"model.layers.32.self_attn.o_proj.weight": "pytorch_model-00033-of-00082.bin",
|
275 |
+
"model.layers.32.self_attn.q_proj.weight": "pytorch_model-00033-of-00082.bin",
|
276 |
+
"model.layers.32.self_attn.rotary_emb.inv_freq": "pytorch_model-00033-of-00082.bin",
|
277 |
+
"model.layers.32.self_attn.v_proj.weight": "pytorch_model-00033-of-00082.bin",
|
278 |
+
"model.layers.33.input_layernorm.weight": "pytorch_model-00035-of-00082.bin",
|
279 |
+
"model.layers.33.mlp.down_proj.weight": "pytorch_model-00035-of-00082.bin",
|
280 |
+
"model.layers.33.mlp.gate_proj.weight": "pytorch_model-00035-of-00082.bin",
|
281 |
+
"model.layers.33.mlp.up_proj.weight": "pytorch_model-00035-of-00082.bin",
|
282 |
+
"model.layers.33.post_attention_layernorm.weight": "pytorch_model-00035-of-00082.bin",
|
283 |
+
"model.layers.33.self_attn.k_proj.weight": "pytorch_model-00034-of-00082.bin",
|
284 |
+
"model.layers.33.self_attn.o_proj.weight": "pytorch_model-00034-of-00082.bin",
|
285 |
+
"model.layers.33.self_attn.q_proj.weight": "pytorch_model-00034-of-00082.bin",
|
286 |
+
"model.layers.33.self_attn.rotary_emb.inv_freq": "pytorch_model-00034-of-00082.bin",
|
287 |
+
"model.layers.33.self_attn.v_proj.weight": "pytorch_model-00034-of-00082.bin",
|
288 |
+
"model.layers.34.input_layernorm.weight": "pytorch_model-00036-of-00082.bin",
|
289 |
+
"model.layers.34.mlp.down_proj.weight": "pytorch_model-00036-of-00082.bin",
|
290 |
+
"model.layers.34.mlp.gate_proj.weight": "pytorch_model-00036-of-00082.bin",
|
291 |
+
"model.layers.34.mlp.up_proj.weight": "pytorch_model-00036-of-00082.bin",
|
292 |
+
"model.layers.34.post_attention_layernorm.weight": "pytorch_model-00036-of-00082.bin",
|
293 |
+
"model.layers.34.self_attn.k_proj.weight": "pytorch_model-00035-of-00082.bin",
|
294 |
+
"model.layers.34.self_attn.o_proj.weight": "pytorch_model-00035-of-00082.bin",
|
295 |
+
"model.layers.34.self_attn.q_proj.weight": "pytorch_model-00035-of-00082.bin",
|
296 |
+
"model.layers.34.self_attn.rotary_emb.inv_freq": "pytorch_model-00035-of-00082.bin",
|
297 |
+
"model.layers.34.self_attn.v_proj.weight": "pytorch_model-00035-of-00082.bin",
|
298 |
+
"model.layers.35.input_layernorm.weight": "pytorch_model-00037-of-00082.bin",
|
299 |
+
"model.layers.35.mlp.down_proj.weight": "pytorch_model-00037-of-00082.bin",
|
300 |
+
"model.layers.35.mlp.gate_proj.weight": "pytorch_model-00037-of-00082.bin",
|
301 |
+
"model.layers.35.mlp.up_proj.weight": "pytorch_model-00037-of-00082.bin",
|
302 |
+
"model.layers.35.post_attention_layernorm.weight": "pytorch_model-00037-of-00082.bin",
|
303 |
+
"model.layers.35.self_attn.k_proj.weight": "pytorch_model-00036-of-00082.bin",
|
304 |
+
"model.layers.35.self_attn.o_proj.weight": "pytorch_model-00036-of-00082.bin",
|
305 |
+
"model.layers.35.self_attn.q_proj.weight": "pytorch_model-00036-of-00082.bin",
|
306 |
+
"model.layers.35.self_attn.rotary_emb.inv_freq": "pytorch_model-00036-of-00082.bin",
|
307 |
+
"model.layers.35.self_attn.v_proj.weight": "pytorch_model-00036-of-00082.bin",
|
308 |
+
"model.layers.36.input_layernorm.weight": "pytorch_model-00038-of-00082.bin",
|
309 |
+
"model.layers.36.mlp.down_proj.weight": "pytorch_model-00038-of-00082.bin",
|
310 |
+
"model.layers.36.mlp.gate_proj.weight": "pytorch_model-00038-of-00082.bin",
|
311 |
+
"model.layers.36.mlp.up_proj.weight": "pytorch_model-00038-of-00082.bin",
|
312 |
+
"model.layers.36.post_attention_layernorm.weight": "pytorch_model-00038-of-00082.bin",
|
313 |
+
"model.layers.36.self_attn.k_proj.weight": "pytorch_model-00037-of-00082.bin",
|
314 |
+
"model.layers.36.self_attn.o_proj.weight": "pytorch_model-00037-of-00082.bin",
|
315 |
+
"model.layers.36.self_attn.q_proj.weight": "pytorch_model-00037-of-00082.bin",
|
316 |
+
"model.layers.36.self_attn.rotary_emb.inv_freq": "pytorch_model-00037-of-00082.bin",
|
317 |
+
"model.layers.36.self_attn.v_proj.weight": "pytorch_model-00037-of-00082.bin",
|
318 |
+
"model.layers.37.input_layernorm.weight": "pytorch_model-00039-of-00082.bin",
|
319 |
+
"model.layers.37.mlp.down_proj.weight": "pytorch_model-00039-of-00082.bin",
|
320 |
+
"model.layers.37.mlp.gate_proj.weight": "pytorch_model-00039-of-00082.bin",
|
321 |
+
"model.layers.37.mlp.up_proj.weight": "pytorch_model-00039-of-00082.bin",
|
322 |
+
"model.layers.37.post_attention_layernorm.weight": "pytorch_model-00039-of-00082.bin",
|
323 |
+
"model.layers.37.self_attn.k_proj.weight": "pytorch_model-00038-of-00082.bin",
|
324 |
+
"model.layers.37.self_attn.o_proj.weight": "pytorch_model-00038-of-00082.bin",
|
325 |
+
"model.layers.37.self_attn.q_proj.weight": "pytorch_model-00038-of-00082.bin",
|
326 |
+
"model.layers.37.self_attn.rotary_emb.inv_freq": "pytorch_model-00038-of-00082.bin",
|
327 |
+
"model.layers.37.self_attn.v_proj.weight": "pytorch_model-00038-of-00082.bin",
|
328 |
+
"model.layers.38.input_layernorm.weight": "pytorch_model-00040-of-00082.bin",
|
329 |
+
"model.layers.38.mlp.down_proj.weight": "pytorch_model-00040-of-00082.bin",
|
330 |
+
"model.layers.38.mlp.gate_proj.weight": "pytorch_model-00040-of-00082.bin",
|
331 |
+
"model.layers.38.mlp.up_proj.weight": "pytorch_model-00040-of-00082.bin",
|
332 |
+
"model.layers.38.post_attention_layernorm.weight": "pytorch_model-00040-of-00082.bin",
|
333 |
+
"model.layers.38.self_attn.k_proj.weight": "pytorch_model-00039-of-00082.bin",
|
334 |
+
"model.layers.38.self_attn.o_proj.weight": "pytorch_model-00039-of-00082.bin",
|
335 |
+
"model.layers.38.self_attn.q_proj.weight": "pytorch_model-00039-of-00082.bin",
|
336 |
+
"model.layers.38.self_attn.rotary_emb.inv_freq": "pytorch_model-00039-of-00082.bin",
|
337 |
+
"model.layers.38.self_attn.v_proj.weight": "pytorch_model-00039-of-00082.bin",
|
338 |
+
"model.layers.39.input_layernorm.weight": "pytorch_model-00041-of-00082.bin",
|
339 |
+
"model.layers.39.mlp.down_proj.weight": "pytorch_model-00041-of-00082.bin",
|
340 |
+
"model.layers.39.mlp.gate_proj.weight": "pytorch_model-00041-of-00082.bin",
|
341 |
+
"model.layers.39.mlp.up_proj.weight": "pytorch_model-00041-of-00082.bin",
|
342 |
+
"model.layers.39.post_attention_layernorm.weight": "pytorch_model-00041-of-00082.bin",
|
343 |
+
"model.layers.39.self_attn.k_proj.weight": "pytorch_model-00040-of-00082.bin",
|
344 |
+
"model.layers.39.self_attn.o_proj.weight": "pytorch_model-00040-of-00082.bin",
|
345 |
+
"model.layers.39.self_attn.q_proj.weight": "pytorch_model-00040-of-00082.bin",
|
346 |
+
"model.layers.39.self_attn.rotary_emb.inv_freq": "pytorch_model-00040-of-00082.bin",
|
347 |
+
"model.layers.39.self_attn.v_proj.weight": "pytorch_model-00040-of-00082.bin",
|
348 |
+
"model.layers.4.input_layernorm.weight": "pytorch_model-00006-of-00082.bin",
|
349 |
+
"model.layers.4.mlp.down_proj.weight": "pytorch_model-00006-of-00082.bin",
|
350 |
+
"model.layers.4.mlp.gate_proj.weight": "pytorch_model-00006-of-00082.bin",
|
351 |
+
"model.layers.4.mlp.up_proj.weight": "pytorch_model-00006-of-00082.bin",
|
352 |
+
"model.layers.4.post_attention_layernorm.weight": "pytorch_model-00006-of-00082.bin",
|
353 |
+
"model.layers.4.self_attn.k_proj.weight": "pytorch_model-00005-of-00082.bin",
|
354 |
+
"model.layers.4.self_attn.o_proj.weight": "pytorch_model-00005-of-00082.bin",
|
355 |
+
"model.layers.4.self_attn.q_proj.weight": "pytorch_model-00005-of-00082.bin",
|
356 |
+
"model.layers.4.self_attn.rotary_emb.inv_freq": "pytorch_model-00005-of-00082.bin",
|
357 |
+
"model.layers.4.self_attn.v_proj.weight": "pytorch_model-00005-of-00082.bin",
|
358 |
+
"model.layers.40.input_layernorm.weight": "pytorch_model-00042-of-00082.bin",
|
359 |
+
"model.layers.40.mlp.down_proj.weight": "pytorch_model-00042-of-00082.bin",
|
360 |
+
"model.layers.40.mlp.gate_proj.weight": "pytorch_model-00042-of-00082.bin",
|
361 |
+
"model.layers.40.mlp.up_proj.weight": "pytorch_model-00042-of-00082.bin",
|
362 |
+
"model.layers.40.post_attention_layernorm.weight": "pytorch_model-00042-of-00082.bin",
|
363 |
+
"model.layers.40.self_attn.k_proj.weight": "pytorch_model-00041-of-00082.bin",
|
364 |
+
"model.layers.40.self_attn.o_proj.weight": "pytorch_model-00041-of-00082.bin",
|
365 |
+
"model.layers.40.self_attn.q_proj.weight": "pytorch_model-00041-of-00082.bin",
|
366 |
+
"model.layers.40.self_attn.rotary_emb.inv_freq": "pytorch_model-00041-of-00082.bin",
|
367 |
+
"model.layers.40.self_attn.v_proj.weight": "pytorch_model-00041-of-00082.bin",
|
368 |
+
"model.layers.41.input_layernorm.weight": "pytorch_model-00043-of-00082.bin",
|
369 |
+
"model.layers.41.mlp.down_proj.weight": "pytorch_model-00043-of-00082.bin",
|
370 |
+
"model.layers.41.mlp.gate_proj.weight": "pytorch_model-00043-of-00082.bin",
|
371 |
+
"model.layers.41.mlp.up_proj.weight": "pytorch_model-00043-of-00082.bin",
|
372 |
+
"model.layers.41.post_attention_layernorm.weight": "pytorch_model-00043-of-00082.bin",
|
373 |
+
"model.layers.41.self_attn.k_proj.weight": "pytorch_model-00042-of-00082.bin",
|
374 |
+
"model.layers.41.self_attn.o_proj.weight": "pytorch_model-00042-of-00082.bin",
|
375 |
+
"model.layers.41.self_attn.q_proj.weight": "pytorch_model-00042-of-00082.bin",
|
376 |
+
"model.layers.41.self_attn.rotary_emb.inv_freq": "pytorch_model-00042-of-00082.bin",
|
377 |
+
"model.layers.41.self_attn.v_proj.weight": "pytorch_model-00042-of-00082.bin",
|
378 |
+
"model.layers.42.input_layernorm.weight": "pytorch_model-00044-of-00082.bin",
|
379 |
+
"model.layers.42.mlp.down_proj.weight": "pytorch_model-00044-of-00082.bin",
|
380 |
+
"model.layers.42.mlp.gate_proj.weight": "pytorch_model-00044-of-00082.bin",
|
381 |
+
"model.layers.42.mlp.up_proj.weight": "pytorch_model-00044-of-00082.bin",
|
382 |
+
"model.layers.42.post_attention_layernorm.weight": "pytorch_model-00044-of-00082.bin",
|
383 |
+
"model.layers.42.self_attn.k_proj.weight": "pytorch_model-00043-of-00082.bin",
|
384 |
+
"model.layers.42.self_attn.o_proj.weight": "pytorch_model-00043-of-00082.bin",
|
385 |
+
"model.layers.42.self_attn.q_proj.weight": "pytorch_model-00043-of-00082.bin",
|
386 |
+
"model.layers.42.self_attn.rotary_emb.inv_freq": "pytorch_model-00043-of-00082.bin",
|
387 |
+
"model.layers.42.self_attn.v_proj.weight": "pytorch_model-00043-of-00082.bin",
|
388 |
+
"model.layers.43.input_layernorm.weight": "pytorch_model-00045-of-00082.bin",
|
389 |
+
"model.layers.43.mlp.down_proj.weight": "pytorch_model-00045-of-00082.bin",
|
390 |
+
"model.layers.43.mlp.gate_proj.weight": "pytorch_model-00045-of-00082.bin",
|
391 |
+
"model.layers.43.mlp.up_proj.weight": "pytorch_model-00045-of-00082.bin",
|
392 |
+
"model.layers.43.post_attention_layernorm.weight": "pytorch_model-00045-of-00082.bin",
|
393 |
+
"model.layers.43.self_attn.k_proj.weight": "pytorch_model-00044-of-00082.bin",
|
394 |
+
"model.layers.43.self_attn.o_proj.weight": "pytorch_model-00044-of-00082.bin",
|
395 |
+
"model.layers.43.self_attn.q_proj.weight": "pytorch_model-00044-of-00082.bin",
|
396 |
+
"model.layers.43.self_attn.rotary_emb.inv_freq": "pytorch_model-00044-of-00082.bin",
|
397 |
+
"model.layers.43.self_attn.v_proj.weight": "pytorch_model-00044-of-00082.bin",
|
398 |
+
"model.layers.44.input_layernorm.weight": "pytorch_model-00046-of-00082.bin",
|
399 |
+
"model.layers.44.mlp.down_proj.weight": "pytorch_model-00046-of-00082.bin",
|
400 |
+
"model.layers.44.mlp.gate_proj.weight": "pytorch_model-00046-of-00082.bin",
|
401 |
+
"model.layers.44.mlp.up_proj.weight": "pytorch_model-00046-of-00082.bin",
|
402 |
+
"model.layers.44.post_attention_layernorm.weight": "pytorch_model-00046-of-00082.bin",
|
403 |
+
"model.layers.44.self_attn.k_proj.weight": "pytorch_model-00045-of-00082.bin",
|
404 |
+
"model.layers.44.self_attn.o_proj.weight": "pytorch_model-00045-of-00082.bin",
|
405 |
+
"model.layers.44.self_attn.q_proj.weight": "pytorch_model-00045-of-00082.bin",
|
406 |
+
"model.layers.44.self_attn.rotary_emb.inv_freq": "pytorch_model-00045-of-00082.bin",
|
407 |
+
"model.layers.44.self_attn.v_proj.weight": "pytorch_model-00045-of-00082.bin",
|
408 |
+
"model.layers.45.input_layernorm.weight": "pytorch_model-00047-of-00082.bin",
|
409 |
+
"model.layers.45.mlp.down_proj.weight": "pytorch_model-00047-of-00082.bin",
|
410 |
+
"model.layers.45.mlp.gate_proj.weight": "pytorch_model-00047-of-00082.bin",
|
411 |
+
"model.layers.45.mlp.up_proj.weight": "pytorch_model-00047-of-00082.bin",
|
412 |
+
"model.layers.45.post_attention_layernorm.weight": "pytorch_model-00047-of-00082.bin",
|
413 |
+
"model.layers.45.self_attn.k_proj.weight": "pytorch_model-00046-of-00082.bin",
|
414 |
+
"model.layers.45.self_attn.o_proj.weight": "pytorch_model-00046-of-00082.bin",
|
415 |
+
"model.layers.45.self_attn.q_proj.weight": "pytorch_model-00046-of-00082.bin",
|
416 |
+
"model.layers.45.self_attn.rotary_emb.inv_freq": "pytorch_model-00046-of-00082.bin",
|
417 |
+
"model.layers.45.self_attn.v_proj.weight": "pytorch_model-00046-of-00082.bin",
|
418 |
+
"model.layers.46.input_layernorm.weight": "pytorch_model-00048-of-00082.bin",
|
419 |
+
"model.layers.46.mlp.down_proj.weight": "pytorch_model-00048-of-00082.bin",
|
420 |
+
"model.layers.46.mlp.gate_proj.weight": "pytorch_model-00048-of-00082.bin",
|
421 |
+
"model.layers.46.mlp.up_proj.weight": "pytorch_model-00048-of-00082.bin",
|
422 |
+
"model.layers.46.post_attention_layernorm.weight": "pytorch_model-00048-of-00082.bin",
|
423 |
+
"model.layers.46.self_attn.k_proj.weight": "pytorch_model-00047-of-00082.bin",
|
424 |
+
"model.layers.46.self_attn.o_proj.weight": "pytorch_model-00047-of-00082.bin",
|
425 |
+
"model.layers.46.self_attn.q_proj.weight": "pytorch_model-00047-of-00082.bin",
|
426 |
+
"model.layers.46.self_attn.rotary_emb.inv_freq": "pytorch_model-00047-of-00082.bin",
|
427 |
+
"model.layers.46.self_attn.v_proj.weight": "pytorch_model-00047-of-00082.bin",
|
428 |
+
"model.layers.47.input_layernorm.weight": "pytorch_model-00049-of-00082.bin",
|
429 |
+
"model.layers.47.mlp.down_proj.weight": "pytorch_model-00049-of-00082.bin",
|
430 |
+
"model.layers.47.mlp.gate_proj.weight": "pytorch_model-00049-of-00082.bin",
|
431 |
+
"model.layers.47.mlp.up_proj.weight": "pytorch_model-00049-of-00082.bin",
|
432 |
+
"model.layers.47.post_attention_layernorm.weight": "pytorch_model-00049-of-00082.bin",
|
433 |
+
"model.layers.47.self_attn.k_proj.weight": "pytorch_model-00048-of-00082.bin",
|
434 |
+
"model.layers.47.self_attn.o_proj.weight": "pytorch_model-00048-of-00082.bin",
|
435 |
+
"model.layers.47.self_attn.q_proj.weight": "pytorch_model-00048-of-00082.bin",
|
436 |
+
"model.layers.47.self_attn.rotary_emb.inv_freq": "pytorch_model-00048-of-00082.bin",
|
437 |
+
"model.layers.47.self_attn.v_proj.weight": "pytorch_model-00048-of-00082.bin",
|
438 |
+
"model.layers.48.input_layernorm.weight": "pytorch_model-00050-of-00082.bin",
|
439 |
+
"model.layers.48.mlp.down_proj.weight": "pytorch_model-00050-of-00082.bin",
|
440 |
+
"model.layers.48.mlp.gate_proj.weight": "pytorch_model-00050-of-00082.bin",
|
441 |
+
"model.layers.48.mlp.up_proj.weight": "pytorch_model-00050-of-00082.bin",
|
442 |
+
"model.layers.48.post_attention_layernorm.weight": "pytorch_model-00050-of-00082.bin",
|
443 |
+
"model.layers.48.self_attn.k_proj.weight": "pytorch_model-00049-of-00082.bin",
|
444 |
+
"model.layers.48.self_attn.o_proj.weight": "pytorch_model-00049-of-00082.bin",
|
445 |
+
"model.layers.48.self_attn.q_proj.weight": "pytorch_model-00049-of-00082.bin",
|
446 |
+
"model.layers.48.self_attn.rotary_emb.inv_freq": "pytorch_model-00049-of-00082.bin",
|
447 |
+
"model.layers.48.self_attn.v_proj.weight": "pytorch_model-00049-of-00082.bin",
|
448 |
+
"model.layers.49.input_layernorm.weight": "pytorch_model-00051-of-00082.bin",
|
449 |
+
"model.layers.49.mlp.down_proj.weight": "pytorch_model-00051-of-00082.bin",
|
450 |
+
"model.layers.49.mlp.gate_proj.weight": "pytorch_model-00051-of-00082.bin",
|
451 |
+
"model.layers.49.mlp.up_proj.weight": "pytorch_model-00051-of-00082.bin",
|
452 |
+
"model.layers.49.post_attention_layernorm.weight": "pytorch_model-00051-of-00082.bin",
|
453 |
+
"model.layers.49.self_attn.k_proj.weight": "pytorch_model-00050-of-00082.bin",
|
454 |
+
"model.layers.49.self_attn.o_proj.weight": "pytorch_model-00050-of-00082.bin",
|
455 |
+
"model.layers.49.self_attn.q_proj.weight": "pytorch_model-00050-of-00082.bin",
|
456 |
+
"model.layers.49.self_attn.rotary_emb.inv_freq": "pytorch_model-00050-of-00082.bin",
|
457 |
+
"model.layers.49.self_attn.v_proj.weight": "pytorch_model-00050-of-00082.bin",
|
458 |
+
"model.layers.5.input_layernorm.weight": "pytorch_model-00007-of-00082.bin",
|
459 |
+
"model.layers.5.mlp.down_proj.weight": "pytorch_model-00007-of-00082.bin",
|
460 |
+
"model.layers.5.mlp.gate_proj.weight": "pytorch_model-00007-of-00082.bin",
|
461 |
+
"model.layers.5.mlp.up_proj.weight": "pytorch_model-00007-of-00082.bin",
|
462 |
+
"model.layers.5.post_attention_layernorm.weight": "pytorch_model-00007-of-00082.bin",
|
463 |
+
"model.layers.5.self_attn.k_proj.weight": "pytorch_model-00006-of-00082.bin",
|
464 |
+
"model.layers.5.self_attn.o_proj.weight": "pytorch_model-00006-of-00082.bin",
|
465 |
+
"model.layers.5.self_attn.q_proj.weight": "pytorch_model-00006-of-00082.bin",
|
466 |
+
"model.layers.5.self_attn.rotary_emb.inv_freq": "pytorch_model-00006-of-00082.bin",
|
467 |
+
"model.layers.5.self_attn.v_proj.weight": "pytorch_model-00006-of-00082.bin",
|
468 |
+
"model.layers.50.input_layernorm.weight": "pytorch_model-00052-of-00082.bin",
|
469 |
+
"model.layers.50.mlp.down_proj.weight": "pytorch_model-00052-of-00082.bin",
|
470 |
+
"model.layers.50.mlp.gate_proj.weight": "pytorch_model-00052-of-00082.bin",
|
471 |
+
"model.layers.50.mlp.up_proj.weight": "pytorch_model-00052-of-00082.bin",
|
472 |
+
"model.layers.50.post_attention_layernorm.weight": "pytorch_model-00052-of-00082.bin",
|
473 |
+
"model.layers.50.self_attn.k_proj.weight": "pytorch_model-00051-of-00082.bin",
|
474 |
+
"model.layers.50.self_attn.o_proj.weight": "pytorch_model-00051-of-00082.bin",
|
475 |
+
"model.layers.50.self_attn.q_proj.weight": "pytorch_model-00051-of-00082.bin",
|
476 |
+
"model.layers.50.self_attn.rotary_emb.inv_freq": "pytorch_model-00051-of-00082.bin",
|
477 |
+
"model.layers.50.self_attn.v_proj.weight": "pytorch_model-00051-of-00082.bin",
|
478 |
+
"model.layers.51.input_layernorm.weight": "pytorch_model-00053-of-00082.bin",
|
479 |
+
"model.layers.51.mlp.down_proj.weight": "pytorch_model-00053-of-00082.bin",
|
480 |
+
"model.layers.51.mlp.gate_proj.weight": "pytorch_model-00053-of-00082.bin",
|
481 |
+
"model.layers.51.mlp.up_proj.weight": "pytorch_model-00053-of-00082.bin",
|
482 |
+
"model.layers.51.post_attention_layernorm.weight": "pytorch_model-00053-of-00082.bin",
|
483 |
+
"model.layers.51.self_attn.k_proj.weight": "pytorch_model-00052-of-00082.bin",
|
484 |
+
"model.layers.51.self_attn.o_proj.weight": "pytorch_model-00052-of-00082.bin",
|
485 |
+
"model.layers.51.self_attn.q_proj.weight": "pytorch_model-00052-of-00082.bin",
|
486 |
+
"model.layers.51.self_attn.rotary_emb.inv_freq": "pytorch_model-00052-of-00082.bin",
|
487 |
+
"model.layers.51.self_attn.v_proj.weight": "pytorch_model-00052-of-00082.bin",
|
488 |
+
"model.layers.52.input_layernorm.weight": "pytorch_model-00054-of-00082.bin",
|
489 |
+
"model.layers.52.mlp.down_proj.weight": "pytorch_model-00054-of-00082.bin",
|
490 |
+
"model.layers.52.mlp.gate_proj.weight": "pytorch_model-00054-of-00082.bin",
|
491 |
+
"model.layers.52.mlp.up_proj.weight": "pytorch_model-00054-of-00082.bin",
|
492 |
+
"model.layers.52.post_attention_layernorm.weight": "pytorch_model-00054-of-00082.bin",
|
493 |
+
"model.layers.52.self_attn.k_proj.weight": "pytorch_model-00053-of-00082.bin",
|
494 |
+
"model.layers.52.self_attn.o_proj.weight": "pytorch_model-00053-of-00082.bin",
|
495 |
+
"model.layers.52.self_attn.q_proj.weight": "pytorch_model-00053-of-00082.bin",
|
496 |
+
"model.layers.52.self_attn.rotary_emb.inv_freq": "pytorch_model-00053-of-00082.bin",
|
497 |
+
"model.layers.52.self_attn.v_proj.weight": "pytorch_model-00053-of-00082.bin",
|
498 |
+
"model.layers.53.input_layernorm.weight": "pytorch_model-00055-of-00082.bin",
|
499 |
+
"model.layers.53.mlp.down_proj.weight": "pytorch_model-00055-of-00082.bin",
|
500 |
+
"model.layers.53.mlp.gate_proj.weight": "pytorch_model-00055-of-00082.bin",
|
501 |
+
"model.layers.53.mlp.up_proj.weight": "pytorch_model-00055-of-00082.bin",
|
502 |
+
"model.layers.53.post_attention_layernorm.weight": "pytorch_model-00055-of-00082.bin",
|
503 |
+
"model.layers.53.self_attn.k_proj.weight": "pytorch_model-00054-of-00082.bin",
|
504 |
+
"model.layers.53.self_attn.o_proj.weight": "pytorch_model-00054-of-00082.bin",
|
505 |
+
"model.layers.53.self_attn.q_proj.weight": "pytorch_model-00054-of-00082.bin",
|
506 |
+
"model.layers.53.self_attn.rotary_emb.inv_freq": "pytorch_model-00054-of-00082.bin",
|
507 |
+
"model.layers.53.self_attn.v_proj.weight": "pytorch_model-00054-of-00082.bin",
|
508 |
+
"model.layers.54.input_layernorm.weight": "pytorch_model-00056-of-00082.bin",
|
509 |
+
"model.layers.54.mlp.down_proj.weight": "pytorch_model-00056-of-00082.bin",
|
510 |
+
"model.layers.54.mlp.gate_proj.weight": "pytorch_model-00056-of-00082.bin",
|
511 |
+
"model.layers.54.mlp.up_proj.weight": "pytorch_model-00056-of-00082.bin",
|
512 |
+
"model.layers.54.post_attention_layernorm.weight": "pytorch_model-00056-of-00082.bin",
|
513 |
+
"model.layers.54.self_attn.k_proj.weight": "pytorch_model-00055-of-00082.bin",
|
514 |
+
"model.layers.54.self_attn.o_proj.weight": "pytorch_model-00055-of-00082.bin",
|
515 |
+
"model.layers.54.self_attn.q_proj.weight": "pytorch_model-00055-of-00082.bin",
|
516 |
+
"model.layers.54.self_attn.rotary_emb.inv_freq": "pytorch_model-00055-of-00082.bin",
|
517 |
+
"model.layers.54.self_attn.v_proj.weight": "pytorch_model-00055-of-00082.bin",
|
518 |
+
"model.layers.55.input_layernorm.weight": "pytorch_model-00057-of-00082.bin",
|
519 |
+
"model.layers.55.mlp.down_proj.weight": "pytorch_model-00057-of-00082.bin",
|
520 |
+
"model.layers.55.mlp.gate_proj.weight": "pytorch_model-00057-of-00082.bin",
|
521 |
+
"model.layers.55.mlp.up_proj.weight": "pytorch_model-00057-of-00082.bin",
|
522 |
+
"model.layers.55.post_attention_layernorm.weight": "pytorch_model-00057-of-00082.bin",
|
523 |
+
"model.layers.55.self_attn.k_proj.weight": "pytorch_model-00056-of-00082.bin",
|
524 |
+
"model.layers.55.self_attn.o_proj.weight": "pytorch_model-00056-of-00082.bin",
|
525 |
+
"model.layers.55.self_attn.q_proj.weight": "pytorch_model-00056-of-00082.bin",
|
526 |
+
"model.layers.55.self_attn.rotary_emb.inv_freq": "pytorch_model-00056-of-00082.bin",
|
527 |
+
"model.layers.55.self_attn.v_proj.weight": "pytorch_model-00056-of-00082.bin",
|
528 |
+
"model.layers.56.input_layernorm.weight": "pytorch_model-00058-of-00082.bin",
|
529 |
+
"model.layers.56.mlp.down_proj.weight": "pytorch_model-00058-of-00082.bin",
|
530 |
+
"model.layers.56.mlp.gate_proj.weight": "pytorch_model-00058-of-00082.bin",
|
531 |
+
"model.layers.56.mlp.up_proj.weight": "pytorch_model-00058-of-00082.bin",
|
532 |
+
"model.layers.56.post_attention_layernorm.weight": "pytorch_model-00058-of-00082.bin",
|
533 |
+
"model.layers.56.self_attn.k_proj.weight": "pytorch_model-00057-of-00082.bin",
|
534 |
+
"model.layers.56.self_attn.o_proj.weight": "pytorch_model-00057-of-00082.bin",
|
535 |
+
"model.layers.56.self_attn.q_proj.weight": "pytorch_model-00057-of-00082.bin",
|
536 |
+
"model.layers.56.self_attn.rotary_emb.inv_freq": "pytorch_model-00057-of-00082.bin",
|
537 |
+
"model.layers.56.self_attn.v_proj.weight": "pytorch_model-00057-of-00082.bin",
|
538 |
+
"model.layers.57.input_layernorm.weight": "pytorch_model-00059-of-00082.bin",
|
539 |
+
"model.layers.57.mlp.down_proj.weight": "pytorch_model-00059-of-00082.bin",
|
540 |
+
"model.layers.57.mlp.gate_proj.weight": "pytorch_model-00059-of-00082.bin",
|
541 |
+
"model.layers.57.mlp.up_proj.weight": "pytorch_model-00059-of-00082.bin",
|
542 |
+
"model.layers.57.post_attention_layernorm.weight": "pytorch_model-00059-of-00082.bin",
|
543 |
+
"model.layers.57.self_attn.k_proj.weight": "pytorch_model-00058-of-00082.bin",
|
544 |
+
"model.layers.57.self_attn.o_proj.weight": "pytorch_model-00058-of-00082.bin",
|
545 |
+
"model.layers.57.self_attn.q_proj.weight": "pytorch_model-00058-of-00082.bin",
|
546 |
+
"model.layers.57.self_attn.rotary_emb.inv_freq": "pytorch_model-00058-of-00082.bin",
|
547 |
+
"model.layers.57.self_attn.v_proj.weight": "pytorch_model-00058-of-00082.bin",
|
548 |
+
"model.layers.58.input_layernorm.weight": "pytorch_model-00060-of-00082.bin",
|
549 |
+
"model.layers.58.mlp.down_proj.weight": "pytorch_model-00060-of-00082.bin",
|
550 |
+
"model.layers.58.mlp.gate_proj.weight": "pytorch_model-00060-of-00082.bin",
|
551 |
+
"model.layers.58.mlp.up_proj.weight": "pytorch_model-00060-of-00082.bin",
|
552 |
+
"model.layers.58.post_attention_layernorm.weight": "pytorch_model-00060-of-00082.bin",
|
553 |
+
"model.layers.58.self_attn.k_proj.weight": "pytorch_model-00059-of-00082.bin",
|
554 |
+
"model.layers.58.self_attn.o_proj.weight": "pytorch_model-00059-of-00082.bin",
|
555 |
+
"model.layers.58.self_attn.q_proj.weight": "pytorch_model-00059-of-00082.bin",
|
556 |
+
"model.layers.58.self_attn.rotary_emb.inv_freq": "pytorch_model-00059-of-00082.bin",
|
557 |
+
"model.layers.58.self_attn.v_proj.weight": "pytorch_model-00059-of-00082.bin",
|
558 |
+
"model.layers.59.input_layernorm.weight": "pytorch_model-00061-of-00082.bin",
|
559 |
+
"model.layers.59.mlp.down_proj.weight": "pytorch_model-00061-of-00082.bin",
|
560 |
+
"model.layers.59.mlp.gate_proj.weight": "pytorch_model-00061-of-00082.bin",
|
561 |
+
"model.layers.59.mlp.up_proj.weight": "pytorch_model-00061-of-00082.bin",
|
562 |
+
"model.layers.59.post_attention_layernorm.weight": "pytorch_model-00061-of-00082.bin",
|
563 |
+
"model.layers.59.self_attn.k_proj.weight": "pytorch_model-00060-of-00082.bin",
|
564 |
+
"model.layers.59.self_attn.o_proj.weight": "pytorch_model-00060-of-00082.bin",
|
565 |
+
"model.layers.59.self_attn.q_proj.weight": "pytorch_model-00060-of-00082.bin",
|
566 |
+
"model.layers.59.self_attn.rotary_emb.inv_freq": "pytorch_model-00060-of-00082.bin",
|
567 |
+
"model.layers.59.self_attn.v_proj.weight": "pytorch_model-00060-of-00082.bin",
|
568 |
+
"model.layers.6.input_layernorm.weight": "pytorch_model-00008-of-00082.bin",
|
569 |
+
"model.layers.6.mlp.down_proj.weight": "pytorch_model-00008-of-00082.bin",
|
570 |
+
"model.layers.6.mlp.gate_proj.weight": "pytorch_model-00008-of-00082.bin",
|
571 |
+
"model.layers.6.mlp.up_proj.weight": "pytorch_model-00008-of-00082.bin",
|
572 |
+
"model.layers.6.post_attention_layernorm.weight": "pytorch_model-00008-of-00082.bin",
|
573 |
+
"model.layers.6.self_attn.k_proj.weight": "pytorch_model-00007-of-00082.bin",
|
574 |
+
"model.layers.6.self_attn.o_proj.weight": "pytorch_model-00007-of-00082.bin",
|
575 |
+
"model.layers.6.self_attn.q_proj.weight": "pytorch_model-00007-of-00082.bin",
|
576 |
+
"model.layers.6.self_attn.rotary_emb.inv_freq": "pytorch_model-00007-of-00082.bin",
|
577 |
+
"model.layers.6.self_attn.v_proj.weight": "pytorch_model-00007-of-00082.bin",
|
578 |
+
"model.layers.60.input_layernorm.weight": "pytorch_model-00062-of-00082.bin",
|
579 |
+
"model.layers.60.mlp.down_proj.weight": "pytorch_model-00062-of-00082.bin",
|
580 |
+
"model.layers.60.mlp.gate_proj.weight": "pytorch_model-00062-of-00082.bin",
|
581 |
+
"model.layers.60.mlp.up_proj.weight": "pytorch_model-00062-of-00082.bin",
|
582 |
+
"model.layers.60.post_attention_layernorm.weight": "pytorch_model-00062-of-00082.bin",
|
583 |
+
"model.layers.60.self_attn.k_proj.weight": "pytorch_model-00061-of-00082.bin",
|
584 |
+
"model.layers.60.self_attn.o_proj.weight": "pytorch_model-00061-of-00082.bin",
|
585 |
+
"model.layers.60.self_attn.q_proj.weight": "pytorch_model-00061-of-00082.bin",
|
586 |
+
"model.layers.60.self_attn.rotary_emb.inv_freq": "pytorch_model-00061-of-00082.bin",
|
587 |
+
"model.layers.60.self_attn.v_proj.weight": "pytorch_model-00061-of-00082.bin",
|
588 |
+
"model.layers.61.input_layernorm.weight": "pytorch_model-00063-of-00082.bin",
|
589 |
+
"model.layers.61.mlp.down_proj.weight": "pytorch_model-00063-of-00082.bin",
|
590 |
+
"model.layers.61.mlp.gate_proj.weight": "pytorch_model-00063-of-00082.bin",
|
591 |
+
"model.layers.61.mlp.up_proj.weight": "pytorch_model-00063-of-00082.bin",
|
592 |
+
"model.layers.61.post_attention_layernorm.weight": "pytorch_model-00063-of-00082.bin",
|
593 |
+
"model.layers.61.self_attn.k_proj.weight": "pytorch_model-00062-of-00082.bin",
|
594 |
+
"model.layers.61.self_attn.o_proj.weight": "pytorch_model-00062-of-00082.bin",
|
595 |
+
"model.layers.61.self_attn.q_proj.weight": "pytorch_model-00062-of-00082.bin",
|
596 |
+
"model.layers.61.self_attn.rotary_emb.inv_freq": "pytorch_model-00062-of-00082.bin",
|
597 |
+
"model.layers.61.self_attn.v_proj.weight": "pytorch_model-00062-of-00082.bin",
|
598 |
+
"model.layers.62.input_layernorm.weight": "pytorch_model-00064-of-00082.bin",
|
599 |
+
"model.layers.62.mlp.down_proj.weight": "pytorch_model-00064-of-00082.bin",
|
600 |
+
"model.layers.62.mlp.gate_proj.weight": "pytorch_model-00064-of-00082.bin",
|
601 |
+
"model.layers.62.mlp.up_proj.weight": "pytorch_model-00064-of-00082.bin",
|
602 |
+
"model.layers.62.post_attention_layernorm.weight": "pytorch_model-00064-of-00082.bin",
|
603 |
+
"model.layers.62.self_attn.k_proj.weight": "pytorch_model-00063-of-00082.bin",
|
604 |
+
"model.layers.62.self_attn.o_proj.weight": "pytorch_model-00063-of-00082.bin",
|
605 |
+
"model.layers.62.self_attn.q_proj.weight": "pytorch_model-00063-of-00082.bin",
|
606 |
+
"model.layers.62.self_attn.rotary_emb.inv_freq": "pytorch_model-00063-of-00082.bin",
|
607 |
+
"model.layers.62.self_attn.v_proj.weight": "pytorch_model-00063-of-00082.bin",
|
608 |
+
"model.layers.63.input_layernorm.weight": "pytorch_model-00065-of-00082.bin",
|
609 |
+
"model.layers.63.mlp.down_proj.weight": "pytorch_model-00065-of-00082.bin",
|
610 |
+
"model.layers.63.mlp.gate_proj.weight": "pytorch_model-00065-of-00082.bin",
|
611 |
+
"model.layers.63.mlp.up_proj.weight": "pytorch_model-00065-of-00082.bin",
|
612 |
+
"model.layers.63.post_attention_layernorm.weight": "pytorch_model-00065-of-00082.bin",
|
613 |
+
"model.layers.63.self_attn.k_proj.weight": "pytorch_model-00064-of-00082.bin",
|
614 |
+
"model.layers.63.self_attn.o_proj.weight": "pytorch_model-00064-of-00082.bin",
|
615 |
+
"model.layers.63.self_attn.q_proj.weight": "pytorch_model-00064-of-00082.bin",
|
616 |
+
"model.layers.63.self_attn.rotary_emb.inv_freq": "pytorch_model-00064-of-00082.bin",
|
617 |
+
"model.layers.63.self_attn.v_proj.weight": "pytorch_model-00064-of-00082.bin",
|
618 |
+
"model.layers.64.input_layernorm.weight": "pytorch_model-00066-of-00082.bin",
|
619 |
+
"model.layers.64.mlp.down_proj.weight": "pytorch_model-00066-of-00082.bin",
|
620 |
+
"model.layers.64.mlp.gate_proj.weight": "pytorch_model-00066-of-00082.bin",
|
621 |
+
"model.layers.64.mlp.up_proj.weight": "pytorch_model-00066-of-00082.bin",
|
622 |
+
"model.layers.64.post_attention_layernorm.weight": "pytorch_model-00066-of-00082.bin",
|
623 |
+
"model.layers.64.self_attn.k_proj.weight": "pytorch_model-00065-of-00082.bin",
|
624 |
+
"model.layers.64.self_attn.o_proj.weight": "pytorch_model-00065-of-00082.bin",
|
625 |
+
"model.layers.64.self_attn.q_proj.weight": "pytorch_model-00065-of-00082.bin",
|
626 |
+
"model.layers.64.self_attn.rotary_emb.inv_freq": "pytorch_model-00065-of-00082.bin",
|
627 |
+
"model.layers.64.self_attn.v_proj.weight": "pytorch_model-00065-of-00082.bin",
|
628 |
+
"model.layers.65.input_layernorm.weight": "pytorch_model-00067-of-00082.bin",
|
629 |
+
"model.layers.65.mlp.down_proj.weight": "pytorch_model-00067-of-00082.bin",
|
630 |
+
"model.layers.65.mlp.gate_proj.weight": "pytorch_model-00067-of-00082.bin",
|
631 |
+
"model.layers.65.mlp.up_proj.weight": "pytorch_model-00067-of-00082.bin",
|
632 |
+
"model.layers.65.post_attention_layernorm.weight": "pytorch_model-00067-of-00082.bin",
|
633 |
+
"model.layers.65.self_attn.k_proj.weight": "pytorch_model-00066-of-00082.bin",
|
634 |
+
"model.layers.65.self_attn.o_proj.weight": "pytorch_model-00066-of-00082.bin",
|
635 |
+
"model.layers.65.self_attn.q_proj.weight": "pytorch_model-00066-of-00082.bin",
|
636 |
+
"model.layers.65.self_attn.rotary_emb.inv_freq": "pytorch_model-00066-of-00082.bin",
|
637 |
+
"model.layers.65.self_attn.v_proj.weight": "pytorch_model-00066-of-00082.bin",
|
638 |
+
"model.layers.66.input_layernorm.weight": "pytorch_model-00068-of-00082.bin",
|
639 |
+
"model.layers.66.mlp.down_proj.weight": "pytorch_model-00068-of-00082.bin",
|
640 |
+
"model.layers.66.mlp.gate_proj.weight": "pytorch_model-00068-of-00082.bin",
|
641 |
+
"model.layers.66.mlp.up_proj.weight": "pytorch_model-00068-of-00082.bin",
|
642 |
+
"model.layers.66.post_attention_layernorm.weight": "pytorch_model-00068-of-00082.bin",
|
643 |
+
"model.layers.66.self_attn.k_proj.weight": "pytorch_model-00067-of-00082.bin",
|
644 |
+
"model.layers.66.self_attn.o_proj.weight": "pytorch_model-00067-of-00082.bin",
|
645 |
+
"model.layers.66.self_attn.q_proj.weight": "pytorch_model-00067-of-00082.bin",
|
646 |
+
"model.layers.66.self_attn.rotary_emb.inv_freq": "pytorch_model-00067-of-00082.bin",
|
647 |
+
"model.layers.66.self_attn.v_proj.weight": "pytorch_model-00067-of-00082.bin",
|
648 |
+
"model.layers.67.input_layernorm.weight": "pytorch_model-00069-of-00082.bin",
|
649 |
+
"model.layers.67.mlp.down_proj.weight": "pytorch_model-00069-of-00082.bin",
|
650 |
+
"model.layers.67.mlp.gate_proj.weight": "pytorch_model-00069-of-00082.bin",
|
651 |
+
"model.layers.67.mlp.up_proj.weight": "pytorch_model-00069-of-00082.bin",
|
652 |
+
"model.layers.67.post_attention_layernorm.weight": "pytorch_model-00069-of-00082.bin",
|
653 |
+
"model.layers.67.self_attn.k_proj.weight": "pytorch_model-00068-of-00082.bin",
|
654 |
+
"model.layers.67.self_attn.o_proj.weight": "pytorch_model-00068-of-00082.bin",
|
655 |
+
"model.layers.67.self_attn.q_proj.weight": "pytorch_model-00068-of-00082.bin",
|
656 |
+
"model.layers.67.self_attn.rotary_emb.inv_freq": "pytorch_model-00068-of-00082.bin",
|
657 |
+
"model.layers.67.self_attn.v_proj.weight": "pytorch_model-00068-of-00082.bin",
|
658 |
+
"model.layers.68.input_layernorm.weight": "pytorch_model-00070-of-00082.bin",
|
659 |
+
"model.layers.68.mlp.down_proj.weight": "pytorch_model-00070-of-00082.bin",
|
660 |
+
"model.layers.68.mlp.gate_proj.weight": "pytorch_model-00070-of-00082.bin",
|
661 |
+
"model.layers.68.mlp.up_proj.weight": "pytorch_model-00070-of-00082.bin",
|
662 |
+
"model.layers.68.post_attention_layernorm.weight": "pytorch_model-00070-of-00082.bin",
|
663 |
+
"model.layers.68.self_attn.k_proj.weight": "pytorch_model-00069-of-00082.bin",
|
664 |
+
"model.layers.68.self_attn.o_proj.weight": "pytorch_model-00069-of-00082.bin",
|
665 |
+
"model.layers.68.self_attn.q_proj.weight": "pytorch_model-00069-of-00082.bin",
|
666 |
+
"model.layers.68.self_attn.rotary_emb.inv_freq": "pytorch_model-00069-of-00082.bin",
|
667 |
+
"model.layers.68.self_attn.v_proj.weight": "pytorch_model-00069-of-00082.bin",
|
668 |
+
"model.layers.69.input_layernorm.weight": "pytorch_model-00071-of-00082.bin",
|
669 |
+
"model.layers.69.mlp.down_proj.weight": "pytorch_model-00071-of-00082.bin",
|
670 |
+
"model.layers.69.mlp.gate_proj.weight": "pytorch_model-00071-of-00082.bin",
|
671 |
+
"model.layers.69.mlp.up_proj.weight": "pytorch_model-00071-of-00082.bin",
|
672 |
+
"model.layers.69.post_attention_layernorm.weight": "pytorch_model-00071-of-00082.bin",
|
673 |
+
"model.layers.69.self_attn.k_proj.weight": "pytorch_model-00070-of-00082.bin",
|
674 |
+
"model.layers.69.self_attn.o_proj.weight": "pytorch_model-00070-of-00082.bin",
|
675 |
+
"model.layers.69.self_attn.q_proj.weight": "pytorch_model-00070-of-00082.bin",
|
676 |
+
"model.layers.69.self_attn.rotary_emb.inv_freq": "pytorch_model-00070-of-00082.bin",
|
677 |
+
"model.layers.69.self_attn.v_proj.weight": "pytorch_model-00070-of-00082.bin",
|
678 |
+
"model.layers.7.input_layernorm.weight": "pytorch_model-00009-of-00082.bin",
|
679 |
+
"model.layers.7.mlp.down_proj.weight": "pytorch_model-00009-of-00082.bin",
|
680 |
+
"model.layers.7.mlp.gate_proj.weight": "pytorch_model-00009-of-00082.bin",
|
681 |
+
"model.layers.7.mlp.up_proj.weight": "pytorch_model-00009-of-00082.bin",
|
682 |
+
"model.layers.7.post_attention_layernorm.weight": "pytorch_model-00009-of-00082.bin",
|
683 |
+
"model.layers.7.self_attn.k_proj.weight": "pytorch_model-00008-of-00082.bin",
|
684 |
+
"model.layers.7.self_attn.o_proj.weight": "pytorch_model-00008-of-00082.bin",
|
685 |
+
"model.layers.7.self_attn.q_proj.weight": "pytorch_model-00008-of-00082.bin",
|
686 |
+
"model.layers.7.self_attn.rotary_emb.inv_freq": "pytorch_model-00008-of-00082.bin",
|
687 |
+
"model.layers.7.self_attn.v_proj.weight": "pytorch_model-00008-of-00082.bin",
|
688 |
+
"model.layers.70.input_layernorm.weight": "pytorch_model-00072-of-00082.bin",
|
689 |
+
"model.layers.70.mlp.down_proj.weight": "pytorch_model-00072-of-00082.bin",
|
690 |
+
"model.layers.70.mlp.gate_proj.weight": "pytorch_model-00072-of-00082.bin",
|
691 |
+
"model.layers.70.mlp.up_proj.weight": "pytorch_model-00072-of-00082.bin",
|
692 |
+
"model.layers.70.post_attention_layernorm.weight": "pytorch_model-00072-of-00082.bin",
|
693 |
+
"model.layers.70.self_attn.k_proj.weight": "pytorch_model-00071-of-00082.bin",
|
694 |
+
"model.layers.70.self_attn.o_proj.weight": "pytorch_model-00071-of-00082.bin",
|
695 |
+
"model.layers.70.self_attn.q_proj.weight": "pytorch_model-00071-of-00082.bin",
|
696 |
+
"model.layers.70.self_attn.rotary_emb.inv_freq": "pytorch_model-00071-of-00082.bin",
|
697 |
+
"model.layers.70.self_attn.v_proj.weight": "pytorch_model-00071-of-00082.bin",
|
698 |
+
"model.layers.71.input_layernorm.weight": "pytorch_model-00073-of-00082.bin",
|
699 |
+
"model.layers.71.mlp.down_proj.weight": "pytorch_model-00073-of-00082.bin",
|
700 |
+
"model.layers.71.mlp.gate_proj.weight": "pytorch_model-00073-of-00082.bin",
|
701 |
+
"model.layers.71.mlp.up_proj.weight": "pytorch_model-00073-of-00082.bin",
|
702 |
+
"model.layers.71.post_attention_layernorm.weight": "pytorch_model-00073-of-00082.bin",
|
703 |
+
"model.layers.71.self_attn.k_proj.weight": "pytorch_model-00072-of-00082.bin",
|
704 |
+
"model.layers.71.self_attn.o_proj.weight": "pytorch_model-00072-of-00082.bin",
|
705 |
+
"model.layers.71.self_attn.q_proj.weight": "pytorch_model-00072-of-00082.bin",
|
706 |
+
"model.layers.71.self_attn.rotary_emb.inv_freq": "pytorch_model-00072-of-00082.bin",
|
707 |
+
"model.layers.71.self_attn.v_proj.weight": "pytorch_model-00072-of-00082.bin",
|
708 |
+
"model.layers.72.input_layernorm.weight": "pytorch_model-00074-of-00082.bin",
|
709 |
+
"model.layers.72.mlp.down_proj.weight": "pytorch_model-00074-of-00082.bin",
|
710 |
+
"model.layers.72.mlp.gate_proj.weight": "pytorch_model-00074-of-00082.bin",
|
711 |
+
"model.layers.72.mlp.up_proj.weight": "pytorch_model-00074-of-00082.bin",
|
712 |
+
"model.layers.72.post_attention_layernorm.weight": "pytorch_model-00074-of-00082.bin",
|
713 |
+
"model.layers.72.self_attn.k_proj.weight": "pytorch_model-00073-of-00082.bin",
|
714 |
+
"model.layers.72.self_attn.o_proj.weight": "pytorch_model-00073-of-00082.bin",
|
715 |
+
"model.layers.72.self_attn.q_proj.weight": "pytorch_model-00073-of-00082.bin",
|
716 |
+
"model.layers.72.self_attn.rotary_emb.inv_freq": "pytorch_model-00073-of-00082.bin",
|
717 |
+
"model.layers.72.self_attn.v_proj.weight": "pytorch_model-00073-of-00082.bin",
|
718 |
+
"model.layers.73.input_layernorm.weight": "pytorch_model-00075-of-00082.bin",
|
719 |
+
"model.layers.73.mlp.down_proj.weight": "pytorch_model-00075-of-00082.bin",
|
720 |
+
"model.layers.73.mlp.gate_proj.weight": "pytorch_model-00075-of-00082.bin",
|
721 |
+
"model.layers.73.mlp.up_proj.weight": "pytorch_model-00075-of-00082.bin",
|
722 |
+
"model.layers.73.post_attention_layernorm.weight": "pytorch_model-00075-of-00082.bin",
|
723 |
+
"model.layers.73.self_attn.k_proj.weight": "pytorch_model-00074-of-00082.bin",
|
724 |
+
"model.layers.73.self_attn.o_proj.weight": "pytorch_model-00074-of-00082.bin",
|
725 |
+
"model.layers.73.self_attn.q_proj.weight": "pytorch_model-00074-of-00082.bin",
|
726 |
+
"model.layers.73.self_attn.rotary_emb.inv_freq": "pytorch_model-00074-of-00082.bin",
|
727 |
+
"model.layers.73.self_attn.v_proj.weight": "pytorch_model-00074-of-00082.bin",
|
728 |
+
"model.layers.74.input_layernorm.weight": "pytorch_model-00076-of-00082.bin",
|
729 |
+
"model.layers.74.mlp.down_proj.weight": "pytorch_model-00076-of-00082.bin",
|
730 |
+
"model.layers.74.mlp.gate_proj.weight": "pytorch_model-00076-of-00082.bin",
|
731 |
+
"model.layers.74.mlp.up_proj.weight": "pytorch_model-00076-of-00082.bin",
|
732 |
+
"model.layers.74.post_attention_layernorm.weight": "pytorch_model-00076-of-00082.bin",
|
733 |
+
"model.layers.74.self_attn.k_proj.weight": "pytorch_model-00075-of-00082.bin",
|
734 |
+
"model.layers.74.self_attn.o_proj.weight": "pytorch_model-00075-of-00082.bin",
|
735 |
+
"model.layers.74.self_attn.q_proj.weight": "pytorch_model-00075-of-00082.bin",
|
736 |
+
"model.layers.74.self_attn.rotary_emb.inv_freq": "pytorch_model-00075-of-00082.bin",
|
737 |
+
"model.layers.74.self_attn.v_proj.weight": "pytorch_model-00075-of-00082.bin",
|
738 |
+
"model.layers.75.input_layernorm.weight": "pytorch_model-00077-of-00082.bin",
|
739 |
+
"model.layers.75.mlp.down_proj.weight": "pytorch_model-00077-of-00082.bin",
|
740 |
+
"model.layers.75.mlp.gate_proj.weight": "pytorch_model-00077-of-00082.bin",
|
741 |
+
"model.layers.75.mlp.up_proj.weight": "pytorch_model-00077-of-00082.bin",
|
742 |
+
"model.layers.75.post_attention_layernorm.weight": "pytorch_model-00077-of-00082.bin",
|
743 |
+
"model.layers.75.self_attn.k_proj.weight": "pytorch_model-00076-of-00082.bin",
|
744 |
+
"model.layers.75.self_attn.o_proj.weight": "pytorch_model-00076-of-00082.bin",
|
745 |
+
"model.layers.75.self_attn.q_proj.weight": "pytorch_model-00076-of-00082.bin",
|
746 |
+
"model.layers.75.self_attn.rotary_emb.inv_freq": "pytorch_model-00076-of-00082.bin",
|
747 |
+
"model.layers.75.self_attn.v_proj.weight": "pytorch_model-00076-of-00082.bin",
|
748 |
+
"model.layers.76.input_layernorm.weight": "pytorch_model-00078-of-00082.bin",
|
749 |
+
"model.layers.76.mlp.down_proj.weight": "pytorch_model-00078-of-00082.bin",
|
750 |
+
"model.layers.76.mlp.gate_proj.weight": "pytorch_model-00078-of-00082.bin",
|
751 |
+
"model.layers.76.mlp.up_proj.weight": "pytorch_model-00078-of-00082.bin",
|
752 |
+
"model.layers.76.post_attention_layernorm.weight": "pytorch_model-00078-of-00082.bin",
|
753 |
+
"model.layers.76.self_attn.k_proj.weight": "pytorch_model-00077-of-00082.bin",
|
754 |
+
"model.layers.76.self_attn.o_proj.weight": "pytorch_model-00077-of-00082.bin",
|
755 |
+
"model.layers.76.self_attn.q_proj.weight": "pytorch_model-00077-of-00082.bin",
|
756 |
+
"model.layers.76.self_attn.rotary_emb.inv_freq": "pytorch_model-00077-of-00082.bin",
|
757 |
+
"model.layers.76.self_attn.v_proj.weight": "pytorch_model-00077-of-00082.bin",
|
758 |
+
"model.layers.77.input_layernorm.weight": "pytorch_model-00079-of-00082.bin",
|
759 |
+
"model.layers.77.mlp.down_proj.weight": "pytorch_model-00079-of-00082.bin",
|
760 |
+
"model.layers.77.mlp.gate_proj.weight": "pytorch_model-00079-of-00082.bin",
|
761 |
+
"model.layers.77.mlp.up_proj.weight": "pytorch_model-00079-of-00082.bin",
|
762 |
+
"model.layers.77.post_attention_layernorm.weight": "pytorch_model-00079-of-00082.bin",
|
763 |
+
"model.layers.77.self_attn.k_proj.weight": "pytorch_model-00078-of-00082.bin",
|
764 |
+
"model.layers.77.self_attn.o_proj.weight": "pytorch_model-00078-of-00082.bin",
|
765 |
+
"model.layers.77.self_attn.q_proj.weight": "pytorch_model-00078-of-00082.bin",
|
766 |
+
"model.layers.77.self_attn.rotary_emb.inv_freq": "pytorch_model-00078-of-00082.bin",
|
767 |
+
"model.layers.77.self_attn.v_proj.weight": "pytorch_model-00078-of-00082.bin",
|
768 |
+
"model.layers.78.input_layernorm.weight": "pytorch_model-00080-of-00082.bin",
|
769 |
+
"model.layers.78.mlp.down_proj.weight": "pytorch_model-00080-of-00082.bin",
|
770 |
+
"model.layers.78.mlp.gate_proj.weight": "pytorch_model-00080-of-00082.bin",
|
771 |
+
"model.layers.78.mlp.up_proj.weight": "pytorch_model-00080-of-00082.bin",
|
772 |
+
"model.layers.78.post_attention_layernorm.weight": "pytorch_model-00080-of-00082.bin",
|
773 |
+
"model.layers.78.self_attn.k_proj.weight": "pytorch_model-00079-of-00082.bin",
|
774 |
+
"model.layers.78.self_attn.o_proj.weight": "pytorch_model-00079-of-00082.bin",
|
775 |
+
"model.layers.78.self_attn.q_proj.weight": "pytorch_model-00079-of-00082.bin",
|
776 |
+
"model.layers.78.self_attn.rotary_emb.inv_freq": "pytorch_model-00079-of-00082.bin",
|
777 |
+
"model.layers.78.self_attn.v_proj.weight": "pytorch_model-00079-of-00082.bin",
|
778 |
+
"model.layers.79.input_layernorm.weight": "pytorch_model-00081-of-00082.bin",
|
779 |
+
"model.layers.79.mlp.down_proj.weight": "pytorch_model-00081-of-00082.bin",
|
780 |
+
"model.layers.79.mlp.gate_proj.weight": "pytorch_model-00081-of-00082.bin",
|
781 |
+
"model.layers.79.mlp.up_proj.weight": "pytorch_model-00081-of-00082.bin",
|
782 |
+
"model.layers.79.post_attention_layernorm.weight": "pytorch_model-00081-of-00082.bin",
|
783 |
+
"model.layers.79.self_attn.k_proj.weight": "pytorch_model-00080-of-00082.bin",
|
784 |
+
"model.layers.79.self_attn.o_proj.weight": "pytorch_model-00080-of-00082.bin",
|
785 |
+
"model.layers.79.self_attn.q_proj.weight": "pytorch_model-00080-of-00082.bin",
|
786 |
+
"model.layers.79.self_attn.rotary_emb.inv_freq": "pytorch_model-00080-of-00082.bin",
|
787 |
+
"model.layers.79.self_attn.v_proj.weight": "pytorch_model-00080-of-00082.bin",
|
788 |
+
"model.layers.8.input_layernorm.weight": "pytorch_model-00010-of-00082.bin",
|
789 |
+
"model.layers.8.mlp.down_proj.weight": "pytorch_model-00010-of-00082.bin",
|
790 |
+
"model.layers.8.mlp.gate_proj.weight": "pytorch_model-00010-of-00082.bin",
|
791 |
+
"model.layers.8.mlp.up_proj.weight": "pytorch_model-00010-of-00082.bin",
|
792 |
+
"model.layers.8.post_attention_layernorm.weight": "pytorch_model-00010-of-00082.bin",
|
793 |
+
"model.layers.8.self_attn.k_proj.weight": "pytorch_model-00009-of-00082.bin",
|
794 |
+
"model.layers.8.self_attn.o_proj.weight": "pytorch_model-00009-of-00082.bin",
|
795 |
+
"model.layers.8.self_attn.q_proj.weight": "pytorch_model-00009-of-00082.bin",
|
796 |
+
"model.layers.8.self_attn.rotary_emb.inv_freq": "pytorch_model-00009-of-00082.bin",
|
797 |
+
"model.layers.8.self_attn.v_proj.weight": "pytorch_model-00009-of-00082.bin",
|
798 |
+
"model.layers.9.input_layernorm.weight": "pytorch_model-00011-of-00082.bin",
|
799 |
+
"model.layers.9.mlp.down_proj.weight": "pytorch_model-00011-of-00082.bin",
|
800 |
+
"model.layers.9.mlp.gate_proj.weight": "pytorch_model-00011-of-00082.bin",
|
801 |
+
"model.layers.9.mlp.up_proj.weight": "pytorch_model-00011-of-00082.bin",
|
802 |
+
"model.layers.9.post_attention_layernorm.weight": "pytorch_model-00011-of-00082.bin",
|
803 |
+
"model.layers.9.self_attn.k_proj.weight": "pytorch_model-00010-of-00082.bin",
|
804 |
+
"model.layers.9.self_attn.o_proj.weight": "pytorch_model-00010-of-00082.bin",
|
805 |
+
"model.layers.9.self_attn.q_proj.weight": "pytorch_model-00010-of-00082.bin",
|
806 |
+
"model.layers.9.self_attn.rotary_emb.inv_freq": "pytorch_model-00010-of-00082.bin",
|
807 |
+
"model.layers.9.self_attn.v_proj.weight": "pytorch_model-00010-of-00082.bin",
|
808 |
+
"model.norm.weight": "pytorch_model-00081-of-00082.bin"
|
809 |
+
}
|
810 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "[CLS]",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"unk_token": "<|endoftext|>",
|
5 |
+
"pad_token": "<|endoftext|>"
|
6 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"bos_token": "[CLS]",
|
4 |
+
"clean_up_tokenization_spaces": true,
|
5 |
+
"eos_token": "</s>",
|
6 |
+
"model_max_length": 2048,
|
7 |
+
"tokenizer_class": "GPT2Tokenizer",
|
8 |
+
"unk_token": "<|endoftext|>"
|
9 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|