update
Browse files- .gitattributes +7 -0
- model-00001-of-00007.safetensors +3 -0
- model-00002-of-00007.safetensors +3 -0
- model-00003-of-00007.safetensors +3 -0
- model-00004-of-00007.safetensors +3 -0
- model-00005-of-00007.safetensors +3 -0
- model-00006-of-00007.safetensors +3 -0
- model-00007-of-00007.safetensors +3 -0
- model.safetensors.index.json +207 -0
- modeling_chatglm.py +8 -4
- tokenization_chatglm.py +49 -21
- tokenizer_config.json +8 -0
.gitattributes
CHANGED
@@ -41,3 +41,10 @@ pytorch_model-00002-of-00007.bin filter=lfs diff=lfs merge=lfs -text
|
|
41 |
pytorch_model-00003-of-00007.bin filter=lfs diff=lfs merge=lfs -text
|
42 |
pytorch_model-00004-of-00007.bin filter=lfs diff=lfs merge=lfs -text
|
43 |
tokenizer.model filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
pytorch_model-00003-of-00007.bin filter=lfs diff=lfs merge=lfs -text
|
42 |
pytorch_model-00004-of-00007.bin filter=lfs diff=lfs merge=lfs -text
|
43 |
tokenizer.model filter=lfs diff=lfs merge=lfs -text
|
44 |
+
model-00004-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
45 |
+
model-00005-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
46 |
+
model-00006-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
47 |
+
model-00007-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
48 |
+
model-00001-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
49 |
+
model-00002-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
50 |
+
model-00003-of-00007.safetensors filter=lfs diff=lfs merge=lfs -text
|
model-00001-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b1052386eac358a18add3d0f92521c85ab338979da8eeb08a6499555b857f80d
|
3 |
+
size 1827774160
|
model-00002-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f88d7f69a3940711b87308eb20dd0544df22aff81134fa0d5160d3c859f5d321
|
3 |
+
size 1968291888
|
model-00003-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:447d41b7c5e7b2558905c98733469aa9e132540c91e13c4cdd7bfc58b60cc650
|
3 |
+
size 1927406936
|
model-00004-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:386305288e2bcc4a26fcffef433c94592d155bf36e365f054f63d3e6b55a1429
|
3 |
+
size 1815217640
|
model-00005-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c304e2821774d649997d1f5ae5fa12afd4d1dc5fea2bf6e8b829405b81fa7f2
|
3 |
+
size 1968291920
|
model-00006-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ef45bbd33d6d540d3d3523bb169b52b91b9e265176ab7efc6838233bc3b7e95d
|
3 |
+
size 1927406960
|
model-00007-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6eb545c6aa8a839c56a78b80331fcb4fa403341925f79fb6a761e2e847bf1e40
|
3 |
+
size 1052805400
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 12487168064
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"transformer.embedding.word_embeddings.weight": "model-00001-of-00007.safetensors",
|
7 |
+
"transformer.encoder.final_layernorm.weight": "model-00007-of-00007.safetensors",
|
8 |
+
"transformer.encoder.layers.0.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
9 |
+
"transformer.encoder.layers.0.mlp.dense_4h_to_h.weight": "model-00001-of-00007.safetensors",
|
10 |
+
"transformer.encoder.layers.0.mlp.dense_h_to_4h.weight": "model-00001-of-00007.safetensors",
|
11 |
+
"transformer.encoder.layers.0.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
12 |
+
"transformer.encoder.layers.0.self_attention.dense.weight": "model-00001-of-00007.safetensors",
|
13 |
+
"transformer.encoder.layers.0.self_attention.query_key_value.bias": "model-00001-of-00007.safetensors",
|
14 |
+
"transformer.encoder.layers.0.self_attention.query_key_value.weight": "model-00001-of-00007.safetensors",
|
15 |
+
"transformer.encoder.layers.1.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
16 |
+
"transformer.encoder.layers.1.mlp.dense_4h_to_h.weight": "model-00001-of-00007.safetensors",
|
17 |
+
"transformer.encoder.layers.1.mlp.dense_h_to_4h.weight": "model-00001-of-00007.safetensors",
|
18 |
+
"transformer.encoder.layers.1.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
19 |
+
"transformer.encoder.layers.1.self_attention.dense.weight": "model-00001-of-00007.safetensors",
|
20 |
+
"transformer.encoder.layers.1.self_attention.query_key_value.bias": "model-00001-of-00007.safetensors",
|
21 |
+
"transformer.encoder.layers.1.self_attention.query_key_value.weight": "model-00001-of-00007.safetensors",
|
22 |
+
"transformer.encoder.layers.10.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
23 |
+
"transformer.encoder.layers.10.mlp.dense_4h_to_h.weight": "model-00003-of-00007.safetensors",
|
24 |
+
"transformer.encoder.layers.10.mlp.dense_h_to_4h.weight": "model-00003-of-00007.safetensors",
|
25 |
+
"transformer.encoder.layers.10.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
26 |
+
"transformer.encoder.layers.10.self_attention.dense.weight": "model-00003-of-00007.safetensors",
|
27 |
+
"transformer.encoder.layers.10.self_attention.query_key_value.bias": "model-00003-of-00007.safetensors",
|
28 |
+
"transformer.encoder.layers.10.self_attention.query_key_value.weight": "model-00003-of-00007.safetensors",
|
29 |
+
"transformer.encoder.layers.11.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
30 |
+
"transformer.encoder.layers.11.mlp.dense_4h_to_h.weight": "model-00003-of-00007.safetensors",
|
31 |
+
"transformer.encoder.layers.11.mlp.dense_h_to_4h.weight": "model-00003-of-00007.safetensors",
|
32 |
+
"transformer.encoder.layers.11.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
33 |
+
"transformer.encoder.layers.11.self_attention.dense.weight": "model-00003-of-00007.safetensors",
|
34 |
+
"transformer.encoder.layers.11.self_attention.query_key_value.bias": "model-00003-of-00007.safetensors",
|
35 |
+
"transformer.encoder.layers.11.self_attention.query_key_value.weight": "model-00003-of-00007.safetensors",
|
36 |
+
"transformer.encoder.layers.12.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
37 |
+
"transformer.encoder.layers.12.mlp.dense_4h_to_h.weight": "model-00004-of-00007.safetensors",
|
38 |
+
"transformer.encoder.layers.12.mlp.dense_h_to_4h.weight": "model-00003-of-00007.safetensors",
|
39 |
+
"transformer.encoder.layers.12.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
40 |
+
"transformer.encoder.layers.12.self_attention.dense.weight": "model-00003-of-00007.safetensors",
|
41 |
+
"transformer.encoder.layers.12.self_attention.query_key_value.bias": "model-00003-of-00007.safetensors",
|
42 |
+
"transformer.encoder.layers.12.self_attention.query_key_value.weight": "model-00003-of-00007.safetensors",
|
43 |
+
"transformer.encoder.layers.13.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
44 |
+
"transformer.encoder.layers.13.mlp.dense_4h_to_h.weight": "model-00004-of-00007.safetensors",
|
45 |
+
"transformer.encoder.layers.13.mlp.dense_h_to_4h.weight": "model-00004-of-00007.safetensors",
|
46 |
+
"transformer.encoder.layers.13.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
47 |
+
"transformer.encoder.layers.13.self_attention.dense.weight": "model-00004-of-00007.safetensors",
|
48 |
+
"transformer.encoder.layers.13.self_attention.query_key_value.bias": "model-00004-of-00007.safetensors",
|
49 |
+
"transformer.encoder.layers.13.self_attention.query_key_value.weight": "model-00004-of-00007.safetensors",
|
50 |
+
"transformer.encoder.layers.14.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
51 |
+
"transformer.encoder.layers.14.mlp.dense_4h_to_h.weight": "model-00004-of-00007.safetensors",
|
52 |
+
"transformer.encoder.layers.14.mlp.dense_h_to_4h.weight": "model-00004-of-00007.safetensors",
|
53 |
+
"transformer.encoder.layers.14.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
54 |
+
"transformer.encoder.layers.14.self_attention.dense.weight": "model-00004-of-00007.safetensors",
|
55 |
+
"transformer.encoder.layers.14.self_attention.query_key_value.bias": "model-00004-of-00007.safetensors",
|
56 |
+
"transformer.encoder.layers.14.self_attention.query_key_value.weight": "model-00004-of-00007.safetensors",
|
57 |
+
"transformer.encoder.layers.15.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
58 |
+
"transformer.encoder.layers.15.mlp.dense_4h_to_h.weight": "model-00004-of-00007.safetensors",
|
59 |
+
"transformer.encoder.layers.15.mlp.dense_h_to_4h.weight": "model-00004-of-00007.safetensors",
|
60 |
+
"transformer.encoder.layers.15.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
61 |
+
"transformer.encoder.layers.15.self_attention.dense.weight": "model-00004-of-00007.safetensors",
|
62 |
+
"transformer.encoder.layers.15.self_attention.query_key_value.bias": "model-00004-of-00007.safetensors",
|
63 |
+
"transformer.encoder.layers.15.self_attention.query_key_value.weight": "model-00004-of-00007.safetensors",
|
64 |
+
"transformer.encoder.layers.16.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
65 |
+
"transformer.encoder.layers.16.mlp.dense_4h_to_h.weight": "model-00004-of-00007.safetensors",
|
66 |
+
"transformer.encoder.layers.16.mlp.dense_h_to_4h.weight": "model-00004-of-00007.safetensors",
|
67 |
+
"transformer.encoder.layers.16.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
68 |
+
"transformer.encoder.layers.16.self_attention.dense.weight": "model-00004-of-00007.safetensors",
|
69 |
+
"transformer.encoder.layers.16.self_attention.query_key_value.bias": "model-00004-of-00007.safetensors",
|
70 |
+
"transformer.encoder.layers.16.self_attention.query_key_value.weight": "model-00004-of-00007.safetensors",
|
71 |
+
"transformer.encoder.layers.17.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
72 |
+
"transformer.encoder.layers.17.mlp.dense_4h_to_h.weight": "model-00005-of-00007.safetensors",
|
73 |
+
"transformer.encoder.layers.17.mlp.dense_h_to_4h.weight": "model-00005-of-00007.safetensors",
|
74 |
+
"transformer.encoder.layers.17.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
75 |
+
"transformer.encoder.layers.17.self_attention.dense.weight": "model-00004-of-00007.safetensors",
|
76 |
+
"transformer.encoder.layers.17.self_attention.query_key_value.bias": "model-00004-of-00007.safetensors",
|
77 |
+
"transformer.encoder.layers.17.self_attention.query_key_value.weight": "model-00004-of-00007.safetensors",
|
78 |
+
"transformer.encoder.layers.18.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
79 |
+
"transformer.encoder.layers.18.mlp.dense_4h_to_h.weight": "model-00005-of-00007.safetensors",
|
80 |
+
"transformer.encoder.layers.18.mlp.dense_h_to_4h.weight": "model-00005-of-00007.safetensors",
|
81 |
+
"transformer.encoder.layers.18.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
82 |
+
"transformer.encoder.layers.18.self_attention.dense.weight": "model-00005-of-00007.safetensors",
|
83 |
+
"transformer.encoder.layers.18.self_attention.query_key_value.bias": "model-00005-of-00007.safetensors",
|
84 |
+
"transformer.encoder.layers.18.self_attention.query_key_value.weight": "model-00005-of-00007.safetensors",
|
85 |
+
"transformer.encoder.layers.19.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
86 |
+
"transformer.encoder.layers.19.mlp.dense_4h_to_h.weight": "model-00005-of-00007.safetensors",
|
87 |
+
"transformer.encoder.layers.19.mlp.dense_h_to_4h.weight": "model-00005-of-00007.safetensors",
|
88 |
+
"transformer.encoder.layers.19.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
89 |
+
"transformer.encoder.layers.19.self_attention.dense.weight": "model-00005-of-00007.safetensors",
|
90 |
+
"transformer.encoder.layers.19.self_attention.query_key_value.bias": "model-00005-of-00007.safetensors",
|
91 |
+
"transformer.encoder.layers.19.self_attention.query_key_value.weight": "model-00005-of-00007.safetensors",
|
92 |
+
"transformer.encoder.layers.2.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
93 |
+
"transformer.encoder.layers.2.mlp.dense_4h_to_h.weight": "model-00001-of-00007.safetensors",
|
94 |
+
"transformer.encoder.layers.2.mlp.dense_h_to_4h.weight": "model-00001-of-00007.safetensors",
|
95 |
+
"transformer.encoder.layers.2.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
96 |
+
"transformer.encoder.layers.2.self_attention.dense.weight": "model-00001-of-00007.safetensors",
|
97 |
+
"transformer.encoder.layers.2.self_attention.query_key_value.bias": "model-00001-of-00007.safetensors",
|
98 |
+
"transformer.encoder.layers.2.self_attention.query_key_value.weight": "model-00001-of-00007.safetensors",
|
99 |
+
"transformer.encoder.layers.20.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
100 |
+
"transformer.encoder.layers.20.mlp.dense_4h_to_h.weight": "model-00005-of-00007.safetensors",
|
101 |
+
"transformer.encoder.layers.20.mlp.dense_h_to_4h.weight": "model-00005-of-00007.safetensors",
|
102 |
+
"transformer.encoder.layers.20.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
103 |
+
"transformer.encoder.layers.20.self_attention.dense.weight": "model-00005-of-00007.safetensors",
|
104 |
+
"transformer.encoder.layers.20.self_attention.query_key_value.bias": "model-00005-of-00007.safetensors",
|
105 |
+
"transformer.encoder.layers.20.self_attention.query_key_value.weight": "model-00005-of-00007.safetensors",
|
106 |
+
"transformer.encoder.layers.21.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
107 |
+
"transformer.encoder.layers.21.mlp.dense_4h_to_h.weight": "model-00005-of-00007.safetensors",
|
108 |
+
"transformer.encoder.layers.21.mlp.dense_h_to_4h.weight": "model-00005-of-00007.safetensors",
|
109 |
+
"transformer.encoder.layers.21.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
110 |
+
"transformer.encoder.layers.21.self_attention.dense.weight": "model-00005-of-00007.safetensors",
|
111 |
+
"transformer.encoder.layers.21.self_attention.query_key_value.bias": "model-00005-of-00007.safetensors",
|
112 |
+
"transformer.encoder.layers.21.self_attention.query_key_value.weight": "model-00005-of-00007.safetensors",
|
113 |
+
"transformer.encoder.layers.22.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
114 |
+
"transformer.encoder.layers.22.mlp.dense_4h_to_h.weight": "model-00006-of-00007.safetensors",
|
115 |
+
"transformer.encoder.layers.22.mlp.dense_h_to_4h.weight": "model-00006-of-00007.safetensors",
|
116 |
+
"transformer.encoder.layers.22.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
117 |
+
"transformer.encoder.layers.22.self_attention.dense.weight": "model-00006-of-00007.safetensors",
|
118 |
+
"transformer.encoder.layers.22.self_attention.query_key_value.bias": "model-00006-of-00007.safetensors",
|
119 |
+
"transformer.encoder.layers.22.self_attention.query_key_value.weight": "model-00006-of-00007.safetensors",
|
120 |
+
"transformer.encoder.layers.23.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
121 |
+
"transformer.encoder.layers.23.mlp.dense_4h_to_h.weight": "model-00006-of-00007.safetensors",
|
122 |
+
"transformer.encoder.layers.23.mlp.dense_h_to_4h.weight": "model-00006-of-00007.safetensors",
|
123 |
+
"transformer.encoder.layers.23.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
124 |
+
"transformer.encoder.layers.23.self_attention.dense.weight": "model-00006-of-00007.safetensors",
|
125 |
+
"transformer.encoder.layers.23.self_attention.query_key_value.bias": "model-00006-of-00007.safetensors",
|
126 |
+
"transformer.encoder.layers.23.self_attention.query_key_value.weight": "model-00006-of-00007.safetensors",
|
127 |
+
"transformer.encoder.layers.24.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
128 |
+
"transformer.encoder.layers.24.mlp.dense_4h_to_h.weight": "model-00006-of-00007.safetensors",
|
129 |
+
"transformer.encoder.layers.24.mlp.dense_h_to_4h.weight": "model-00006-of-00007.safetensors",
|
130 |
+
"transformer.encoder.layers.24.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
131 |
+
"transformer.encoder.layers.24.self_attention.dense.weight": "model-00006-of-00007.safetensors",
|
132 |
+
"transformer.encoder.layers.24.self_attention.query_key_value.bias": "model-00006-of-00007.safetensors",
|
133 |
+
"transformer.encoder.layers.24.self_attention.query_key_value.weight": "model-00006-of-00007.safetensors",
|
134 |
+
"transformer.encoder.layers.25.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
135 |
+
"transformer.encoder.layers.25.mlp.dense_4h_to_h.weight": "model-00006-of-00007.safetensors",
|
136 |
+
"transformer.encoder.layers.25.mlp.dense_h_to_4h.weight": "model-00006-of-00007.safetensors",
|
137 |
+
"transformer.encoder.layers.25.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
138 |
+
"transformer.encoder.layers.25.self_attention.dense.weight": "model-00006-of-00007.safetensors",
|
139 |
+
"transformer.encoder.layers.25.self_attention.query_key_value.bias": "model-00006-of-00007.safetensors",
|
140 |
+
"transformer.encoder.layers.25.self_attention.query_key_value.weight": "model-00006-of-00007.safetensors",
|
141 |
+
"transformer.encoder.layers.26.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
142 |
+
"transformer.encoder.layers.26.mlp.dense_4h_to_h.weight": "model-00007-of-00007.safetensors",
|
143 |
+
"transformer.encoder.layers.26.mlp.dense_h_to_4h.weight": "model-00006-of-00007.safetensors",
|
144 |
+
"transformer.encoder.layers.26.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
145 |
+
"transformer.encoder.layers.26.self_attention.dense.weight": "model-00006-of-00007.safetensors",
|
146 |
+
"transformer.encoder.layers.26.self_attention.query_key_value.bias": "model-00006-of-00007.safetensors",
|
147 |
+
"transformer.encoder.layers.26.self_attention.query_key_value.weight": "model-00006-of-00007.safetensors",
|
148 |
+
"transformer.encoder.layers.27.input_layernorm.weight": "model-00007-of-00007.safetensors",
|
149 |
+
"transformer.encoder.layers.27.mlp.dense_4h_to_h.weight": "model-00007-of-00007.safetensors",
|
150 |
+
"transformer.encoder.layers.27.mlp.dense_h_to_4h.weight": "model-00007-of-00007.safetensors",
|
151 |
+
"transformer.encoder.layers.27.post_attention_layernorm.weight": "model-00007-of-00007.safetensors",
|
152 |
+
"transformer.encoder.layers.27.self_attention.dense.weight": "model-00007-of-00007.safetensors",
|
153 |
+
"transformer.encoder.layers.27.self_attention.query_key_value.bias": "model-00007-of-00007.safetensors",
|
154 |
+
"transformer.encoder.layers.27.self_attention.query_key_value.weight": "model-00007-of-00007.safetensors",
|
155 |
+
"transformer.encoder.layers.3.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
156 |
+
"transformer.encoder.layers.3.mlp.dense_4h_to_h.weight": "model-00002-of-00007.safetensors",
|
157 |
+
"transformer.encoder.layers.3.mlp.dense_h_to_4h.weight": "model-00002-of-00007.safetensors",
|
158 |
+
"transformer.encoder.layers.3.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
159 |
+
"transformer.encoder.layers.3.self_attention.dense.weight": "model-00001-of-00007.safetensors",
|
160 |
+
"transformer.encoder.layers.3.self_attention.query_key_value.bias": "model-00001-of-00007.safetensors",
|
161 |
+
"transformer.encoder.layers.3.self_attention.query_key_value.weight": "model-00001-of-00007.safetensors",
|
162 |
+
"transformer.encoder.layers.4.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
163 |
+
"transformer.encoder.layers.4.mlp.dense_4h_to_h.weight": "model-00002-of-00007.safetensors",
|
164 |
+
"transformer.encoder.layers.4.mlp.dense_h_to_4h.weight": "model-00002-of-00007.safetensors",
|
165 |
+
"transformer.encoder.layers.4.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
166 |
+
"transformer.encoder.layers.4.self_attention.dense.weight": "model-00002-of-00007.safetensors",
|
167 |
+
"transformer.encoder.layers.4.self_attention.query_key_value.bias": "model-00002-of-00007.safetensors",
|
168 |
+
"transformer.encoder.layers.4.self_attention.query_key_value.weight": "model-00002-of-00007.safetensors",
|
169 |
+
"transformer.encoder.layers.5.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
170 |
+
"transformer.encoder.layers.5.mlp.dense_4h_to_h.weight": "model-00002-of-00007.safetensors",
|
171 |
+
"transformer.encoder.layers.5.mlp.dense_h_to_4h.weight": "model-00002-of-00007.safetensors",
|
172 |
+
"transformer.encoder.layers.5.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
173 |
+
"transformer.encoder.layers.5.self_attention.dense.weight": "model-00002-of-00007.safetensors",
|
174 |
+
"transformer.encoder.layers.5.self_attention.query_key_value.bias": "model-00002-of-00007.safetensors",
|
175 |
+
"transformer.encoder.layers.5.self_attention.query_key_value.weight": "model-00002-of-00007.safetensors",
|
176 |
+
"transformer.encoder.layers.6.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
177 |
+
"transformer.encoder.layers.6.mlp.dense_4h_to_h.weight": "model-00002-of-00007.safetensors",
|
178 |
+
"transformer.encoder.layers.6.mlp.dense_h_to_4h.weight": "model-00002-of-00007.safetensors",
|
179 |
+
"transformer.encoder.layers.6.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
180 |
+
"transformer.encoder.layers.6.self_attention.dense.weight": "model-00002-of-00007.safetensors",
|
181 |
+
"transformer.encoder.layers.6.self_attention.query_key_value.bias": "model-00002-of-00007.safetensors",
|
182 |
+
"transformer.encoder.layers.6.self_attention.query_key_value.weight": "model-00002-of-00007.safetensors",
|
183 |
+
"transformer.encoder.layers.7.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
184 |
+
"transformer.encoder.layers.7.mlp.dense_4h_to_h.weight": "model-00002-of-00007.safetensors",
|
185 |
+
"transformer.encoder.layers.7.mlp.dense_h_to_4h.weight": "model-00002-of-00007.safetensors",
|
186 |
+
"transformer.encoder.layers.7.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
187 |
+
"transformer.encoder.layers.7.self_attention.dense.weight": "model-00002-of-00007.safetensors",
|
188 |
+
"transformer.encoder.layers.7.self_attention.query_key_value.bias": "model-00002-of-00007.safetensors",
|
189 |
+
"transformer.encoder.layers.7.self_attention.query_key_value.weight": "model-00002-of-00007.safetensors",
|
190 |
+
"transformer.encoder.layers.8.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
191 |
+
"transformer.encoder.layers.8.mlp.dense_4h_to_h.weight": "model-00003-of-00007.safetensors",
|
192 |
+
"transformer.encoder.layers.8.mlp.dense_h_to_4h.weight": "model-00003-of-00007.safetensors",
|
193 |
+
"transformer.encoder.layers.8.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
194 |
+
"transformer.encoder.layers.8.self_attention.dense.weight": "model-00003-of-00007.safetensors",
|
195 |
+
"transformer.encoder.layers.8.self_attention.query_key_value.bias": "model-00003-of-00007.safetensors",
|
196 |
+
"transformer.encoder.layers.8.self_attention.query_key_value.weight": "model-00003-of-00007.safetensors",
|
197 |
+
"transformer.encoder.layers.9.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
198 |
+
"transformer.encoder.layers.9.mlp.dense_4h_to_h.weight": "model-00003-of-00007.safetensors",
|
199 |
+
"transformer.encoder.layers.9.mlp.dense_h_to_4h.weight": "model-00003-of-00007.safetensors",
|
200 |
+
"transformer.encoder.layers.9.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
201 |
+
"transformer.encoder.layers.9.self_attention.dense.weight": "model-00003-of-00007.safetensors",
|
202 |
+
"transformer.encoder.layers.9.self_attention.query_key_value.bias": "model-00003-of-00007.safetensors",
|
203 |
+
"transformer.encoder.layers.9.self_attention.query_key_value.weight": "model-00003-of-00007.safetensors",
|
204 |
+
"transformer.output_layer.weight": "model-00007-of-00007.safetensors",
|
205 |
+
"transformer.rotary_pos_emb.inv_freq": "model-00001-of-00007.safetensors"
|
206 |
+
}
|
207 |
+
}
|
modeling_chatglm.py
CHANGED
@@ -634,7 +634,8 @@ class GLMTransformer(torch.nn.Module):
|
|
634 |
attention_mask,
|
635 |
rotary_pos_emb,
|
636 |
kv_caches[index],
|
637 |
-
use_cache
|
|
|
638 |
)
|
639 |
else:
|
640 |
layer_ret = layer(
|
@@ -697,9 +698,9 @@ class ChatGLMPreTrainedModel(PreTrainedModel):
|
|
697 |
position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)
|
698 |
return position_ids
|
699 |
|
700 |
-
def
|
701 |
-
if
|
702 |
-
|
703 |
|
704 |
|
705 |
class Embedding(torch.nn.Module):
|
@@ -768,6 +769,9 @@ class ChatGLMModel(ChatGLMPreTrainedModel):
|
|
768 |
def get_input_embeddings(self):
|
769 |
return self.embedding.word_embeddings
|
770 |
|
|
|
|
|
|
|
771 |
def get_prompt(self, batch_size, device, dtype=torch.half):
|
772 |
prefix_tokens = self.prefix_tokens.unsqueeze(0).expand(batch_size, -1).to(device)
|
773 |
past_key_values = self.prefix_encoder(prefix_tokens).type(dtype)
|
|
|
634 |
attention_mask,
|
635 |
rotary_pos_emb,
|
636 |
kv_caches[index],
|
637 |
+
use_cache,
|
638 |
+
use_reentrant=False
|
639 |
)
|
640 |
else:
|
641 |
layer_ret = layer(
|
|
|
698 |
position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)
|
699 |
return position_ids
|
700 |
|
701 |
+
def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs=None):
|
702 |
+
if not self.supports_gradient_checkpointing:
|
703 |
+
raise ValueError(f"{self.__class__.__name__} does not support gradient checkpointing.")
|
704 |
|
705 |
|
706 |
class Embedding(torch.nn.Module):
|
|
|
769 |
def get_input_embeddings(self):
|
770 |
return self.embedding.word_embeddings
|
771 |
|
772 |
+
def set_input_embeddings(self, value):
|
773 |
+
self.embedding.word_embeddings = value
|
774 |
+
|
775 |
def get_prompt(self, batch_size, device, dtype=torch.half):
|
776 |
prefix_tokens = self.prefix_tokens.unsqueeze(0).expand(batch_size, -1).to(device)
|
777 |
past_key_values = self.prefix_encoder(prefix_tokens).type(dtype)
|
tokenization_chatglm.py
CHANGED
@@ -8,6 +8,9 @@ from transformers.utils import logging, PaddingStrategy
|
|
8 |
from transformers.tokenization_utils_base import EncodedInput, BatchEncoding
|
9 |
|
10 |
|
|
|
|
|
|
|
11 |
class SPTokenizer:
|
12 |
def __init__(self, model_path: str):
|
13 |
# reload tokenizer
|
@@ -29,7 +32,7 @@ class SPTokenizer:
|
|
29 |
self.special_tokens[token] = self.n_words
|
30 |
self.index_special_tokens[self.n_words] = token
|
31 |
self.n_words += 1
|
32 |
-
self.role_special_token_expression = "|".join([re.escape(token) for token in
|
33 |
|
34 |
def tokenize(self, s: str, encode_special_tokens=False):
|
35 |
if encode_special_tokens:
|
@@ -89,25 +92,34 @@ class SPTokenizer:
|
|
89 |
|
90 |
|
91 |
class ChatGLMTokenizer(PreTrainedTokenizer):
|
92 |
-
vocab_files_names = {"vocab_file": "tokenizer.model"}
|
93 |
|
|
|
94 |
model_input_names = ["input_ids", "attention_mask", "position_ids"]
|
95 |
|
96 |
-
def __init__(
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
self.name = "GLMTokenizer"
|
99 |
-
|
100 |
self.vocab_file = vocab_file
|
101 |
self.tokenizer = SPTokenizer(vocab_file)
|
102 |
self.special_tokens = {
|
103 |
"<bos>": self.tokenizer.bos_id,
|
104 |
"<eos>": self.tokenizer.eos_id,
|
|
|
105 |
"<pad>": self.tokenizer.pad_id
|
106 |
}
|
107 |
self.encode_special_tokens = encode_special_tokens
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
111 |
|
112 |
def get_command(self, token):
|
113 |
if token in self.special_tokens:
|
@@ -117,24 +129,40 @@ class ChatGLMTokenizer(PreTrainedTokenizer):
|
|
117 |
|
118 |
@property
|
119 |
def unk_token(self) -> str:
|
120 |
-
return "<unk>"
|
121 |
|
122 |
@property
|
123 |
def pad_token(self) -> str:
|
124 |
-
return "<
|
125 |
|
126 |
@property
|
127 |
-
def
|
128 |
-
return self.get_command("<
|
129 |
|
130 |
@property
|
131 |
-
def
|
132 |
-
return "
|
|
|
|
|
|
|
|
|
133 |
|
134 |
@property
|
135 |
def eos_token_id(self):
|
136 |
return self.get_command("<eos>")
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
@property
|
139 |
def vocab_size(self):
|
140 |
return self.tokenizer.n_words
|
@@ -212,7 +240,7 @@ class ChatGLMTokenizer(PreTrainedTokenizer):
|
|
212 |
return self.batch_encode_plus([input_ids], return_tensors="pt", is_split_into_words=True)
|
213 |
|
214 |
def build_inputs_with_special_tokens(
|
215 |
-
|
216 |
) -> List[int]:
|
217 |
"""
|
218 |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
|
@@ -237,12 +265,12 @@ class ChatGLMTokenizer(PreTrainedTokenizer):
|
|
237 |
return token_ids_0
|
238 |
|
239 |
def _pad(
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
) -> dict:
|
247 |
"""
|
248 |
Pad encoded inputs (on left/right and up to predefined length or max length in the batch)
|
|
|
8 |
from transformers.tokenization_utils_base import EncodedInput, BatchEncoding
|
9 |
|
10 |
|
11 |
+
logger = logging.get_logger(__name__)
|
12 |
+
|
13 |
+
|
14 |
class SPTokenizer:
|
15 |
def __init__(self, model_path: str):
|
16 |
# reload tokenizer
|
|
|
32 |
self.special_tokens[token] = self.n_words
|
33 |
self.index_special_tokens[self.n_words] = token
|
34 |
self.n_words += 1
|
35 |
+
self.role_special_token_expression = "|".join([re.escape(token) for token in special_tokens]) # for apply_chat_template
|
36 |
|
37 |
def tokenize(self, s: str, encode_special_tokens=False):
|
38 |
if encode_special_tokens:
|
|
|
92 |
|
93 |
|
94 |
class ChatGLMTokenizer(PreTrainedTokenizer):
|
|
|
95 |
|
96 |
+
vocab_files_names = {"vocab_file": "tokenizer.model"}
|
97 |
model_input_names = ["input_ids", "attention_mask", "position_ids"]
|
98 |
|
99 |
+
def __init__(
|
100 |
+
self,
|
101 |
+
vocab_file,
|
102 |
+
padding_side="left",
|
103 |
+
clean_up_tokenization_spaces=False,
|
104 |
+
encode_special_tokens=False,
|
105 |
+
**kwargs
|
106 |
+
):
|
107 |
self.name = "GLMTokenizer"
|
|
|
108 |
self.vocab_file = vocab_file
|
109 |
self.tokenizer = SPTokenizer(vocab_file)
|
110 |
self.special_tokens = {
|
111 |
"<bos>": self.tokenizer.bos_id,
|
112 |
"<eos>": self.tokenizer.eos_id,
|
113 |
+
"<unk>": self.tokenizer.pad_id,
|
114 |
"<pad>": self.tokenizer.pad_id
|
115 |
}
|
116 |
self.encode_special_tokens = encode_special_tokens
|
117 |
+
|
118 |
+
super().__init__(
|
119 |
+
padding_side=padding_side,
|
120 |
+
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
121 |
+
**kwargs
|
122 |
+
)
|
123 |
|
124 |
def get_command(self, token):
|
125 |
if token in self.special_tokens:
|
|
|
129 |
|
130 |
@property
|
131 |
def unk_token(self) -> str:
|
132 |
+
return self.tokenizer.sp_model.IdToPiece(self.get_command("<unk>"))
|
133 |
|
134 |
@property
|
135 |
def pad_token(self) -> str:
|
136 |
+
return self.tokenizer.sp_model.IdToPiece(self.get_command("<pad>"))
|
137 |
|
138 |
@property
|
139 |
+
def eos_token(self) -> str:
|
140 |
+
return self.tokenizer.sp_model.IdToPiece(self.get_command("<eos>"))
|
141 |
|
142 |
@property
|
143 |
+
def unk_token_id(self) -> int:
|
144 |
+
return self.get_command("<unk>")
|
145 |
+
|
146 |
+
@property
|
147 |
+
def pad_token_id(self) -> int:
|
148 |
+
return self.get_command("<pad>")
|
149 |
|
150 |
@property
|
151 |
def eos_token_id(self):
|
152 |
return self.get_command("<eos>")
|
153 |
|
154 |
+
@unk_token.setter
|
155 |
+
def unk_token(self, value):
|
156 |
+
logger.warning("Setting unk_token is not supported, use the default one.")
|
157 |
+
|
158 |
+
@pad_token.setter
|
159 |
+
def pad_token(self, value):
|
160 |
+
logger.warning("Setting pad_token is not supported, use the default one.")
|
161 |
+
|
162 |
+
@eos_token.setter
|
163 |
+
def eos_token(self, value):
|
164 |
+
logger.warning("Setting eos_token is not supported, use the default one.")
|
165 |
+
|
166 |
@property
|
167 |
def vocab_size(self):
|
168 |
return self.tokenizer.n_words
|
|
|
240 |
return self.batch_encode_plus([input_ids], return_tensors="pt", is_split_into_words=True)
|
241 |
|
242 |
def build_inputs_with_special_tokens(
|
243 |
+
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
|
244 |
) -> List[int]:
|
245 |
"""
|
246 |
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
|
|
|
265 |
return token_ids_0
|
266 |
|
267 |
def _pad(
|
268 |
+
self,
|
269 |
+
encoded_inputs: Union[Dict[str, EncodedInput], BatchEncoding],
|
270 |
+
max_length: Optional[int] = None,
|
271 |
+
padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD,
|
272 |
+
pad_to_multiple_of: Optional[int] = None,
|
273 |
+
return_attention_mask: Optional[bool] = None,
|
274 |
) -> dict:
|
275 |
"""
|
276 |
Pad encoded inputs (on left/right and up to predefined length or max length in the batch)
|
tokenizer_config.json
CHANGED
@@ -31,6 +31,14 @@
|
|
31 |
"rstrip": false,
|
32 |
"single_word": false,
|
33 |
"special": false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
},
|
36 |
"auto_map": {
|
|
|
31 |
"rstrip": false,
|
32 |
"single_word": false,
|
33 |
"special": false
|
34 |
+
},
|
35 |
+
"2": {
|
36 |
+
"content": "</s>",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": true,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": false
|
42 |
}
|
43 |
},
|
44 |
"auto_map": {
|