Add file
Browse files- config.json +47 -0
- configuration_chatglm.py +61 -0
config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/public1/home/amzhou/lwt/model/Echo",
|
| 3 |
+
"add_bias_linear": false,
|
| 4 |
+
"add_qkv_bias": true,
|
| 5 |
+
"apply_query_key_layer_scaling": true,
|
| 6 |
+
"apply_residual_connection_post_layernorm": false,
|
| 7 |
+
"architectures": [
|
| 8 |
+
"ChatGLMForConditionalGeneration"
|
| 9 |
+
],
|
| 10 |
+
"attention_dropout": 0.0,
|
| 11 |
+
"attention_softmax_in_fp32": true,
|
| 12 |
+
"auto_map": {
|
| 13 |
+
"AutoConfig": "configuration_chatglm.ChatGLMConfig",
|
| 14 |
+
"AutoModel": "modeling_chatglm.ChatGLMForConditionalGeneration",
|
| 15 |
+
"AutoModelForCausalLM": "modeling_chatglm.ChatGLMForConditionalGeneration",
|
| 16 |
+
"AutoModelForSeq2SeqLM": "modeling_chatglm.ChatGLMForConditionalGeneration",
|
| 17 |
+
"AutoModelForSequenceClassification": "modeling_chatglm.ChatGLMForSequenceClassification"
|
| 18 |
+
},
|
| 19 |
+
"bias_dropout_fusion": true,
|
| 20 |
+
"classifier_dropout": null,
|
| 21 |
+
"eos_token_id": 2,
|
| 22 |
+
"ffn_hidden_size": 13696,
|
| 23 |
+
"fp32_residual_connection": false,
|
| 24 |
+
"hidden_dropout": 0.0,
|
| 25 |
+
"hidden_size": 4096,
|
| 26 |
+
"kv_channels": 128,
|
| 27 |
+
"layernorm_epsilon": 1e-05,
|
| 28 |
+
"model_type": "chatglm",
|
| 29 |
+
"multi_query_attention": true,
|
| 30 |
+
"multi_query_group_num": 2,
|
| 31 |
+
"num_attention_heads": 32,
|
| 32 |
+
"num_layers": 28,
|
| 33 |
+
"original_rope": true,
|
| 34 |
+
"pad_token_id": 0,
|
| 35 |
+
"padded_vocab_size": 65024,
|
| 36 |
+
"post_layer_norm": true,
|
| 37 |
+
"pre_seq_len": null,
|
| 38 |
+
"prefix_projection": false,
|
| 39 |
+
"quantization_bit": 0,
|
| 40 |
+
"rmsnorm": true,
|
| 41 |
+
"seq_length": 8192,
|
| 42 |
+
"tie_word_embeddings": false,
|
| 43 |
+
"torch_dtype": "float16",
|
| 44 |
+
"transformers_version": "4.30.2",
|
| 45 |
+
"use_cache": true,
|
| 46 |
+
"vocab_size": 65024
|
| 47 |
+
}
|
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)
|