init
Browse files- config.json +40 -0
- configuration_telechat.py +93 -0
- modeling_telechat.py +840 -0
- pytorch_model.bin.index.json +390 -0
- pytorch_model_00001-of-00041.bin +3 -0
- pytorch_model_00002-of-00041.bin +3 -0
- pytorch_model_00003-of-00041.bin +3 -0
- pytorch_model_00004-of-00041.bin +3 -0
- pytorch_model_00005-of-00041.bin +3 -0
- pytorch_model_00006-of-00041.bin +3 -0
- pytorch_model_00007-of-00041.bin +3 -0
- pytorch_model_00008-of-00041.bin +3 -0
- pytorch_model_00009-of-00041.bin +3 -0
- pytorch_model_00010-of-00041.bin +3 -0
- pytorch_model_00011-of-00041.bin +3 -0
- pytorch_model_00012-of-00041.bin +3 -0
- pytorch_model_00013-of-00041.bin +3 -0
- pytorch_model_00014-of-00041.bin +3 -0
- pytorch_model_00015-of-00041.bin +3 -0
- pytorch_model_00016-of-00041.bin +3 -0
- pytorch_model_00017-of-00041.bin +3 -0
- pytorch_model_00018-of-00041.bin +3 -0
- pytorch_model_00019-of-00041.bin +3 -0
config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"apply_residual_connection_post_layernorm": false,
|
3 |
+
"architectures": [
|
4 |
+
"TelechatForCausalLM"
|
5 |
+
],
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "configuration_telechat.TelechatConfig",
|
8 |
+
"AutoModelForCausalLM": "modeling_telechat.TelechatForCausalLM"
|
9 |
+
},
|
10 |
+
"attention_dropout": 0.0,
|
11 |
+
"attention_softmax_in_fp32": true,
|
12 |
+
"bias_dropout_fusion": true,
|
13 |
+
"bos_token_id": 1,
|
14 |
+
"eos_token_id": 2,
|
15 |
+
"hidden_dropout": 0.0,
|
16 |
+
"hidden_size": 5120,
|
17 |
+
"initializer_range": 0.02,
|
18 |
+
"layer_norm_epsilon": 1e-05,
|
19 |
+
"masked_softmax_fusion": true,
|
20 |
+
"model_type": "telechat",
|
21 |
+
"n_head": 32,
|
22 |
+
"n_inner": null,
|
23 |
+
"n_layer": 38,
|
24 |
+
"offset_alibi": 100,
|
25 |
+
"pad_token_id": 3,
|
26 |
+
"pretraining_tp": 2,
|
27 |
+
"skip_bias_add": true,
|
28 |
+
"skip_bias_add_qkv": false,
|
29 |
+
"slow_but_exact": false,
|
30 |
+
"transformers_version": "4.24.0",
|
31 |
+
"unk_token_id": 0,
|
32 |
+
"use_cache": true,
|
33 |
+
"vocab_size": 120000,
|
34 |
+
"ffn_hidden_size": 12288,
|
35 |
+
"flash_attn":true,
|
36 |
+
"tie_word_embeddings":false,
|
37 |
+
"training_seqlen":8192,
|
38 |
+
"base_seqlen":8192
|
39 |
+
}
|
40 |
+
|
configuration_telechat.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 the Big Science Workshop and HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
""" Telechat configuration"""
|
17 |
+
|
18 |
+
from packaging import version
|
19 |
+
from collections import OrderedDict
|
20 |
+
from transformers.utils import is_torch_available, logging
|
21 |
+
from transformers.configuration_utils import PretrainedConfig
|
22 |
+
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
|
23 |
+
|
24 |
+
logger = logging.get_logger(__name__)
|
25 |
+
|
26 |
+
class TelechatConfig(PretrainedConfig):
|
27 |
+
"""
|
28 |
+
Args:
|
29 |
+
vocab_size (`int`, *optional*, defaults to 160256): Vocabulary size of the Telechat model.
|
30 |
+
hidden_size (`int`, *optional*, defaults to 4096): Dimensionality of the embeddings and hidden states.
|
31 |
+
ffn_hidden_size (`int`, *optional*, defaults to 12288): Dimensionality of the feed-forward hidden states.
|
32 |
+
n_layer (`int`, *optional*, defaults to 30): Number of hidden layers in the Transformer
|
33 |
+
n_head (`int`, *optional*, defaults to 32): Number of attention heads for each attention layer.
|
34 |
+
layer_norm_epsilon (`float`, *optional*, defaults to 1e-5): The epsilon to use in the layer normalization layers.
|
35 |
+
initializer_range (`float`, *optional*, defaults to 0.02): The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
36 |
+
apply_residual_connection_post_layernorm (`bool`, *optional*, defaults to `False`): If enabled, use the layer norm of the hidden states as the residual in the transformer blocks
|
37 |
+
hidden_dropout (`float`, *optional*, defaults to 0.0): Dropout rate of the dropout function on the bias dropout.
|
38 |
+
attention_dropout (`float`, *optional*, defaults to 0.0): Dropout rate applied to the attention probs
|
39 |
+
use_cache (`bool`, *optional*, defaults to `True`): Whether or not the model should return the last key/values attentions.
|
40 |
+
training_seqlen (`int`, *optional*, defaults to 8192): Sequence length during last finetuning.
|
41 |
+
logn (`bool`, *optional*, defaults to `True`): Whether or not to use logN during extrapolation.
|
42 |
+
embed_layernorm (`bool`, *optional*, defaults to `True`): Whether or not to use embedding layernorm.
|
43 |
+
|
44 |
+
"""
|
45 |
+
|
46 |
+
model_type = "telechat"
|
47 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
48 |
+
attribute_map = {
|
49 |
+
"num_hidden_layers": "n_layer",
|
50 |
+
"num_attention_heads": "n_head",
|
51 |
+
}
|
52 |
+
|
53 |
+
def __init__(
|
54 |
+
self,
|
55 |
+
vocab_size=160256,
|
56 |
+
hidden_size=4096,
|
57 |
+
n_layer=30,
|
58 |
+
n_head=32,
|
59 |
+
layer_norm_epsilon=1e-5,
|
60 |
+
initializer_range=0.02,
|
61 |
+
use_cache=True,
|
62 |
+
bos_token_id=1,
|
63 |
+
eos_token_id=2,
|
64 |
+
apply_residual_connection_post_layernorm=False,
|
65 |
+
hidden_dropout=0.0,
|
66 |
+
attention_dropout=0.0,
|
67 |
+
ffn_hidden_size=12288,
|
68 |
+
training_seqlen = 8192,
|
69 |
+
logn = True,
|
70 |
+
embed_layernorm = False,
|
71 |
+
**kwargs,
|
72 |
+
):
|
73 |
+
self.vocab_size = vocab_size
|
74 |
+
n_embed = kwargs.pop("n_embed", None)
|
75 |
+
self.hidden_size = hidden_size if n_embed is None else n_embed
|
76 |
+
self.n_layer = n_layer
|
77 |
+
self.n_head = n_head
|
78 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
79 |
+
self.initializer_range = initializer_range
|
80 |
+
self.use_cache = use_cache
|
81 |
+
self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm
|
82 |
+
self.hidden_dropout = hidden_dropout
|
83 |
+
self.attention_dropout = attention_dropout
|
84 |
+
self.bos_token_id = bos_token_id
|
85 |
+
self.eos_token_id = eos_token_id
|
86 |
+
self.logn = logn
|
87 |
+
self.ffn_hidden_size = ffn_hidden_size
|
88 |
+
self.training_seqlen = training_seqlen
|
89 |
+
self.embed_layernorm = embed_layernorm
|
90 |
+
|
91 |
+
|
92 |
+
super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, **kwargs)
|
93 |
+
|
modeling_telechat.py
ADDED
@@ -0,0 +1,840 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# coding=utf-8
|
3 |
+
# Copyright 2022 HuggingFace Inc. team and BigScience workshop.
|
4 |
+
#
|
5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
# you may not use this file except in compliance with the License.
|
7 |
+
# You may obtain a copy of the License at
|
8 |
+
#
|
9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
#
|
11 |
+
# Unless required by applicable law or agreed to in writing, software
|
12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
# See the License for the specific language governing permissions and
|
15 |
+
# limitations under the License.
|
16 |
+
|
17 |
+
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
|
18 |
+
|
19 |
+
# Copyright (c) 2021 EleutherAI
|
20 |
+
# This file is based on code by the authors denoted below and has been modified from its original version.
|
21 |
+
#
|
22 |
+
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
23 |
+
#
|
24 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
25 |
+
# you may not use this file except in compliance with the License.
|
26 |
+
# You may obtain a copy of the License at
|
27 |
+
#
|
28 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
29 |
+
#
|
30 |
+
# Unless required by applicable law or agreed to in writing, software
|
31 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
32 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
33 |
+
# See the License for the specific language governing permissions and
|
34 |
+
# limitations under the License.
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
"""PyTorch TELECHAT model."""
|
40 |
+
|
41 |
+
import warnings
|
42 |
+
from typing import Optional, Tuple, Union
|
43 |
+
|
44 |
+
import torch
|
45 |
+
import math
|
46 |
+
from torch import nn
|
47 |
+
import torch.utils.checkpoint
|
48 |
+
from torch.nn import functional as F
|
49 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
|
50 |
+
from transformers.modeling_outputs import (
|
51 |
+
BaseModelOutputWithPastAndCrossAttentions,
|
52 |
+
CausalLMOutputWithCrossAttentions
|
53 |
+
)
|
54 |
+
from transformers.modeling_utils import PreTrainedModel
|
55 |
+
from transformers.utils import logging
|
56 |
+
|
57 |
+
from .configuration_telechat import TelechatConfig
|
58 |
+
|
59 |
+
logger = logging.get_logger(__name__)
|
60 |
+
|
61 |
+
_CHECKPOINT_FOR_DOC = "telechat"
|
62 |
+
_CONFIG_FOR_DOC = "TelechatConfig"
|
63 |
+
|
64 |
+
TELECHAT_PRETRAINED_MODEL_ARCHIVE_LIST = []
|
65 |
+
|
66 |
+
try:
|
67 |
+
from einops import rearrange
|
68 |
+
except ImportError:
|
69 |
+
rearrange = None
|
70 |
+
|
71 |
+
use_flash_attn = True
|
72 |
+
try:
|
73 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func
|
74 |
+
except ImportError:
|
75 |
+
try:
|
76 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func as flash_attn_unpadded_func
|
77 |
+
except ImportError:
|
78 |
+
flash_attn_unpadded_func = None
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
class RotaryEmbedding(torch.nn.Module):
|
83 |
+
# Extracted from: https://github.com/EleutherAI/gpt-neox
|
84 |
+
def __init__(self, dim ,config, base=10000, precision=torch.half):
|
85 |
+
super().__init__()
|
86 |
+
self.config = config
|
87 |
+
self.dim = dim
|
88 |
+
self.base = base
|
89 |
+
self.inv_freq = 1. / (base ** (torch.arange(0, dim, 2).float().half() / dim)).cuda()
|
90 |
+
self.max_seq_len_cached = None
|
91 |
+
self.cos_cached = None
|
92 |
+
self.sin_cached = None
|
93 |
+
self.precision = precision
|
94 |
+
|
95 |
+
def get_mscale(self,scale=1):
|
96 |
+
if scale <= 1:
|
97 |
+
return 1.0
|
98 |
+
return 0.1 * math.log(scale) + 1.0
|
99 |
+
|
100 |
+
def get_ntk_alpha(self, true_seq_len):
|
101 |
+
context_value = math.log(true_seq_len / self.config.base_seqlen, 2) + 1
|
102 |
+
# ntk_alpha = 2 ** context_value - 1
|
103 |
+
ntk_alpha = 2 ** math.ceil(context_value) - 1
|
104 |
+
ntk_alpha = max(ntk_alpha, 1)
|
105 |
+
return ntk_alpha
|
106 |
+
|
107 |
+
def forward(self, x, seq_dim=0, seq_len=None):
|
108 |
+
if seq_len is None:
|
109 |
+
seq_len = x.shape[seq_dim]
|
110 |
+
seq_len = max(seq_len, self.config.training_seqlen)
|
111 |
+
ntk_alpha = self.get_ntk_alpha(seq_len)
|
112 |
+
self.mscale = float(self.get_mscale(seq_len / self.config.training_seqlen))
|
113 |
+
if True:
|
114 |
+
base = self.base * ntk_alpha ** (self.dim / (self.dim - 2))
|
115 |
+
self.inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2, device=x.device).float( )/ self.dim ))
|
116 |
+
self.max_seq_len_cached = seq_len
|
117 |
+
t = torch.arange(self.max_seq_len_cached, device=x.device, dtype=self.inv_freq.dtype)
|
118 |
+
freqs = torch.einsum('i,j->ij', t, self.inv_freq)
|
119 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
120 |
+
emb = torch.cat((freqs, freqs), dim=-1).to(x.device)
|
121 |
+
if self.precision == torch.bfloat16:
|
122 |
+
emb = emb.float()
|
123 |
+
# [sx, 1 (b * np), hn]
|
124 |
+
self.cos_cached = self.mscale *emb.cos()[:, None, :].half()
|
125 |
+
self.sin_cached = self.mscale *emb.sin()[:, None, :].half()
|
126 |
+
if self.precision == torch.bfloat16:
|
127 |
+
self.cos_cached = self.cos_cached.bfloat16()
|
128 |
+
self.sin_cached = self.sin_cached.bfloat16()
|
129 |
+
return self.cos_cached[:seq_len, ...], self.sin_cached[:seq_len, ...]
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
# rotary pos emb helpers:
|
134 |
+
def rotate_half(x):
|
135 |
+
x1, x2 = x[..., :x.shape[-1] // 2], x[..., x.shape[-1] // 2:]
|
136 |
+
return torch.cat((-x2, x1), dim=x1.ndim - 1) # dim=-1 triggers a bug in earlier torch versions
|
137 |
+
|
138 |
+
def apply_rotary_pos_emb_torch(q, k, cos, sin, offset: int = 0): # jitting fails with bf16
|
139 |
+
cos, sin = cos[offset:q.shape[0] + offset, ...], sin[offset:q.shape[0] + offset, ...]
|
140 |
+
return (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
|
141 |
+
|
142 |
+
|
143 |
+
class MixedFusedRMSNorm(nn.Module):
|
144 |
+
# Extracted from https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py
|
145 |
+
def __init__(self, hidden_size, eps=1e-6):
|
146 |
+
super().__init__()
|
147 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
148 |
+
self.variance_epsilon = eps
|
149 |
+
|
150 |
+
def forward(self, hidden_states):
|
151 |
+
input_dtype = hidden_states.dtype
|
152 |
+
hidden_states = hidden_states.to(torch.float32)
|
153 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
154 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
155 |
+
return self.weight * hidden_states.to(input_dtype)
|
156 |
+
|
157 |
+
|
158 |
+
class FlashSelfAttention(torch.nn.Module):
|
159 |
+
# Extracted from https://github.com/microsoft/Megatron-DeepSpeed/blob/main/megatron/model/transformer.py
|
160 |
+
"""Implement the scaled dot product attention with softmax.
|
161 |
+
Arguments
|
162 |
+
---------
|
163 |
+
softmax_scale: The temperature to use for the softmax attention.
|
164 |
+
(default: 1/sqrt(d_keys) where d_keys is computed at
|
165 |
+
runtime)
|
166 |
+
attention_dropout: The dropout rate to apply to the attention
|
167 |
+
(default: 0.0)
|
168 |
+
"""
|
169 |
+
|
170 |
+
def __init__(self, causal=False, softmax_scale=None, attention_dropout=0.0,
|
171 |
+
device=None, dtype=None):
|
172 |
+
super().__init__()
|
173 |
+
assert flash_attn_unpadded_func is not None, ('Please install FlashAttention first, '
|
174 |
+
'e.g., with pip install flash-attn')
|
175 |
+
assert rearrange is not None, 'Please install einops first, e.g., with pip install einops'
|
176 |
+
self.causal = causal
|
177 |
+
self.softmax_scale = softmax_scale
|
178 |
+
self.dropout_p = attention_dropout
|
179 |
+
|
180 |
+
def forward(self, q, k, v):
|
181 |
+
"""Implements the multihead softmax attention.
|
182 |
+
Arguments
|
183 |
+
---------
|
184 |
+
q, k, v: The tensor containing the query, key, and value. (B, S, H, D)
|
185 |
+
"""
|
186 |
+
assert all((i.dtype in [torch.float16, torch.bfloat16] for i in (q, k, v)))
|
187 |
+
assert all((i.is_cuda for i in (q, k, v)))
|
188 |
+
|
189 |
+
batch_size, seqlen_q = q.shape[0], q.shape[1]
|
190 |
+
seqlen_k = k.shape[1]
|
191 |
+
|
192 |
+
q, k, v = [rearrange(x, 'b s ... -> (b s) ...') for x in [q, k, v]]
|
193 |
+
cu_seqlens_q = torch.arange(0, (batch_size + 1) * seqlen_q, step=seqlen_q, dtype=torch.int32,
|
194 |
+
device=q.device)
|
195 |
+
self.training = False
|
196 |
+
if self.training:
|
197 |
+
# during training q,k,v always have same seqlen
|
198 |
+
assert seqlen_k == seqlen_q
|
199 |
+
|
200 |
+
is_causal = self.causal
|
201 |
+
cu_seqlens_k = cu_seqlens_q
|
202 |
+
dropout_p = self.dropout_p
|
203 |
+
else:
|
204 |
+
# turn off FA causal mask after first inference autoregressive iteration
|
205 |
+
# only on first autoregressive step q,k,v have same seqlen
|
206 |
+
is_causal = seqlen_q == seqlen_k
|
207 |
+
cu_seqlens_k = torch.arange(0, (batch_size + 1) * seqlen_k, step=seqlen_k, dtype=torch.int32,
|
208 |
+
device=q.device)
|
209 |
+
dropout_p = 0
|
210 |
+
|
211 |
+
output = flash_attn_unpadded_func(
|
212 |
+
q, k, v, cu_seqlens_q, cu_seqlens_k, seqlen_q, seqlen_k,
|
213 |
+
dropout_p=dropout_p,
|
214 |
+
softmax_scale=self.softmax_scale, causal=is_causal
|
215 |
+
)
|
216 |
+
|
217 |
+
output = rearrange(output, '(b s) ... -> b s ...', b=batch_size)
|
218 |
+
return output
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
def _make_causal_mask(
|
223 |
+
input_ids_shape: torch.Size, device: torch.device, past_key_values_length: int
|
224 |
+
) -> torch.BoolTensor:
|
225 |
+
"""
|
226 |
+
Make causal mask used for self-attention.
|
227 |
+
"""
|
228 |
+
batch_size, target_length = input_ids_shape
|
229 |
+
mask = torch.empty((target_length, target_length + past_key_values_length), dtype=torch.bool, device=device)
|
230 |
+
# ONNX doesn't support `torch.Tensor.triu` properly, thus we use this workaround
|
231 |
+
seq_ids = torch.arange(target_length, device=device)
|
232 |
+
mask[:, past_key_values_length:] = seq_ids[:, None] < seq_ids[None, :]
|
233 |
+
|
234 |
+
if past_key_values_length > 0:
|
235 |
+
mask[:, :past_key_values_length] = False
|
236 |
+
|
237 |
+
expanded_mask = mask[None, None, :, :].expand(batch_size, 1, target_length, target_length + past_key_values_length)
|
238 |
+
return expanded_mask
|
239 |
+
|
240 |
+
|
241 |
+
def _expand_mask(mask: torch.Tensor, tgt_length: int) -> torch.BoolTensor:
|
242 |
+
"""
|
243 |
+
Expands attention_mask from `[batch_size, src_length]` to `[batch_size, 1, tgt_length, src_length]`.
|
244 |
+
"""
|
245 |
+
batch_size, src_length = mask.shape
|
246 |
+
tgt_length = tgt_length if tgt_length is not None else src_length
|
247 |
+
|
248 |
+
expanded_mask = ~(mask[:, None, None, :].to(torch.bool))
|
249 |
+
return expanded_mask.expand(batch_size, 1, tgt_length, src_length)
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
def dropout_add(x: torch.Tensor, residual: torch.Tensor, prob: float, training: bool) -> torch.Tensor:
|
254 |
+
"""
|
255 |
+
Dropout add function
|
256 |
+
|
257 |
+
Args:
|
258 |
+
x (`torch.tensor`, *required*):
|
259 |
+
input tensor
|
260 |
+
residual (`torch.tensor`, *required*):
|
261 |
+
residual tensor
|
262 |
+
prob (`float`, *required*):
|
263 |
+
dropout probability
|
264 |
+
training (`bool`, *required*):
|
265 |
+
training mode
|
266 |
+
"""
|
267 |
+
out = F.dropout(x, p=prob, training=training)
|
268 |
+
out = residual + out
|
269 |
+
return out
|
270 |
+
|
271 |
+
|
272 |
+
def telechat_gelu_forward(x: torch.Tensor) -> torch.Tensor:
|
273 |
+
"""
|
274 |
+
Custom bias GELU function. Adapted from Megatron-DeepSpeed code. Here we use a simple implementation (inference) to
|
275 |
+
make the model jitable.
|
276 |
+
|
277 |
+
Args:
|
278 |
+
x (`torch.tensor`, *required*):
|
279 |
+
input hidden states
|
280 |
+
"""
|
281 |
+
return x * 0.5 * (1.0 + torch.tanh(0.79788456 * x * (1 + 0.044715 * x * x)))
|
282 |
+
|
283 |
+
|
284 |
+
def telechat_gelu_back(g: torch.Tensor, x: torch.Tensor) -> torch.Tensor:
|
285 |
+
"""
|
286 |
+
gradient of tanh approximation of gelu gradient of actual gelu is: 0.5 * (1. + torch.erf(x * 0.70710678)) +
|
287 |
+
0.3989423 * x * torch.exp(-0.5 * x * x)
|
288 |
+
|
289 |
+
Args:
|
290 |
+
g (`torch.tensor`, *required*):
|
291 |
+
gradient output tensor
|
292 |
+
x (`torch.tensor`, *required*):
|
293 |
+
input tensor
|
294 |
+
"""
|
295 |
+
x = x[0] # x is a tuple of 1 element, needs to unpack it first
|
296 |
+
tanh_out = torch.tanh(0.79788456 * x * (1 + 0.044715 * x * x))
|
297 |
+
# sqrt(2/pi) * 3 * 0.044715 -> 0.1070322243
|
298 |
+
ff = 0.5 * x * ((1 - tanh_out * tanh_out) * (0.79788456 + 0.1070322243 * x * x)) + 0.5 * (1 + tanh_out)
|
299 |
+
return ff * g
|
300 |
+
|
301 |
+
|
302 |
+
class GeLUFunction(torch.autograd.Function):
|
303 |
+
@staticmethod
|
304 |
+
def forward(ctx, input: torch.Tensor) -> torch.Tensor:
|
305 |
+
ctx.save_for_backward(input)
|
306 |
+
return telechat_gelu_forward(input)
|
307 |
+
|
308 |
+
@staticmethod
|
309 |
+
def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor:
|
310 |
+
input = ctx.saved_tensors
|
311 |
+
tmp = telechat_gelu_back(grad_output, input)
|
312 |
+
return tmp
|
313 |
+
|
314 |
+
|
315 |
+
class TelechatGelu(nn.Module):
|
316 |
+
"""
|
317 |
+
TelechatBiasGelu wrapper function that make use of the simple function on inference mode to make the model
|
318 |
+
torchscriptable and use the autograd function in training mode to get the accurate results of the gradients Partly
|
319 |
+
copied from Megatron-DeepSpeed code and adapted for our needs
|
320 |
+
|
321 |
+
See here why autograd functions are not torchscriptable: https://github.com/pytorch/pytorch/issues/22329
|
322 |
+
"""
|
323 |
+
|
324 |
+
def __init__(self):
|
325 |
+
super().__init__()
|
326 |
+
|
327 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
328 |
+
if self.training:
|
329 |
+
return GeLUFunction.apply(x)
|
330 |
+
else:
|
331 |
+
return telechat_gelu_forward(x)
|
332 |
+
|
333 |
+
|
334 |
+
class TelechatAttention(nn.Module):
|
335 |
+
def __init__(self, config: TelechatConfig ,layer_idx):
|
336 |
+
super().__init__()
|
337 |
+
self.kv_cache = None
|
338 |
+
self.layer_idx = layer_idx
|
339 |
+
|
340 |
+
self.hidden_size = config.hidden_size
|
341 |
+
self.num_heads = config.n_head
|
342 |
+
self.head_dim = self.hidden_size // self.num_heads
|
343 |
+
self.split_size = self.hidden_size
|
344 |
+
self.hidden_dropout = config.hidden_dropout
|
345 |
+
self.config = config
|
346 |
+
|
347 |
+
if self.head_dim * self.num_heads != self.hidden_size:
|
348 |
+
raise ValueError(
|
349 |
+
f"`hidden_size` must be divisible by num_heads (got `hidden_size`: {self.hidden_size} and `num_heads`:"
|
350 |
+
f" {self.num_heads})."
|
351 |
+
)
|
352 |
+
|
353 |
+
# Layer-wise attention scaling
|
354 |
+
self.inv_norm_factor = 1.0 / math.sqrt(self.head_dim)
|
355 |
+
self.beta = 1.0
|
356 |
+
|
357 |
+
self.num_key_value_heads = self.num_heads
|
358 |
+
kv_projection_size = self.head_dim * self.num_key_value_heads
|
359 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
360 |
+
self.query = nn.Linear(self.hidden_size, self.hidden_size, bias=False)
|
361 |
+
self.key_value = nn.Linear(self.hidden_size, kv_projection_size * 2, bias=False)
|
362 |
+
self.dense = nn.Linear(self.hidden_size, self.hidden_size)
|
363 |
+
self.attention_dropout = nn.Dropout(config.attention_dropout)
|
364 |
+
self.rotary_emb = RotaryEmbedding(self.head_dim ,config=config)
|
365 |
+
|
366 |
+
self.core_attention_flash = FlashSelfAttention(
|
367 |
+
causal=True, attention_dropout=config.attention_dropout
|
368 |
+
)
|
369 |
+
|
370 |
+
self.last_key_layer = None
|
371 |
+
#logn_list = [math.log(i, 4096) if i > 4096 else 1 for i in range(1, 32768)]
|
372 |
+
#self.logn_tensor = torch.tensor(logn_list)[None, :, None, None].half().cuda()
|
373 |
+
|
374 |
+
|
375 |
+
def repeat_kv(self, hidden_states, n_rep):
|
376 |
+
slen, batch, num_key_value_heads_per_partition, head_dim = hidden_states.shape
|
377 |
+
if n_rep == 1:
|
378 |
+
return hidden_states
|
379 |
+
hidden_states = hidden_states[:, :, :, None, :].expand(slen, batch, num_key_value_heads_per_partition, n_rep,
|
380 |
+
head_dim)
|
381 |
+
return hidden_states.reshape(slen, batch, num_key_value_heads_per_partition * n_rep, head_dim)
|
382 |
+
|
383 |
+
def split_tensor_along_last_dim(self,
|
384 |
+
tensor: torch.Tensor,
|
385 |
+
num_partitions: int,
|
386 |
+
contiguous_split_chunks: bool = False,
|
387 |
+
):
|
388 |
+
|
389 |
+
# Get the size and dimension.
|
390 |
+
last_dim = tensor.dim() - 1
|
391 |
+
last_dim_size = tensor.size()[last_dim] // num_partitions
|
392 |
+
# Split.
|
393 |
+
tensor_list = torch.split(tensor, last_dim_size, dim=last_dim)
|
394 |
+
# Note: torch.split does not create contiguous tensors by default.
|
395 |
+
if contiguous_split_chunks:
|
396 |
+
return tuple(chunk.contiguous() for chunk in tensor_list)
|
397 |
+
|
398 |
+
return tensor_list
|
399 |
+
|
400 |
+
def _merge_heads(self, x: torch.Tensor) -> torch.Tensor:
|
401 |
+
batch_size_and_num_heads, seq_length, _ = x.shape
|
402 |
+
batch_size = batch_size_and_num_heads // self.num_heads
|
403 |
+
x = x.view(batch_size, self.num_heads, seq_length, self.head_dim)
|
404 |
+
x = x.permute(0, 2, 1, 3)
|
405 |
+
return x.reshape(batch_size, seq_length, self.num_heads * self.head_dim)
|
406 |
+
|
407 |
+
def forward(
|
408 |
+
self,
|
409 |
+
hidden_states: torch.Tensor,
|
410 |
+
residual: torch.Tensor,
|
411 |
+
attention_mask: torch.Tensor,
|
412 |
+
layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
|
413 |
+
use_cache: bool = False,
|
414 |
+
output_attentions: bool = False,
|
415 |
+
):
|
416 |
+
hidden_states = hidden_states.transpose(1, 0)
|
417 |
+
query_layer = self.query(hidden_states)
|
418 |
+
new_tensor_shape = query_layer.size()[:-1] + \
|
419 |
+
(self.num_heads,
|
420 |
+
self.head_dim)
|
421 |
+
query_layer = query_layer.view(*new_tensor_shape)
|
422 |
+
|
423 |
+
mixed_kv_layer = self.key_value(hidden_states)
|
424 |
+
new_tensor_shape = mixed_kv_layer.size()[:-1] + \
|
425 |
+
(self.num_key_value_heads,
|
426 |
+
2 * self.head_dim)
|
427 |
+
mixed_kv_layer = mixed_kv_layer.view(*new_tensor_shape)
|
428 |
+
(key_layer, value_layer) = self.split_tensor_along_last_dim(mixed_kv_layer, 2)
|
429 |
+
|
430 |
+
output_size = (query_layer.size(1),
|
431 |
+
query_layer.size(2),
|
432 |
+
query_layer.size(0),
|
433 |
+
key_layer.size(0))
|
434 |
+
|
435 |
+
query_layer = query_layer.view(output_size[2], output_size[0] * output_size[1], -1)
|
436 |
+
key_layer = key_layer.view(output_size[3], output_size[0] * output_size[1], -1)
|
437 |
+
|
438 |
+
apply_rotary_fn = apply_rotary_pos_emb_torch
|
439 |
+
|
440 |
+
seq_len = key_layer.shape[0]
|
441 |
+
offset = 0
|
442 |
+
|
443 |
+
if use_cache and layer_past != None:
|
444 |
+
past_key, past_value = layer_past
|
445 |
+
offset = past_key.shape[0]
|
446 |
+
seq_len += offset
|
447 |
+
|
448 |
+
cos, sin = self.rotary_emb(value_layer, seq_len=seq_len)
|
449 |
+
|
450 |
+
query_layer, key_layer = apply_rotary_fn(query_layer, key_layer, cos, sin, offset=offset)
|
451 |
+
if use_cache:
|
452 |
+
if layer_past != None:
|
453 |
+
past_key, past_value = layer_past
|
454 |
+
key_layer = torch.cat((past_key, key_layer[-1, ...].unsqueeze(0)) ,dim=0)
|
455 |
+
value_layer = torch.cat((past_value ,value_layer[-1 ,...].unsqueeze(0)) ,dim = 0)
|
456 |
+
layer_past = key_layer ,value_layer
|
457 |
+
s, bz, head, dim = value_layer.shape
|
458 |
+
s_key = key_layer.shape[0]
|
459 |
+
s_query = query_layer.shape[0]
|
460 |
+
query_layer = query_layer.reshape((s_query, bz, head, dim))
|
461 |
+
key_layer = key_layer.reshape((s_key, bz, head, dim))
|
462 |
+
|
463 |
+
|
464 |
+
if self.config.flash_attn:
|
465 |
+
q, k, v = [rearrange(x, 's b ... -> b s ...').contiguous() for x in
|
466 |
+
(query_layer, key_layer, value_layer)]
|
467 |
+
context_layer = self.core_attention_flash(q, k, v)
|
468 |
+
context_layer = rearrange(context_layer, 'b s h d -> b s (h d)').contiguous()
|
469 |
+
else:
|
470 |
+
##[sq, b, np, hn] -> [sq, b * np, hn]
|
471 |
+
query_layer = query_layer.reshape(s_query ,bz * self.num_heads, dim)
|
472 |
+
# [sk, b, np, hn] -> [sk, b * np, hn]
|
473 |
+
key_layer = key_layer.reshape(s_key, bz * self.num_heads, dim)
|
474 |
+
matmul_result = self.inv_norm_factor * torch.einsum('bik,bkj->bij', query_layer.transpose(0, 1), key_layer.transpose(0, 1).transpose(1, 2))
|
475 |
+
|
476 |
+
attention_scores = matmul_result.view(bz, self.num_heads, s_query, s_key)
|
477 |
+
|
478 |
+
input_dtype = attention_scores.dtype
|
479 |
+
if input_dtype == torch.float16:
|
480 |
+
attention_scores = attention_scores.to(torch.float)
|
481 |
+
attn_weights = torch.masked_fill(attention_scores, attention_mask, torch.finfo(attention_scores.dtype).min)
|
482 |
+
attention_probs = F.softmax(attn_weights, dim=-1).to(input_dtype) ##dtype = torch.float32
|
483 |
+
attention_probs = self.attention_dropout(attention_probs)
|
484 |
+
attention_probs_reshaped = attention_probs.view(bz * self.num_heads, s_query, s_key)
|
485 |
+
|
486 |
+
value_layer = value_layer.reshape(s_key ,bz * self.num_heads, dim)
|
487 |
+
context_layer = torch.bmm(attention_probs_reshaped, value_layer.transpose(0, 1))
|
488 |
+
context_layer = self._merge_heads(context_layer)
|
489 |
+
|
490 |
+
output_tensor = self.dense(context_layer)
|
491 |
+
|
492 |
+
output_tensor = dropout_add(output_tensor, residual, self.hidden_dropout, self.training)
|
493 |
+
present = None
|
494 |
+
outputs = (output_tensor, present)
|
495 |
+
if output_attentions:
|
496 |
+
outputs += (attention_probs,)
|
497 |
+
|
498 |
+
return output_tensor, layer_past
|
499 |
+
|
500 |
+
class TelechatMLP(nn.Module):
|
501 |
+
def __init__(self, config: TelechatConfig):
|
502 |
+
super().__init__()
|
503 |
+
hidden_size = config.hidden_size
|
504 |
+
self.gate_proj = nn.Linear(hidden_size, config.ffn_hidden_size, bias=False)
|
505 |
+
self.up_proj = nn.Linear(hidden_size, config.ffn_hidden_size, bias=False)
|
506 |
+
self.down_proj = nn.Linear(config.ffn_hidden_size, hidden_size, bias=True)
|
507 |
+
self.hidden_dropout = config.hidden_dropout
|
508 |
+
|
509 |
+
def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor) -> torch.Tensor:
|
510 |
+
intermediate_output = self.down_proj(F.silu(self.gate_proj(hidden_states)) * self.up_proj(hidden_states))
|
511 |
+
output = dropout_add(intermediate_output, residual, self.hidden_dropout, self.training)
|
512 |
+
return output
|
513 |
+
|
514 |
+
|
515 |
+
class TelechatBlock(nn.Module):
|
516 |
+
def __init__(self, config: TelechatConfig ,layer_idx):
|
517 |
+
super().__init__()
|
518 |
+
hidden_size = config.hidden_size
|
519 |
+
|
520 |
+
self.input_layernorm = MixedFusedRMSNorm(hidden_size, eps=config.layer_norm_epsilon)
|
521 |
+
self.num_heads = config.n_head
|
522 |
+
self.layer_idx = layer_idx
|
523 |
+
self.self_attention = TelechatAttention(config ,layer_idx)
|
524 |
+
self.post_attention_layernorm = MixedFusedRMSNorm(hidden_size, eps=config.layer_norm_epsilon)
|
525 |
+
|
526 |
+
self.mlp = TelechatMLP(config)
|
527 |
+
|
528 |
+
self.apply_residual_connection_post_layernorm = config.apply_residual_connection_post_layernorm
|
529 |
+
self.hidden_dropout = config.hidden_dropout
|
530 |
+
|
531 |
+
def forward(
|
532 |
+
self,
|
533 |
+
hidden_states: torch.Tensor,
|
534 |
+
attention_mask: torch.Tensor,
|
535 |
+
layer_past: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
|
536 |
+
use_cache: bool = False,
|
537 |
+
output_attentions: bool = False,
|
538 |
+
):
|
539 |
+
layernorm_output = self.input_layernorm(hidden_states)
|
540 |
+
if self.apply_residual_connection_post_layernorm:
|
541 |
+
residual = layernorm_output
|
542 |
+
else:
|
543 |
+
residual = hidden_states
|
544 |
+
|
545 |
+
attn_outputs = self.self_attention(
|
546 |
+
layernorm_output,
|
547 |
+
residual,
|
548 |
+
layer_past=layer_past,
|
549 |
+
attention_mask=attention_mask,
|
550 |
+
use_cache=use_cache,
|
551 |
+
output_attentions=output_attentions,
|
552 |
+
)
|
553 |
+
|
554 |
+
attention_output = attn_outputs[0]
|
555 |
+
outputs = attn_outputs[1:]
|
556 |
+
layernorm_output = self.post_attention_layernorm(attention_output)
|
557 |
+
|
558 |
+
if self.apply_residual_connection_post_layernorm:
|
559 |
+
residual = layernorm_output
|
560 |
+
else:
|
561 |
+
residual = attention_output
|
562 |
+
output = self.mlp(layernorm_output, residual)
|
563 |
+
|
564 |
+
if use_cache:
|
565 |
+
outputs = (output,) + outputs
|
566 |
+
else:
|
567 |
+
outputs = (output,) + outputs[1:]
|
568 |
+
|
569 |
+
return outputs
|
570 |
+
|
571 |
+
|
572 |
+
class TelechatPreTrainedModel(PreTrainedModel):
|
573 |
+
config_class = TelechatConfig
|
574 |
+
base_model_prefix = "transformer"
|
575 |
+
supports_gradient_checkpointing = True
|
576 |
+
_no_split_modules = ["TelechatBlock"]
|
577 |
+
_skip_keys_device_placement = "past_key_values"
|
578 |
+
|
579 |
+
def __init__(self, *inputs, **kwargs):
|
580 |
+
super().__init__(*inputs, **kwargs)
|
581 |
+
|
582 |
+
def _init_weights(self, module: nn.Module):
|
583 |
+
"""Initialize the weights."""
|
584 |
+
if isinstance(module, nn.Linear):
|
585 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
586 |
+
if module.bias is not None:
|
587 |
+
module.bias.data.zero_()
|
588 |
+
|
589 |
+
elif isinstance(module, nn.Embedding):
|
590 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
591 |
+
if module.padding_idx is not None:
|
592 |
+
module.weight.data[module.padding_idx].zero_()
|
593 |
+
|
594 |
+
elif isinstance(module, LayerNorm):
|
595 |
+
module.bias.data.zero_()
|
596 |
+
module.weight.data.fill_(1.0)
|
597 |
+
|
598 |
+
def _set_gradient_checkpointing(self, module: nn.Module, value: bool = False):
|
599 |
+
if isinstance(module, TelechatModel):
|
600 |
+
module.gradient_checkpointing = value
|
601 |
+
|
602 |
+
|
603 |
+
class TelechatModel(TelechatPreTrainedModel):
|
604 |
+
def __init__(self, config: TelechatConfig):
|
605 |
+
super().__init__(config)
|
606 |
+
|
607 |
+
self.embed_dim = config.hidden_size
|
608 |
+
self.num_heads = config.n_head
|
609 |
+
self.config = config
|
610 |
+
self.word_embeddings = nn.Embedding(config.vocab_size, self.embed_dim)
|
611 |
+
if self.config.embed_layernorm:
|
612 |
+
self.word_embeddings_layernorm = MixedFusedRMSNorm(self.embed_dim, eps=config.layer_norm_epsilon)
|
613 |
+
|
614 |
+
self.h = nn.ModuleList([TelechatBlock(config ,_) for _ in range(config.num_hidden_layers)])
|
615 |
+
self.ln_f = MixedFusedRMSNorm(self.embed_dim, eps=config.layer_norm_epsilon)
|
616 |
+
self.gradient_checkpointing = False
|
617 |
+
self.post_init()
|
618 |
+
|
619 |
+
|
620 |
+
def get_input_embeddings(self):
|
621 |
+
return self.word_embeddings
|
622 |
+
|
623 |
+
def _prepare_attn_mask(
|
624 |
+
self, attention_mask: torch.Tensor, input_shape: Tuple[int, int], past_key_values_length: int
|
625 |
+
) -> torch.BoolTensor:
|
626 |
+
combined_attention_mask = None
|
627 |
+
device = attention_mask.device
|
628 |
+
_, src_length = input_shape
|
629 |
+
|
630 |
+
if src_length > 1:
|
631 |
+
combined_attention_mask = _make_causal_mask(
|
632 |
+
input_shape, device=device, past_key_values_length=past_key_values_length
|
633 |
+
)
|
634 |
+
expanded_attn_mask = _expand_mask(attention_mask, tgt_length=src_length)
|
635 |
+
combined_attention_mask = (
|
636 |
+
expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask | combined_attention_mask
|
637 |
+
)
|
638 |
+
|
639 |
+
return combined_attention_mask
|
640 |
+
|
641 |
+
def set_input_embeddings(self, new_embeddings: torch.Tensor):
|
642 |
+
self.word_embeddings = new_embeddings
|
643 |
+
|
644 |
+
def forward(
|
645 |
+
self,
|
646 |
+
input_ids: Optional[torch.LongTensor] = None,
|
647 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
|
648 |
+
attention_mask: Optional[torch.Tensor] = None,
|
649 |
+
inputs_embeds: Optional[torch.LongTensor] = None,
|
650 |
+
use_cache: Optional[bool] = None,
|
651 |
+
output_attentions: Optional[bool] = None,
|
652 |
+
output_hidden_states: Optional[bool] = None,
|
653 |
+
return_dict: Optional[bool] = None,
|
654 |
+
**deprecated_arguments,
|
655 |
+
) -> Union[Tuple[torch.Tensor, ...], BaseModelOutputWithPastAndCrossAttentions]:
|
656 |
+
|
657 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
658 |
+
output_hidden_states = (
|
659 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
660 |
+
)
|
661 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
662 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
663 |
+
|
664 |
+
|
665 |
+
if input_ids is not None:
|
666 |
+
batch_size, seq_length = input_ids.shape
|
667 |
+
elif inputs_embeds is not None:
|
668 |
+
batch_size, seq_length, _ = inputs_embeds.shape
|
669 |
+
|
670 |
+
if past_key_values is None:
|
671 |
+
past_key_values = tuple([None] * len(self.h))
|
672 |
+
|
673 |
+
|
674 |
+
if inputs_embeds is None:
|
675 |
+
inputs_embeds = self.word_embeddings(input_ids)
|
676 |
+
hidden_states = inputs_embeds
|
677 |
+
|
678 |
+
if self.config.embed_layernorm:
|
679 |
+
hidden_states = self.word_embeddings_layernorm(inputs_embeds)
|
680 |
+
|
681 |
+
presents = () if use_cache else None
|
682 |
+
all_self_attentions = () if output_attentions else None
|
683 |
+
all_hidden_states = () if output_hidden_states else None
|
684 |
+
|
685 |
+
if self.gradient_checkpointing and self.training:
|
686 |
+
if use_cache:
|
687 |
+
use_cache = False
|
688 |
+
|
689 |
+
seq_length_with_past = seq_length
|
690 |
+
past_key_values_length = 0
|
691 |
+
if past_key_values[0] is not None:
|
692 |
+
past_key_values_length = past_key_values[0][0].shape[2]
|
693 |
+
seq_length_with_past = seq_length_with_past + past_key_values_length
|
694 |
+
if attention_mask is None:
|
695 |
+
attention_mask = torch.ones((batch_size, seq_length_with_past), device=hidden_states.device)
|
696 |
+
else:
|
697 |
+
attention_mask = attention_mask.to(hidden_states.device)
|
698 |
+
causal_mask = self._prepare_attn_mask(
|
699 |
+
attention_mask,
|
700 |
+
input_shape=(batch_size, seq_length),
|
701 |
+
past_key_values_length=past_key_values_length,
|
702 |
+
)
|
703 |
+
|
704 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
705 |
+
if output_hidden_states:
|
706 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
707 |
+
|
708 |
+
if self.gradient_checkpointing and self.training:
|
709 |
+
|
710 |
+
def create_custom_forward(module):
|
711 |
+
def custom_forward(*inputs):
|
712 |
+
# None for past_key_value
|
713 |
+
return module(*inputs, use_cache=use_cache, output_attentions=output_attentions)
|
714 |
+
|
715 |
+
return custom_forward
|
716 |
+
|
717 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
718 |
+
create_custom_forward(block),
|
719 |
+
hidden_states,
|
720 |
+
causal_mask,
|
721 |
+
layer_past,
|
722 |
+
)
|
723 |
+
else:
|
724 |
+
outputs = block(
|
725 |
+
hidden_states,
|
726 |
+
layer_past=layer_past,
|
727 |
+
attention_mask=causal_mask,
|
728 |
+
use_cache=use_cache,
|
729 |
+
output_attentions=output_attentions,
|
730 |
+
)
|
731 |
+
|
732 |
+
hidden_states = outputs[0]
|
733 |
+
if use_cache is True:
|
734 |
+
presents = presents + (outputs[1],)
|
735 |
+
|
736 |
+
if output_attentions:
|
737 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
738 |
+
hidden_states = self.ln_f(hidden_states)
|
739 |
+
if output_hidden_states:
|
740 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
741 |
+
if not return_dict:
|
742 |
+
return tuple(v for v in [hidden_states, presents, all_hidden_states, all_self_attentions] if v is not None)
|
743 |
+
return BaseModelOutputWithPastAndCrossAttentions(
|
744 |
+
last_hidden_state=hidden_states,
|
745 |
+
past_key_values=presents,
|
746 |
+
hidden_states=all_hidden_states,
|
747 |
+
attentions=all_self_attentions,
|
748 |
+
)
|
749 |
+
|
750 |
+
|
751 |
+
class TelechatForCausalLM(TelechatPreTrainedModel):
|
752 |
+
# _tied_weights_keys = ["lm_head.weight"]
|
753 |
+
_keys_to_ignore_on_load_missing = [ r"lm_head.weight"]
|
754 |
+
def __init__(self, config: TelechatConfig):
|
755 |
+
super().__init__(config)
|
756 |
+
self.transformer = TelechatModel(config)
|
757 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
758 |
+
self.post_init()
|
759 |
+
|
760 |
+
def get_output_embeddings(self):
|
761 |
+
return self.lm_head
|
762 |
+
|
763 |
+
def set_output_embeddings(self, new_embeddings: torch.Tensor):
|
764 |
+
self.lm_head = new_embeddings
|
765 |
+
|
766 |
+
def prepare_inputs_for_generation(
|
767 |
+
self,
|
768 |
+
input_ids: torch.LongTensor,
|
769 |
+
past_key_values: Optional[torch.Tensor] = None,
|
770 |
+
attention_mask: Optional[torch.Tensor] = None,
|
771 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
772 |
+
**kwargs,
|
773 |
+
) -> dict:
|
774 |
+
if past_key_values:
|
775 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
776 |
+
if inputs_embeds is not None and past_key_values is None:
|
777 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
778 |
+
else:
|
779 |
+
model_inputs = {"input_ids": input_ids}
|
780 |
+
|
781 |
+
model_inputs.update(
|
782 |
+
{
|
783 |
+
"past_key_values": past_key_values,
|
784 |
+
"use_cache": kwargs.get("use_cache"),
|
785 |
+
"attention_mask": attention_mask,
|
786 |
+
}
|
787 |
+
)
|
788 |
+
return model_inputs
|
789 |
+
|
790 |
+
def forward(
|
791 |
+
self,
|
792 |
+
input_ids: Optional[torch.LongTensor] = None,
|
793 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
|
794 |
+
attention_mask: Optional[torch.Tensor] = None,
|
795 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
796 |
+
labels: Optional[torch.Tensor] = None,
|
797 |
+
use_cache: Optional[bool] = None,
|
798 |
+
output_attentions: Optional[bool] = None,
|
799 |
+
output_hidden_states: Optional[bool] = None,
|
800 |
+
return_dict: Optional[bool] = None,
|
801 |
+
**deprecated_arguments,
|
802 |
+
) -> Union[Tuple[torch.Tensor], CausalLMOutputWithCrossAttentions]:
|
803 |
+
|
804 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
805 |
+
|
806 |
+
transformer_outputs = self.transformer(
|
807 |
+
input_ids,
|
808 |
+
past_key_values=past_key_values,
|
809 |
+
attention_mask=attention_mask,
|
810 |
+
inputs_embeds=inputs_embeds,
|
811 |
+
use_cache=use_cache,
|
812 |
+
output_attentions=output_attentions,
|
813 |
+
output_hidden_states=output_hidden_states,
|
814 |
+
return_dict=return_dict,
|
815 |
+
)
|
816 |
+
hidden_states = transformer_outputs[0]
|
817 |
+
lm_logits = self.lm_head(hidden_states)
|
818 |
+
|
819 |
+
loss = None
|
820 |
+
if labels is not None:
|
821 |
+
labels = labels.to(lm_logits.device)
|
822 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
823 |
+
shift_labels = labels[..., 1:].contiguous()
|
824 |
+
batch_size, seq_length, vocab_size = shift_logits.shape
|
825 |
+
loss_fct = CrossEntropyLoss()
|
826 |
+
loss = loss_fct(
|
827 |
+
shift_logits.view(batch_size * seq_length, vocab_size), shift_labels.view(batch_size * seq_length)
|
828 |
+
)
|
829 |
+
|
830 |
+
if not return_dict:
|
831 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
832 |
+
return ((loss,) + output) if loss is not None else output
|
833 |
+
|
834 |
+
return CausalLMOutputWithCrossAttentions(
|
835 |
+
loss=loss,
|
836 |
+
logits=lm_logits,
|
837 |
+
past_key_values=transformer_outputs.past_key_values,
|
838 |
+
hidden_states=transformer_outputs.hidden_states,
|
839 |
+
attentions=transformer_outputs.attentions,
|
840 |
+
)
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 24772864000
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "pytorch_model_00041-of-00041.bin",
|
7 |
+
"transformer.h.0.input_layernorm.weight": "pytorch_model_00002-of-00041.bin",
|
8 |
+
"transformer.h.0.mlp.down_proj.bias": "pytorch_model_00002-of-00041.bin",
|
9 |
+
"transformer.h.0.mlp.down_proj.weight": "pytorch_model_00002-of-00041.bin",
|
10 |
+
"transformer.h.0.mlp.gate_proj.weight": "pytorch_model_00002-of-00041.bin",
|
11 |
+
"transformer.h.0.mlp.up_proj.weight": "pytorch_model_00002-of-00041.bin",
|
12 |
+
"transformer.h.0.post_attention_layernorm.weight": "pytorch_model_00002-of-00041.bin",
|
13 |
+
"transformer.h.0.self_attention.dense.bias": "pytorch_model_00002-of-00041.bin",
|
14 |
+
"transformer.h.0.self_attention.dense.weight": "pytorch_model_00002-of-00041.bin",
|
15 |
+
"transformer.h.0.self_attention.key_value.weight": "pytorch_model_00002-of-00041.bin",
|
16 |
+
"transformer.h.0.self_attention.query.weight": "pytorch_model_00002-of-00041.bin",
|
17 |
+
"transformer.h.1.input_layernorm.weight": "pytorch_model_00003-of-00041.bin",
|
18 |
+
"transformer.h.1.mlp.down_proj.bias": "pytorch_model_00003-of-00041.bin",
|
19 |
+
"transformer.h.1.mlp.down_proj.weight": "pytorch_model_00003-of-00041.bin",
|
20 |
+
"transformer.h.1.mlp.gate_proj.weight": "pytorch_model_00003-of-00041.bin",
|
21 |
+
"transformer.h.1.mlp.up_proj.weight": "pytorch_model_00003-of-00041.bin",
|
22 |
+
"transformer.h.1.post_attention_layernorm.weight": "pytorch_model_00003-of-00041.bin",
|
23 |
+
"transformer.h.1.self_attention.dense.bias": "pytorch_model_00003-of-00041.bin",
|
24 |
+
"transformer.h.1.self_attention.dense.weight": "pytorch_model_00003-of-00041.bin",
|
25 |
+
"transformer.h.1.self_attention.key_value.weight": "pytorch_model_00003-of-00041.bin",
|
26 |
+
"transformer.h.1.self_attention.query.weight": "pytorch_model_00003-of-00041.bin",
|
27 |
+
"transformer.h.10.input_layernorm.weight": "pytorch_model_00012-of-00041.bin",
|
28 |
+
"transformer.h.10.mlp.down_proj.bias": "pytorch_model_00012-of-00041.bin",
|
29 |
+
"transformer.h.10.mlp.down_proj.weight": "pytorch_model_00012-of-00041.bin",
|
30 |
+
"transformer.h.10.mlp.gate_proj.weight": "pytorch_model_00012-of-00041.bin",
|
31 |
+
"transformer.h.10.mlp.up_proj.weight": "pytorch_model_00012-of-00041.bin",
|
32 |
+
"transformer.h.10.post_attention_layernorm.weight": "pytorch_model_00012-of-00041.bin",
|
33 |
+
"transformer.h.10.self_attention.dense.bias": "pytorch_model_00012-of-00041.bin",
|
34 |
+
"transformer.h.10.self_attention.dense.weight": "pytorch_model_00012-of-00041.bin",
|
35 |
+
"transformer.h.10.self_attention.key_value.weight": "pytorch_model_00012-of-00041.bin",
|
36 |
+
"transformer.h.10.self_attention.query.weight": "pytorch_model_00012-of-00041.bin",
|
37 |
+
"transformer.h.11.input_layernorm.weight": "pytorch_model_00013-of-00041.bin",
|
38 |
+
"transformer.h.11.mlp.down_proj.bias": "pytorch_model_00013-of-00041.bin",
|
39 |
+
"transformer.h.11.mlp.down_proj.weight": "pytorch_model_00013-of-00041.bin",
|
40 |
+
"transformer.h.11.mlp.gate_proj.weight": "pytorch_model_00013-of-00041.bin",
|
41 |
+
"transformer.h.11.mlp.up_proj.weight": "pytorch_model_00013-of-00041.bin",
|
42 |
+
"transformer.h.11.post_attention_layernorm.weight": "pytorch_model_00013-of-00041.bin",
|
43 |
+
"transformer.h.11.self_attention.dense.bias": "pytorch_model_00013-of-00041.bin",
|
44 |
+
"transformer.h.11.self_attention.dense.weight": "pytorch_model_00013-of-00041.bin",
|
45 |
+
"transformer.h.11.self_attention.key_value.weight": "pytorch_model_00013-of-00041.bin",
|
46 |
+
"transformer.h.11.self_attention.query.weight": "pytorch_model_00013-of-00041.bin",
|
47 |
+
"transformer.h.12.input_layernorm.weight": "pytorch_model_00014-of-00041.bin",
|
48 |
+
"transformer.h.12.mlp.down_proj.bias": "pytorch_model_00014-of-00041.bin",
|
49 |
+
"transformer.h.12.mlp.down_proj.weight": "pytorch_model_00014-of-00041.bin",
|
50 |
+
"transformer.h.12.mlp.gate_proj.weight": "pytorch_model_00014-of-00041.bin",
|
51 |
+
"transformer.h.12.mlp.up_proj.weight": "pytorch_model_00014-of-00041.bin",
|
52 |
+
"transformer.h.12.post_attention_layernorm.weight": "pytorch_model_00014-of-00041.bin",
|
53 |
+
"transformer.h.12.self_attention.dense.bias": "pytorch_model_00014-of-00041.bin",
|
54 |
+
"transformer.h.12.self_attention.dense.weight": "pytorch_model_00014-of-00041.bin",
|
55 |
+
"transformer.h.12.self_attention.key_value.weight": "pytorch_model_00014-of-00041.bin",
|
56 |
+
"transformer.h.12.self_attention.query.weight": "pytorch_model_00014-of-00041.bin",
|
57 |
+
"transformer.h.13.input_layernorm.weight": "pytorch_model_00015-of-00041.bin",
|
58 |
+
"transformer.h.13.mlp.down_proj.bias": "pytorch_model_00015-of-00041.bin",
|
59 |
+
"transformer.h.13.mlp.down_proj.weight": "pytorch_model_00015-of-00041.bin",
|
60 |
+
"transformer.h.13.mlp.gate_proj.weight": "pytorch_model_00015-of-00041.bin",
|
61 |
+
"transformer.h.13.mlp.up_proj.weight": "pytorch_model_00015-of-00041.bin",
|
62 |
+
"transformer.h.13.post_attention_layernorm.weight": "pytorch_model_00015-of-00041.bin",
|
63 |
+
"transformer.h.13.self_attention.dense.bias": "pytorch_model_00015-of-00041.bin",
|
64 |
+
"transformer.h.13.self_attention.dense.weight": "pytorch_model_00015-of-00041.bin",
|
65 |
+
"transformer.h.13.self_attention.key_value.weight": "pytorch_model_00015-of-00041.bin",
|
66 |
+
"transformer.h.13.self_attention.query.weight": "pytorch_model_00015-of-00041.bin",
|
67 |
+
"transformer.h.14.input_layernorm.weight": "pytorch_model_00016-of-00041.bin",
|
68 |
+
"transformer.h.14.mlp.down_proj.bias": "pytorch_model_00016-of-00041.bin",
|
69 |
+
"transformer.h.14.mlp.down_proj.weight": "pytorch_model_00016-of-00041.bin",
|
70 |
+
"transformer.h.14.mlp.gate_proj.weight": "pytorch_model_00016-of-00041.bin",
|
71 |
+
"transformer.h.14.mlp.up_proj.weight": "pytorch_model_00016-of-00041.bin",
|
72 |
+
"transformer.h.14.post_attention_layernorm.weight": "pytorch_model_00016-of-00041.bin",
|
73 |
+
"transformer.h.14.self_attention.dense.bias": "pytorch_model_00016-of-00041.bin",
|
74 |
+
"transformer.h.14.self_attention.dense.weight": "pytorch_model_00016-of-00041.bin",
|
75 |
+
"transformer.h.14.self_attention.key_value.weight": "pytorch_model_00016-of-00041.bin",
|
76 |
+
"transformer.h.14.self_attention.query.weight": "pytorch_model_00016-of-00041.bin",
|
77 |
+
"transformer.h.15.input_layernorm.weight": "pytorch_model_00017-of-00041.bin",
|
78 |
+
"transformer.h.15.mlp.down_proj.bias": "pytorch_model_00017-of-00041.bin",
|
79 |
+
"transformer.h.15.mlp.down_proj.weight": "pytorch_model_00017-of-00041.bin",
|
80 |
+
"transformer.h.15.mlp.gate_proj.weight": "pytorch_model_00017-of-00041.bin",
|
81 |
+
"transformer.h.15.mlp.up_proj.weight": "pytorch_model_00017-of-00041.bin",
|
82 |
+
"transformer.h.15.post_attention_layernorm.weight": "pytorch_model_00017-of-00041.bin",
|
83 |
+
"transformer.h.15.self_attention.dense.bias": "pytorch_model_00017-of-00041.bin",
|
84 |
+
"transformer.h.15.self_attention.dense.weight": "pytorch_model_00017-of-00041.bin",
|
85 |
+
"transformer.h.15.self_attention.key_value.weight": "pytorch_model_00017-of-00041.bin",
|
86 |
+
"transformer.h.15.self_attention.query.weight": "pytorch_model_00017-of-00041.bin",
|
87 |
+
"transformer.h.16.input_layernorm.weight": "pytorch_model_00018-of-00041.bin",
|
88 |
+
"transformer.h.16.mlp.down_proj.bias": "pytorch_model_00018-of-00041.bin",
|
89 |
+
"transformer.h.16.mlp.down_proj.weight": "pytorch_model_00018-of-00041.bin",
|
90 |
+
"transformer.h.16.mlp.gate_proj.weight": "pytorch_model_00018-of-00041.bin",
|
91 |
+
"transformer.h.16.mlp.up_proj.weight": "pytorch_model_00018-of-00041.bin",
|
92 |
+
"transformer.h.16.post_attention_layernorm.weight": "pytorch_model_00018-of-00041.bin",
|
93 |
+
"transformer.h.16.self_attention.dense.bias": "pytorch_model_00018-of-00041.bin",
|
94 |
+
"transformer.h.16.self_attention.dense.weight": "pytorch_model_00018-of-00041.bin",
|
95 |
+
"transformer.h.16.self_attention.key_value.weight": "pytorch_model_00018-of-00041.bin",
|
96 |
+
"transformer.h.16.self_attention.query.weight": "pytorch_model_00018-of-00041.bin",
|
97 |
+
"transformer.h.17.input_layernorm.weight": "pytorch_model_00019-of-00041.bin",
|
98 |
+
"transformer.h.17.mlp.down_proj.bias": "pytorch_model_00019-of-00041.bin",
|
99 |
+
"transformer.h.17.mlp.down_proj.weight": "pytorch_model_00019-of-00041.bin",
|
100 |
+
"transformer.h.17.mlp.gate_proj.weight": "pytorch_model_00019-of-00041.bin",
|
101 |
+
"transformer.h.17.mlp.up_proj.weight": "pytorch_model_00019-of-00041.bin",
|
102 |
+
"transformer.h.17.post_attention_layernorm.weight": "pytorch_model_00019-of-00041.bin",
|
103 |
+
"transformer.h.17.self_attention.dense.bias": "pytorch_model_00019-of-00041.bin",
|
104 |
+
"transformer.h.17.self_attention.dense.weight": "pytorch_model_00019-of-00041.bin",
|
105 |
+
"transformer.h.17.self_attention.key_value.weight": "pytorch_model_00019-of-00041.bin",
|
106 |
+
"transformer.h.17.self_attention.query.weight": "pytorch_model_00019-of-00041.bin",
|
107 |
+
"transformer.h.18.input_layernorm.weight": "pytorch_model_00020-of-00041.bin",
|
108 |
+
"transformer.h.18.mlp.down_proj.bias": "pytorch_model_00020-of-00041.bin",
|
109 |
+
"transformer.h.18.mlp.down_proj.weight": "pytorch_model_00020-of-00041.bin",
|
110 |
+
"transformer.h.18.mlp.gate_proj.weight": "pytorch_model_00020-of-00041.bin",
|
111 |
+
"transformer.h.18.mlp.up_proj.weight": "pytorch_model_00020-of-00041.bin",
|
112 |
+
"transformer.h.18.post_attention_layernorm.weight": "pytorch_model_00020-of-00041.bin",
|
113 |
+
"transformer.h.18.self_attention.dense.bias": "pytorch_model_00020-of-00041.bin",
|
114 |
+
"transformer.h.18.self_attention.dense.weight": "pytorch_model_00020-of-00041.bin",
|
115 |
+
"transformer.h.18.self_attention.key_value.weight": "pytorch_model_00020-of-00041.bin",
|
116 |
+
"transformer.h.18.self_attention.query.weight": "pytorch_model_00020-of-00041.bin",
|
117 |
+
"transformer.h.19.input_layernorm.weight": "pytorch_model_00021-of-00041.bin",
|
118 |
+
"transformer.h.19.mlp.down_proj.bias": "pytorch_model_00021-of-00041.bin",
|
119 |
+
"transformer.h.19.mlp.down_proj.weight": "pytorch_model_00021-of-00041.bin",
|
120 |
+
"transformer.h.19.mlp.gate_proj.weight": "pytorch_model_00021-of-00041.bin",
|
121 |
+
"transformer.h.19.mlp.up_proj.weight": "pytorch_model_00021-of-00041.bin",
|
122 |
+
"transformer.h.19.post_attention_layernorm.weight": "pytorch_model_00021-of-00041.bin",
|
123 |
+
"transformer.h.19.self_attention.dense.bias": "pytorch_model_00021-of-00041.bin",
|
124 |
+
"transformer.h.19.self_attention.dense.weight": "pytorch_model_00021-of-00041.bin",
|
125 |
+
"transformer.h.19.self_attention.key_value.weight": "pytorch_model_00021-of-00041.bin",
|
126 |
+
"transformer.h.19.self_attention.query.weight": "pytorch_model_00021-of-00041.bin",
|
127 |
+
"transformer.h.2.input_layernorm.weight": "pytorch_model_00004-of-00041.bin",
|
128 |
+
"transformer.h.2.mlp.down_proj.bias": "pytorch_model_00004-of-00041.bin",
|
129 |
+
"transformer.h.2.mlp.down_proj.weight": "pytorch_model_00004-of-00041.bin",
|
130 |
+
"transformer.h.2.mlp.gate_proj.weight": "pytorch_model_00004-of-00041.bin",
|
131 |
+
"transformer.h.2.mlp.up_proj.weight": "pytorch_model_00004-of-00041.bin",
|
132 |
+
"transformer.h.2.post_attention_layernorm.weight": "pytorch_model_00004-of-00041.bin",
|
133 |
+
"transformer.h.2.self_attention.dense.bias": "pytorch_model_00004-of-00041.bin",
|
134 |
+
"transformer.h.2.self_attention.dense.weight": "pytorch_model_00004-of-00041.bin",
|
135 |
+
"transformer.h.2.self_attention.key_value.weight": "pytorch_model_00004-of-00041.bin",
|
136 |
+
"transformer.h.2.self_attention.query.weight": "pytorch_model_00004-of-00041.bin",
|
137 |
+
"transformer.h.20.input_layernorm.weight": "pytorch_model_00022-of-00041.bin",
|
138 |
+
"transformer.h.20.mlp.down_proj.bias": "pytorch_model_00022-of-00041.bin",
|
139 |
+
"transformer.h.20.mlp.down_proj.weight": "pytorch_model_00022-of-00041.bin",
|
140 |
+
"transformer.h.20.mlp.gate_proj.weight": "pytorch_model_00022-of-00041.bin",
|
141 |
+
"transformer.h.20.mlp.up_proj.weight": "pytorch_model_00022-of-00041.bin",
|
142 |
+
"transformer.h.20.post_attention_layernorm.weight": "pytorch_model_00022-of-00041.bin",
|
143 |
+
"transformer.h.20.self_attention.dense.bias": "pytorch_model_00022-of-00041.bin",
|
144 |
+
"transformer.h.20.self_attention.dense.weight": "pytorch_model_00022-of-00041.bin",
|
145 |
+
"transformer.h.20.self_attention.key_value.weight": "pytorch_model_00022-of-00041.bin",
|
146 |
+
"transformer.h.20.self_attention.query.weight": "pytorch_model_00022-of-00041.bin",
|
147 |
+
"transformer.h.21.input_layernorm.weight": "pytorch_model_00023-of-00041.bin",
|
148 |
+
"transformer.h.21.mlp.down_proj.bias": "pytorch_model_00023-of-00041.bin",
|
149 |
+
"transformer.h.21.mlp.down_proj.weight": "pytorch_model_00023-of-00041.bin",
|
150 |
+
"transformer.h.21.mlp.gate_proj.weight": "pytorch_model_00023-of-00041.bin",
|
151 |
+
"transformer.h.21.mlp.up_proj.weight": "pytorch_model_00023-of-00041.bin",
|
152 |
+
"transformer.h.21.post_attention_layernorm.weight": "pytorch_model_00023-of-00041.bin",
|
153 |
+
"transformer.h.21.self_attention.dense.bias": "pytorch_model_00023-of-00041.bin",
|
154 |
+
"transformer.h.21.self_attention.dense.weight": "pytorch_model_00023-of-00041.bin",
|
155 |
+
"transformer.h.21.self_attention.key_value.weight": "pytorch_model_00023-of-00041.bin",
|
156 |
+
"transformer.h.21.self_attention.query.weight": "pytorch_model_00023-of-00041.bin",
|
157 |
+
"transformer.h.22.input_layernorm.weight": "pytorch_model_00024-of-00041.bin",
|
158 |
+
"transformer.h.22.mlp.down_proj.bias": "pytorch_model_00024-of-00041.bin",
|
159 |
+
"transformer.h.22.mlp.down_proj.weight": "pytorch_model_00024-of-00041.bin",
|
160 |
+
"transformer.h.22.mlp.gate_proj.weight": "pytorch_model_00024-of-00041.bin",
|
161 |
+
"transformer.h.22.mlp.up_proj.weight": "pytorch_model_00024-of-00041.bin",
|
162 |
+
"transformer.h.22.post_attention_layernorm.weight": "pytorch_model_00024-of-00041.bin",
|
163 |
+
"transformer.h.22.self_attention.dense.bias": "pytorch_model_00024-of-00041.bin",
|
164 |
+
"transformer.h.22.self_attention.dense.weight": "pytorch_model_00024-of-00041.bin",
|
165 |
+
"transformer.h.22.self_attention.key_value.weight": "pytorch_model_00024-of-00041.bin",
|
166 |
+
"transformer.h.22.self_attention.query.weight": "pytorch_model_00024-of-00041.bin",
|
167 |
+
"transformer.h.23.input_layernorm.weight": "pytorch_model_00025-of-00041.bin",
|
168 |
+
"transformer.h.23.mlp.down_proj.bias": "pytorch_model_00025-of-00041.bin",
|
169 |
+
"transformer.h.23.mlp.down_proj.weight": "pytorch_model_00025-of-00041.bin",
|
170 |
+
"transformer.h.23.mlp.gate_proj.weight": "pytorch_model_00025-of-00041.bin",
|
171 |
+
"transformer.h.23.mlp.up_proj.weight": "pytorch_model_00025-of-00041.bin",
|
172 |
+
"transformer.h.23.post_attention_layernorm.weight": "pytorch_model_00025-of-00041.bin",
|
173 |
+
"transformer.h.23.self_attention.dense.bias": "pytorch_model_00025-of-00041.bin",
|
174 |
+
"transformer.h.23.self_attention.dense.weight": "pytorch_model_00025-of-00041.bin",
|
175 |
+
"transformer.h.23.self_attention.key_value.weight": "pytorch_model_00025-of-00041.bin",
|
176 |
+
"transformer.h.23.self_attention.query.weight": "pytorch_model_00025-of-00041.bin",
|
177 |
+
"transformer.h.24.input_layernorm.weight": "pytorch_model_00026-of-00041.bin",
|
178 |
+
"transformer.h.24.mlp.down_proj.bias": "pytorch_model_00026-of-00041.bin",
|
179 |
+
"transformer.h.24.mlp.down_proj.weight": "pytorch_model_00026-of-00041.bin",
|
180 |
+
"transformer.h.24.mlp.gate_proj.weight": "pytorch_model_00026-of-00041.bin",
|
181 |
+
"transformer.h.24.mlp.up_proj.weight": "pytorch_model_00026-of-00041.bin",
|
182 |
+
"transformer.h.24.post_attention_layernorm.weight": "pytorch_model_00026-of-00041.bin",
|
183 |
+
"transformer.h.24.self_attention.dense.bias": "pytorch_model_00026-of-00041.bin",
|
184 |
+
"transformer.h.24.self_attention.dense.weight": "pytorch_model_00026-of-00041.bin",
|
185 |
+
"transformer.h.24.self_attention.key_value.weight": "pytorch_model_00026-of-00041.bin",
|
186 |
+
"transformer.h.24.self_attention.query.weight": "pytorch_model_00026-of-00041.bin",
|
187 |
+
"transformer.h.25.input_layernorm.weight": "pytorch_model_00027-of-00041.bin",
|
188 |
+
"transformer.h.25.mlp.down_proj.bias": "pytorch_model_00027-of-00041.bin",
|
189 |
+
"transformer.h.25.mlp.down_proj.weight": "pytorch_model_00027-of-00041.bin",
|
190 |
+
"transformer.h.25.mlp.gate_proj.weight": "pytorch_model_00027-of-00041.bin",
|
191 |
+
"transformer.h.25.mlp.up_proj.weight": "pytorch_model_00027-of-00041.bin",
|
192 |
+
"transformer.h.25.post_attention_layernorm.weight": "pytorch_model_00027-of-00041.bin",
|
193 |
+
"transformer.h.25.self_attention.dense.bias": "pytorch_model_00027-of-00041.bin",
|
194 |
+
"transformer.h.25.self_attention.dense.weight": "pytorch_model_00027-of-00041.bin",
|
195 |
+
"transformer.h.25.self_attention.key_value.weight": "pytorch_model_00027-of-00041.bin",
|
196 |
+
"transformer.h.25.self_attention.query.weight": "pytorch_model_00027-of-00041.bin",
|
197 |
+
"transformer.h.26.input_layernorm.weight": "pytorch_model_00028-of-00041.bin",
|
198 |
+
"transformer.h.26.mlp.down_proj.bias": "pytorch_model_00028-of-00041.bin",
|
199 |
+
"transformer.h.26.mlp.down_proj.weight": "pytorch_model_00028-of-00041.bin",
|
200 |
+
"transformer.h.26.mlp.gate_proj.weight": "pytorch_model_00028-of-00041.bin",
|
201 |
+
"transformer.h.26.mlp.up_proj.weight": "pytorch_model_00028-of-00041.bin",
|
202 |
+
"transformer.h.26.post_attention_layernorm.weight": "pytorch_model_00028-of-00041.bin",
|
203 |
+
"transformer.h.26.self_attention.dense.bias": "pytorch_model_00028-of-00041.bin",
|
204 |
+
"transformer.h.26.self_attention.dense.weight": "pytorch_model_00028-of-00041.bin",
|
205 |
+
"transformer.h.26.self_attention.key_value.weight": "pytorch_model_00028-of-00041.bin",
|
206 |
+
"transformer.h.26.self_attention.query.weight": "pytorch_model_00028-of-00041.bin",
|
207 |
+
"transformer.h.27.input_layernorm.weight": "pytorch_model_00029-of-00041.bin",
|
208 |
+
"transformer.h.27.mlp.down_proj.bias": "pytorch_model_00029-of-00041.bin",
|
209 |
+
"transformer.h.27.mlp.down_proj.weight": "pytorch_model_00029-of-00041.bin",
|
210 |
+
"transformer.h.27.mlp.gate_proj.weight": "pytorch_model_00029-of-00041.bin",
|
211 |
+
"transformer.h.27.mlp.up_proj.weight": "pytorch_model_00029-of-00041.bin",
|
212 |
+
"transformer.h.27.post_attention_layernorm.weight": "pytorch_model_00029-of-00041.bin",
|
213 |
+
"transformer.h.27.self_attention.dense.bias": "pytorch_model_00029-of-00041.bin",
|
214 |
+
"transformer.h.27.self_attention.dense.weight": "pytorch_model_00029-of-00041.bin",
|
215 |
+
"transformer.h.27.self_attention.key_value.weight": "pytorch_model_00029-of-00041.bin",
|
216 |
+
"transformer.h.27.self_attention.query.weight": "pytorch_model_00029-of-00041.bin",
|
217 |
+
"transformer.h.28.input_layernorm.weight": "pytorch_model_00030-of-00041.bin",
|
218 |
+
"transformer.h.28.mlp.down_proj.bias": "pytorch_model_00030-of-00041.bin",
|
219 |
+
"transformer.h.28.mlp.down_proj.weight": "pytorch_model_00030-of-00041.bin",
|
220 |
+
"transformer.h.28.mlp.gate_proj.weight": "pytorch_model_00030-of-00041.bin",
|
221 |
+
"transformer.h.28.mlp.up_proj.weight": "pytorch_model_00030-of-00041.bin",
|
222 |
+
"transformer.h.28.post_attention_layernorm.weight": "pytorch_model_00030-of-00041.bin",
|
223 |
+
"transformer.h.28.self_attention.dense.bias": "pytorch_model_00030-of-00041.bin",
|
224 |
+
"transformer.h.28.self_attention.dense.weight": "pytorch_model_00030-of-00041.bin",
|
225 |
+
"transformer.h.28.self_attention.key_value.weight": "pytorch_model_00030-of-00041.bin",
|
226 |
+
"transformer.h.28.self_attention.query.weight": "pytorch_model_00030-of-00041.bin",
|
227 |
+
"transformer.h.29.input_layernorm.weight": "pytorch_model_00031-of-00041.bin",
|
228 |
+
"transformer.h.29.mlp.down_proj.bias": "pytorch_model_00031-of-00041.bin",
|
229 |
+
"transformer.h.29.mlp.down_proj.weight": "pytorch_model_00031-of-00041.bin",
|
230 |
+
"transformer.h.29.mlp.gate_proj.weight": "pytorch_model_00031-of-00041.bin",
|
231 |
+
"transformer.h.29.mlp.up_proj.weight": "pytorch_model_00031-of-00041.bin",
|
232 |
+
"transformer.h.29.post_attention_layernorm.weight": "pytorch_model_00031-of-00041.bin",
|
233 |
+
"transformer.h.29.self_attention.dense.bias": "pytorch_model_00031-of-00041.bin",
|
234 |
+
"transformer.h.29.self_attention.dense.weight": "pytorch_model_00031-of-00041.bin",
|
235 |
+
"transformer.h.29.self_attention.key_value.weight": "pytorch_model_00031-of-00041.bin",
|
236 |
+
"transformer.h.29.self_attention.query.weight": "pytorch_model_00031-of-00041.bin",
|
237 |
+
"transformer.h.3.input_layernorm.weight": "pytorch_model_00005-of-00041.bin",
|
238 |
+
"transformer.h.3.mlp.down_proj.bias": "pytorch_model_00005-of-00041.bin",
|
239 |
+
"transformer.h.3.mlp.down_proj.weight": "pytorch_model_00005-of-00041.bin",
|
240 |
+
"transformer.h.3.mlp.gate_proj.weight": "pytorch_model_00005-of-00041.bin",
|
241 |
+
"transformer.h.3.mlp.up_proj.weight": "pytorch_model_00005-of-00041.bin",
|
242 |
+
"transformer.h.3.post_attention_layernorm.weight": "pytorch_model_00005-of-00041.bin",
|
243 |
+
"transformer.h.3.self_attention.dense.bias": "pytorch_model_00005-of-00041.bin",
|
244 |
+
"transformer.h.3.self_attention.dense.weight": "pytorch_model_00005-of-00041.bin",
|
245 |
+
"transformer.h.3.self_attention.key_value.weight": "pytorch_model_00005-of-00041.bin",
|
246 |
+
"transformer.h.3.self_attention.query.weight": "pytorch_model_00005-of-00041.bin",
|
247 |
+
"transformer.h.30.input_layernorm.weight": "pytorch_model_00032-of-00041.bin",
|
248 |
+
"transformer.h.30.mlp.down_proj.bias": "pytorch_model_00032-of-00041.bin",
|
249 |
+
"transformer.h.30.mlp.down_proj.weight": "pytorch_model_00032-of-00041.bin",
|
250 |
+
"transformer.h.30.mlp.gate_proj.weight": "pytorch_model_00032-of-00041.bin",
|
251 |
+
"transformer.h.30.mlp.up_proj.weight": "pytorch_model_00032-of-00041.bin",
|
252 |
+
"transformer.h.30.post_attention_layernorm.weight": "pytorch_model_00032-of-00041.bin",
|
253 |
+
"transformer.h.30.self_attention.dense.bias": "pytorch_model_00032-of-00041.bin",
|
254 |
+
"transformer.h.30.self_attention.dense.weight": "pytorch_model_00032-of-00041.bin",
|
255 |
+
"transformer.h.30.self_attention.key_value.weight": "pytorch_model_00032-of-00041.bin",
|
256 |
+
"transformer.h.30.self_attention.query.weight": "pytorch_model_00032-of-00041.bin",
|
257 |
+
"transformer.h.31.input_layernorm.weight": "pytorch_model_00033-of-00041.bin",
|
258 |
+
"transformer.h.31.mlp.down_proj.bias": "pytorch_model_00033-of-00041.bin",
|
259 |
+
"transformer.h.31.mlp.down_proj.weight": "pytorch_model_00033-of-00041.bin",
|
260 |
+
"transformer.h.31.mlp.gate_proj.weight": "pytorch_model_00033-of-00041.bin",
|
261 |
+
"transformer.h.31.mlp.up_proj.weight": "pytorch_model_00033-of-00041.bin",
|
262 |
+
"transformer.h.31.post_attention_layernorm.weight": "pytorch_model_00033-of-00041.bin",
|
263 |
+
"transformer.h.31.self_attention.dense.bias": "pytorch_model_00033-of-00041.bin",
|
264 |
+
"transformer.h.31.self_attention.dense.weight": "pytorch_model_00033-of-00041.bin",
|
265 |
+
"transformer.h.31.self_attention.key_value.weight": "pytorch_model_00033-of-00041.bin",
|
266 |
+
"transformer.h.31.self_attention.query.weight": "pytorch_model_00033-of-00041.bin",
|
267 |
+
"transformer.h.32.input_layernorm.weight": "pytorch_model_00034-of-00041.bin",
|
268 |
+
"transformer.h.32.mlp.down_proj.bias": "pytorch_model_00034-of-00041.bin",
|
269 |
+
"transformer.h.32.mlp.down_proj.weight": "pytorch_model_00034-of-00041.bin",
|
270 |
+
"transformer.h.32.mlp.gate_proj.weight": "pytorch_model_00034-of-00041.bin",
|
271 |
+
"transformer.h.32.mlp.up_proj.weight": "pytorch_model_00034-of-00041.bin",
|
272 |
+
"transformer.h.32.post_attention_layernorm.weight": "pytorch_model_00034-of-00041.bin",
|
273 |
+
"transformer.h.32.self_attention.dense.bias": "pytorch_model_00034-of-00041.bin",
|
274 |
+
"transformer.h.32.self_attention.dense.weight": "pytorch_model_00034-of-00041.bin",
|
275 |
+
"transformer.h.32.self_attention.key_value.weight": "pytorch_model_00034-of-00041.bin",
|
276 |
+
"transformer.h.32.self_attention.query.weight": "pytorch_model_00034-of-00041.bin",
|
277 |
+
"transformer.h.33.input_layernorm.weight": "pytorch_model_00035-of-00041.bin",
|
278 |
+
"transformer.h.33.mlp.down_proj.bias": "pytorch_model_00035-of-00041.bin",
|
279 |
+
"transformer.h.33.mlp.down_proj.weight": "pytorch_model_00035-of-00041.bin",
|
280 |
+
"transformer.h.33.mlp.gate_proj.weight": "pytorch_model_00035-of-00041.bin",
|
281 |
+
"transformer.h.33.mlp.up_proj.weight": "pytorch_model_00035-of-00041.bin",
|
282 |
+
"transformer.h.33.post_attention_layernorm.weight": "pytorch_model_00035-of-00041.bin",
|
283 |
+
"transformer.h.33.self_attention.dense.bias": "pytorch_model_00035-of-00041.bin",
|
284 |
+
"transformer.h.33.self_attention.dense.weight": "pytorch_model_00035-of-00041.bin",
|
285 |
+
"transformer.h.33.self_attention.key_value.weight": "pytorch_model_00035-of-00041.bin",
|
286 |
+
"transformer.h.33.self_attention.query.weight": "pytorch_model_00035-of-00041.bin",
|
287 |
+
"transformer.h.34.input_layernorm.weight": "pytorch_model_00036-of-00041.bin",
|
288 |
+
"transformer.h.34.mlp.down_proj.bias": "pytorch_model_00036-of-00041.bin",
|
289 |
+
"transformer.h.34.mlp.down_proj.weight": "pytorch_model_00036-of-00041.bin",
|
290 |
+
"transformer.h.34.mlp.gate_proj.weight": "pytorch_model_00036-of-00041.bin",
|
291 |
+
"transformer.h.34.mlp.up_proj.weight": "pytorch_model_00036-of-00041.bin",
|
292 |
+
"transformer.h.34.post_attention_layernorm.weight": "pytorch_model_00036-of-00041.bin",
|
293 |
+
"transformer.h.34.self_attention.dense.bias": "pytorch_model_00036-of-00041.bin",
|
294 |
+
"transformer.h.34.self_attention.dense.weight": "pytorch_model_00036-of-00041.bin",
|
295 |
+
"transformer.h.34.self_attention.key_value.weight": "pytorch_model_00036-of-00041.bin",
|
296 |
+
"transformer.h.34.self_attention.query.weight": "pytorch_model_00036-of-00041.bin",
|
297 |
+
"transformer.h.35.input_layernorm.weight": "pytorch_model_00037-of-00041.bin",
|
298 |
+
"transformer.h.35.mlp.down_proj.bias": "pytorch_model_00037-of-00041.bin",
|
299 |
+
"transformer.h.35.mlp.down_proj.weight": "pytorch_model_00037-of-00041.bin",
|
300 |
+
"transformer.h.35.mlp.gate_proj.weight": "pytorch_model_00037-of-00041.bin",
|
301 |
+
"transformer.h.35.mlp.up_proj.weight": "pytorch_model_00037-of-00041.bin",
|
302 |
+
"transformer.h.35.post_attention_layernorm.weight": "pytorch_model_00037-of-00041.bin",
|
303 |
+
"transformer.h.35.self_attention.dense.bias": "pytorch_model_00037-of-00041.bin",
|
304 |
+
"transformer.h.35.self_attention.dense.weight": "pytorch_model_00037-of-00041.bin",
|
305 |
+
"transformer.h.35.self_attention.key_value.weight": "pytorch_model_00037-of-00041.bin",
|
306 |
+
"transformer.h.35.self_attention.query.weight": "pytorch_model_00037-of-00041.bin",
|
307 |
+
"transformer.h.36.input_layernorm.weight": "pytorch_model_00038-of-00041.bin",
|
308 |
+
"transformer.h.36.mlp.down_proj.bias": "pytorch_model_00038-of-00041.bin",
|
309 |
+
"transformer.h.36.mlp.down_proj.weight": "pytorch_model_00038-of-00041.bin",
|
310 |
+
"transformer.h.36.mlp.gate_proj.weight": "pytorch_model_00038-of-00041.bin",
|
311 |
+
"transformer.h.36.mlp.up_proj.weight": "pytorch_model_00038-of-00041.bin",
|
312 |
+
"transformer.h.36.post_attention_layernorm.weight": "pytorch_model_00038-of-00041.bin",
|
313 |
+
"transformer.h.36.self_attention.dense.bias": "pytorch_model_00038-of-00041.bin",
|
314 |
+
"transformer.h.36.self_attention.dense.weight": "pytorch_model_00038-of-00041.bin",
|
315 |
+
"transformer.h.36.self_attention.key_value.weight": "pytorch_model_00038-of-00041.bin",
|
316 |
+
"transformer.h.36.self_attention.query.weight": "pytorch_model_00038-of-00041.bin",
|
317 |
+
"transformer.h.37.input_layernorm.weight": "pytorch_model_00039-of-00041.bin",
|
318 |
+
"transformer.h.37.mlp.down_proj.bias": "pytorch_model_00039-of-00041.bin",
|
319 |
+
"transformer.h.37.mlp.down_proj.weight": "pytorch_model_00039-of-00041.bin",
|
320 |
+
"transformer.h.37.mlp.gate_proj.weight": "pytorch_model_00039-of-00041.bin",
|
321 |
+
"transformer.h.37.mlp.up_proj.weight": "pytorch_model_00039-of-00041.bin",
|
322 |
+
"transformer.h.37.post_attention_layernorm.weight": "pytorch_model_00039-of-00041.bin",
|
323 |
+
"transformer.h.37.self_attention.dense.bias": "pytorch_model_00039-of-00041.bin",
|
324 |
+
"transformer.h.37.self_attention.dense.weight": "pytorch_model_00039-of-00041.bin",
|
325 |
+
"transformer.h.37.self_attention.key_value.weight": "pytorch_model_00039-of-00041.bin",
|
326 |
+
"transformer.h.37.self_attention.query.weight": "pytorch_model_00039-of-00041.bin",
|
327 |
+
"transformer.h.4.input_layernorm.weight": "pytorch_model_00006-of-00041.bin",
|
328 |
+
"transformer.h.4.mlp.down_proj.bias": "pytorch_model_00006-of-00041.bin",
|
329 |
+
"transformer.h.4.mlp.down_proj.weight": "pytorch_model_00006-of-00041.bin",
|
330 |
+
"transformer.h.4.mlp.gate_proj.weight": "pytorch_model_00006-of-00041.bin",
|
331 |
+
"transformer.h.4.mlp.up_proj.weight": "pytorch_model_00006-of-00041.bin",
|
332 |
+
"transformer.h.4.post_attention_layernorm.weight": "pytorch_model_00006-of-00041.bin",
|
333 |
+
"transformer.h.4.self_attention.dense.bias": "pytorch_model_00006-of-00041.bin",
|
334 |
+
"transformer.h.4.self_attention.dense.weight": "pytorch_model_00006-of-00041.bin",
|
335 |
+
"transformer.h.4.self_attention.key_value.weight": "pytorch_model_00006-of-00041.bin",
|
336 |
+
"transformer.h.4.self_attention.query.weight": "pytorch_model_00006-of-00041.bin",
|
337 |
+
"transformer.h.5.input_layernorm.weight": "pytorch_model_00007-of-00041.bin",
|
338 |
+
"transformer.h.5.mlp.down_proj.bias": "pytorch_model_00007-of-00041.bin",
|
339 |
+
"transformer.h.5.mlp.down_proj.weight": "pytorch_model_00007-of-00041.bin",
|
340 |
+
"transformer.h.5.mlp.gate_proj.weight": "pytorch_model_00007-of-00041.bin",
|
341 |
+
"transformer.h.5.mlp.up_proj.weight": "pytorch_model_00007-of-00041.bin",
|
342 |
+
"transformer.h.5.post_attention_layernorm.weight": "pytorch_model_00007-of-00041.bin",
|
343 |
+
"transformer.h.5.self_attention.dense.bias": "pytorch_model_00007-of-00041.bin",
|
344 |
+
"transformer.h.5.self_attention.dense.weight": "pytorch_model_00007-of-00041.bin",
|
345 |
+
"transformer.h.5.self_attention.key_value.weight": "pytorch_model_00007-of-00041.bin",
|
346 |
+
"transformer.h.5.self_attention.query.weight": "pytorch_model_00007-of-00041.bin",
|
347 |
+
"transformer.h.6.input_layernorm.weight": "pytorch_model_00008-of-00041.bin",
|
348 |
+
"transformer.h.6.mlp.down_proj.bias": "pytorch_model_00008-of-00041.bin",
|
349 |
+
"transformer.h.6.mlp.down_proj.weight": "pytorch_model_00008-of-00041.bin",
|
350 |
+
"transformer.h.6.mlp.gate_proj.weight": "pytorch_model_00008-of-00041.bin",
|
351 |
+
"transformer.h.6.mlp.up_proj.weight": "pytorch_model_00008-of-00041.bin",
|
352 |
+
"transformer.h.6.post_attention_layernorm.weight": "pytorch_model_00008-of-00041.bin",
|
353 |
+
"transformer.h.6.self_attention.dense.bias": "pytorch_model_00008-of-00041.bin",
|
354 |
+
"transformer.h.6.self_attention.dense.weight": "pytorch_model_00008-of-00041.bin",
|
355 |
+
"transformer.h.6.self_attention.key_value.weight": "pytorch_model_00008-of-00041.bin",
|
356 |
+
"transformer.h.6.self_attention.query.weight": "pytorch_model_00008-of-00041.bin",
|
357 |
+
"transformer.h.7.input_layernorm.weight": "pytorch_model_00009-of-00041.bin",
|
358 |
+
"transformer.h.7.mlp.down_proj.bias": "pytorch_model_00009-of-00041.bin",
|
359 |
+
"transformer.h.7.mlp.down_proj.weight": "pytorch_model_00009-of-00041.bin",
|
360 |
+
"transformer.h.7.mlp.gate_proj.weight": "pytorch_model_00009-of-00041.bin",
|
361 |
+
"transformer.h.7.mlp.up_proj.weight": "pytorch_model_00009-of-00041.bin",
|
362 |
+
"transformer.h.7.post_attention_layernorm.weight": "pytorch_model_00009-of-00041.bin",
|
363 |
+
"transformer.h.7.self_attention.dense.bias": "pytorch_model_00009-of-00041.bin",
|
364 |
+
"transformer.h.7.self_attention.dense.weight": "pytorch_model_00009-of-00041.bin",
|
365 |
+
"transformer.h.7.self_attention.key_value.weight": "pytorch_model_00009-of-00041.bin",
|
366 |
+
"transformer.h.7.self_attention.query.weight": "pytorch_model_00009-of-00041.bin",
|
367 |
+
"transformer.h.8.input_layernorm.weight": "pytorch_model_00010-of-00041.bin",
|
368 |
+
"transformer.h.8.mlp.down_proj.bias": "pytorch_model_00010-of-00041.bin",
|
369 |
+
"transformer.h.8.mlp.down_proj.weight": "pytorch_model_00010-of-00041.bin",
|
370 |
+
"transformer.h.8.mlp.gate_proj.weight": "pytorch_model_00010-of-00041.bin",
|
371 |
+
"transformer.h.8.mlp.up_proj.weight": "pytorch_model_00010-of-00041.bin",
|
372 |
+
"transformer.h.8.post_attention_layernorm.weight": "pytorch_model_00010-of-00041.bin",
|
373 |
+
"transformer.h.8.self_attention.dense.bias": "pytorch_model_00010-of-00041.bin",
|
374 |
+
"transformer.h.8.self_attention.dense.weight": "pytorch_model_00010-of-00041.bin",
|
375 |
+
"transformer.h.8.self_attention.key_value.weight": "pytorch_model_00010-of-00041.bin",
|
376 |
+
"transformer.h.8.self_attention.query.weight": "pytorch_model_00010-of-00041.bin",
|
377 |
+
"transformer.h.9.input_layernorm.weight": "pytorch_model_00011-of-00041.bin",
|
378 |
+
"transformer.h.9.mlp.down_proj.bias": "pytorch_model_00011-of-00041.bin",
|
379 |
+
"transformer.h.9.mlp.down_proj.weight": "pytorch_model_00011-of-00041.bin",
|
380 |
+
"transformer.h.9.mlp.gate_proj.weight": "pytorch_model_00011-of-00041.bin",
|
381 |
+
"transformer.h.9.mlp.up_proj.weight": "pytorch_model_00011-of-00041.bin",
|
382 |
+
"transformer.h.9.post_attention_layernorm.weight": "pytorch_model_00011-of-00041.bin",
|
383 |
+
"transformer.h.9.self_attention.dense.bias": "pytorch_model_00011-of-00041.bin",
|
384 |
+
"transformer.h.9.self_attention.dense.weight": "pytorch_model_00011-of-00041.bin",
|
385 |
+
"transformer.h.9.self_attention.key_value.weight": "pytorch_model_00011-of-00041.bin",
|
386 |
+
"transformer.h.9.self_attention.query.weight": "pytorch_model_00011-of-00041.bin",
|
387 |
+
"transformer.ln_f.weight": "pytorch_model_00040-of-00041.bin",
|
388 |
+
"transformer.word_embeddings.weight": "pytorch_model_00001-of-00041.bin"
|
389 |
+
}
|
390 |
+
}
|
pytorch_model_00001-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c148308ca227a489f66a78ff0bf20f2d8e7d71788053f9ff42a66cdea5ec4d96
|
3 |
+
size 1228800938
|
pytorch_model_00002-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:78fc4c9587301091a1b4a5829ab503983a3bddf86c240401f147e816dd1b0950
|
3 |
+
size 587247299
|
pytorch_model_00003-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:55e9cb22004c08412a5698fceadd0688503d8f9c9211086cdb615b5a95cc942a
|
3 |
+
size 587247299
|
pytorch_model_00004-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b964bc66417adf3818a465340f48ab4c7745a529c430bfb1001d8b73b0e0c23
|
3 |
+
size 587247299
|
pytorch_model_00005-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:37063c70f3d6290087100059bb65c5a0ac24bdd3b87d51af4ad0c92c95ba5a33
|
3 |
+
size 587247299
|
pytorch_model_00006-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7192602f0eb980cd09121f5286e5239813fefe258f28b6008cd5aef7809da7ea
|
3 |
+
size 587247299
|
pytorch_model_00007-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2b460550241cb703bb6c421007ab8290d647c480a79bd5baaaf2586a6e83aa3
|
3 |
+
size 587247299
|
pytorch_model_00008-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:848375aac881dd1de535104a93d9da1f64750dbf16869b0161b7fb5682e72880
|
3 |
+
size 587247299
|
pytorch_model_00009-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4ec942717245c30606894a82b45699e74b59fab4d32312ee28964d3fd463d9fb
|
3 |
+
size 587247299
|
pytorch_model_00010-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:783e4a80d409ee66da354d13f1734236682a347ad023b483780bd65faf909d65
|
3 |
+
size 587247299
|
pytorch_model_00011-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f30ee549fbdd11ddc4084462340c54b0dc7a17eb567fb503badedbd7cc7b141
|
3 |
+
size 587247299
|
pytorch_model_00012-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eca719d4aa297e419dd2661281e5a723ce9f15fe0eaf4a5ee2d5653f5b13b1d7
|
3 |
+
size 587247299
|
pytorch_model_00013-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f438ef24c898b0789cb3da4ec9fbe3bcfe2d8442c5de1eb748613961df5b1d10
|
3 |
+
size 587247299
|
pytorch_model_00014-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cfd2d1e9caf4c1568d74db5434dcf42d476637aeafc5ec4d191e89e417ba6205
|
3 |
+
size 587247299
|
pytorch_model_00015-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7901b1c3d01871095cfb80fdf7d0348feba61df6afe60127546a383003015489
|
3 |
+
size 587247299
|
pytorch_model_00016-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a3aea094e25127aa58ec5a6f385b50fc9a2035e43d66d341e61421c46fc5bb25
|
3 |
+
size 587247299
|
pytorch_model_00017-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ebbb60c4d4a9bb4cf495f24d3aad9ed60555492f395a257917695139fe33e478
|
3 |
+
size 587247299
|
pytorch_model_00018-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e3935bedb570a7806326647fb9a36a5f6efd036415503842c5257d32f65f161
|
3 |
+
size 587247299
|
pytorch_model_00019-of-00041.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:74cb06ce8b312ddd2be3f982bcb61ede009fab4123074fe79e699374b512df11
|
3 |
+
size 587247299
|