SunderAli17
commited on
Commit
•
76f72b1
1
Parent(s):
2f745da
Create configuration_chatglm.py
Browse files
text_encoder/configuration_chatglm.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import PretrainedConfig
|
2 |
+
|
3 |
+
|
4 |
+
class ChatGLMConfig(PretrainedConfig):
|
5 |
+
model_type = "chatglm"
|
6 |
+
def __init__(
|
7 |
+
self,
|
8 |
+
num_layers=28,
|
9 |
+
padded_vocab_size=65024,
|
10 |
+
hidden_size=4096,
|
11 |
+
ffn_hidden_size=13696,
|
12 |
+
kv_channels=128,
|
13 |
+
num_attention_heads=32,
|
14 |
+
seq_length=2048,
|
15 |
+
hidden_dropout=0.0,
|
16 |
+
classifier_dropout=None,
|
17 |
+
attention_dropout=0.0,
|
18 |
+
layernorm_epsilon=1e-5,
|
19 |
+
rmsnorm=True,
|
20 |
+
apply_residual_connection_post_layernorm=False,
|
21 |
+
post_layer_norm=True,
|
22 |
+
add_bias_linear=False,
|
23 |
+
add_qkv_bias=False,
|
24 |
+
bias_dropout_fusion=True,
|
25 |
+
multi_query_attention=False,
|
26 |
+
multi_query_group_num=1,
|
27 |
+
apply_query_key_layer_scaling=True,
|
28 |
+
attention_softmax_in_fp32=True,
|
29 |
+
fp32_residual_connection=False,
|
30 |
+
quantization_bit=0,
|
31 |
+
pre_seq_len=None,
|
32 |
+
prefix_projection=False,
|
33 |
+
**kwargs
|
34 |
+
):
|
35 |
+
self.num_layers = num_layers
|
36 |
+
self.vocab_size = padded_vocab_size
|
37 |
+
self.padded_vocab_size = padded_vocab_size
|
38 |
+
self.hidden_size = hidden_size
|
39 |
+
self.ffn_hidden_size = ffn_hidden_size
|
40 |
+
self.kv_channels = kv_channels
|
41 |
+
self.num_attention_heads = num_attention_heads
|
42 |
+
self.seq_length = seq_length
|
43 |
+
self.hidden_dropout = hidden_dropout
|
44 |
+
self.classifier_dropout = classifier_dropout
|
45 |
+
self.attention_dropout = attention_dropout
|
46 |
+
self.layernorm_epsilon = layernorm_epsilon
|
47 |
+
self.rmsnorm = rmsnorm
|
48 |
+
self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm
|
49 |
+
self.post_layer_norm = post_layer_norm
|
50 |
+
self.add_bias_linear = add_bias_linear
|
51 |
+
self.add_qkv_bias = add_qkv_bias
|
52 |
+
self.bias_dropout_fusion = bias_dropout_fusion
|
53 |
+
self.multi_query_attention = multi_query_attention
|
54 |
+
self.multi_query_group_num = multi_query_group_num
|
55 |
+
self.apply_query_key_layer_scaling = apply_query_key_layer_scaling
|
56 |
+
self.attention_softmax_in_fp32 = attention_softmax_in_fp32
|
57 |
+
self.fp32_residual_connection = fp32_residual_connection
|
58 |
+
self.quantization_bit = quantization_bit
|
59 |
+
self.pre_seq_len = pre_seq_len
|
60 |
+
self.prefix_projection = prefix_projection
|
61 |
+
super().__init__(**kwargs)
|