ChengboLiu commited on
Commit
70c0877
·
1 Parent(s): 6d1f265
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "bos_token_id": 1,
6
+ "eos_token_id": 2,
7
+ "hidden_act": "silu",
8
+ "hidden_size": 5120,
9
+ "initializer_range": 0.02,
10
+ "intermediate_size": 13824,
11
+ "max_position_embeddings": 16384,
12
+ "model_type": "llama",
13
+ "num_attention_heads": 40,
14
+ "num_hidden_layers": 40,
15
+ "num_key_value_heads": 40,
16
+ "pretraining_tp": 1,
17
+ "rms_norm_eps": 1e-05,
18
+ "rope_scaling": null,
19
+ "rope_theta": 1000000,
20
+ "tie_word_embeddings": false,
21
+ "torch_dtype": "bfloat16",
22
+ "transformers_version": "4.33.0.dev0",
23
+ "use_cache": true,
24
+ "vocab_size": 32016
25
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.33.0.dev0"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21deeb71efc215b9a40be4fed998759a38734e2d9363e22750123694caf46791
3
+ size 26032099040
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 26032056320
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00003-of-00003.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00003.bin",
8
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
9
+ "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
10
+ "model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
11
+ "model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
12
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
13
+ "model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
14
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
15
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
16
+ "model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
17
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
18
+ "model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
19
+ "model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
20
+ "model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
21
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
22
+ "model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
23
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
24
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
25
+ "model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
26
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
27
+ "model.layers.10.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
28
+ "model.layers.10.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
29
+ "model.layers.10.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
30
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
31
+ "model.layers.10.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
32
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
33
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
34
+ "model.layers.10.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
35
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
36
+ "model.layers.11.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
37
+ "model.layers.11.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
38
+ "model.layers.11.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
39
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
40
+ "model.layers.11.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
41
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
42
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
43
+ "model.layers.11.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
44
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
45
+ "model.layers.12.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
46
+ "model.layers.12.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
47
+ "model.layers.12.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
48
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
49
+ "model.layers.12.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
50
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
51
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
52
+ "model.layers.12.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
53
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
54
+ "model.layers.13.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
55
+ "model.layers.13.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
56
+ "model.layers.13.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
57
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
58
+ "model.layers.13.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
59
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
60
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
61
+ "model.layers.13.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
62
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
63
+ "model.layers.14.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
64
+ "model.layers.14.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
65
+ "model.layers.14.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
66
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
67
+ "model.layers.14.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
68
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
69
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
70
+ "model.layers.14.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
71
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
72
+ "model.layers.15.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
73
+ "model.layers.15.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
74
+ "model.layers.15.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
75
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
76
+ "model.layers.15.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
77
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
78
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
79
+ "model.layers.15.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
80
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
81
+ "model.layers.16.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
82
+ "model.layers.16.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
83
+ "model.layers.16.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
84
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
85
+ "model.layers.16.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
86
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
87
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
88
+ "model.layers.16.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
89
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
90
+ "model.layers.17.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
91
+ "model.layers.17.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
92
+ "model.layers.17.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
93
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
94
+ "model.layers.17.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
95
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
96
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
97
+ "model.layers.17.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
98
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
99
+ "model.layers.18.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
100
+ "model.layers.18.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
101
+ "model.layers.18.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
102
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
103
+ "model.layers.18.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
104
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
105
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
106
+ "model.layers.18.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
107
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
108
+ "model.layers.19.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
109
+ "model.layers.19.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
110
+ "model.layers.19.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
111
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
112
+ "model.layers.19.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
113
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
114
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
115
+ "model.layers.19.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
116
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
117
+ "model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
118
+ "model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
119
+ "model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
120
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
121
+ "model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
122
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
123
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
124
+ "model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
125
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
126
+ "model.layers.20.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
127
+ "model.layers.20.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
128
+ "model.layers.20.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
129
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
130
+ "model.layers.20.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
131
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
132
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
133
+ "model.layers.20.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
134
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
135
+ "model.layers.21.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
136
+ "model.layers.21.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
137
+ "model.layers.21.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
138
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
139
+ "model.layers.21.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
140
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
141
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
142
+ "model.layers.21.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
143
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
144
+ "model.layers.22.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
145
+ "model.layers.22.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
146
+ "model.layers.22.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
147
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
148
+ "model.layers.22.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
149
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
150
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
151
+ "model.layers.22.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
152
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
153
+ "model.layers.23.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
154
+ "model.layers.23.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
155
+ "model.layers.23.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
156
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
157
+ "model.layers.23.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
158
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
159
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
160
+ "model.layers.23.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
161
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
162
+ "model.layers.24.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
163
+ "model.layers.24.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
164
+ "model.layers.24.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
165
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
166
+ "model.layers.24.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
167
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
168
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
169
+ "model.layers.24.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
170
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
171
+ "model.layers.25.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
172
+ "model.layers.25.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
173
+ "model.layers.25.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
174
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
175
+ "model.layers.25.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
176
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
177
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
178
+ "model.layers.25.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
179
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
180
+ "model.layers.26.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
181
+ "model.layers.26.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
182
+ "model.layers.26.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
183
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
184
+ "model.layers.26.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
185
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
186
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
187
+ "model.layers.26.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
188
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
189
+ "model.layers.27.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
190
+ "model.layers.27.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
191
+ "model.layers.27.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
192
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
193
+ "model.layers.27.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
194
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
195
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
196
+ "model.layers.27.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
197
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
198
+ "model.layers.28.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
199
+ "model.layers.28.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
200
+ "model.layers.28.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
201
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
202
+ "model.layers.28.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
203
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
204
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
205
+ "model.layers.28.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
206
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
207
+ "model.layers.29.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
208
+ "model.layers.29.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
209
+ "model.layers.29.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
210
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
211
+ "model.layers.29.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
212
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
213
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
214
+ "model.layers.29.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
215
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
216
+ "model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
217
+ "model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
218
+ "model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
219
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
220
+ "model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
221
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
222
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
223
+ "model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
224
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
225
+ "model.layers.30.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
226
+ "model.layers.30.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
227
+ "model.layers.30.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
228
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
229
+ "model.layers.30.self_attn.k_proj.weight": "pytorch_model-00002-of-00003.bin",
230
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
231
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00002-of-00003.bin",
232
+ "model.layers.30.self_attn.v_proj.weight": "pytorch_model-00002-of-00003.bin",
233
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
234
+ "model.layers.31.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
235
+ "model.layers.31.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
236
+ "model.layers.31.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
237
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
238
+ "model.layers.31.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
239
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
240
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
241
+ "model.layers.31.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
242
+ "model.layers.32.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
243
+ "model.layers.32.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
244
+ "model.layers.32.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
245
+ "model.layers.32.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
246
+ "model.layers.32.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
247
+ "model.layers.32.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
248
+ "model.layers.32.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
249
+ "model.layers.32.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
250
+ "model.layers.32.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
251
+ "model.layers.33.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
252
+ "model.layers.33.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
253
+ "model.layers.33.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
254
+ "model.layers.33.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
255
+ "model.layers.33.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
256
+ "model.layers.33.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
257
+ "model.layers.33.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
258
+ "model.layers.33.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
259
+ "model.layers.33.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
260
+ "model.layers.34.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
261
+ "model.layers.34.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
262
+ "model.layers.34.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
263
+ "model.layers.34.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
264
+ "model.layers.34.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
265
+ "model.layers.34.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
266
+ "model.layers.34.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
267
+ "model.layers.34.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
268
+ "model.layers.34.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
269
+ "model.layers.35.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
270
+ "model.layers.35.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
271
+ "model.layers.35.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
272
+ "model.layers.35.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
273
+ "model.layers.35.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
274
+ "model.layers.35.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
275
+ "model.layers.35.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
276
+ "model.layers.35.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
277
+ "model.layers.35.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
278
+ "model.layers.36.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
279
+ "model.layers.36.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
280
+ "model.layers.36.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
281
+ "model.layers.36.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
282
+ "model.layers.36.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
283
+ "model.layers.36.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
284
+ "model.layers.36.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
285
+ "model.layers.36.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
286
+ "model.layers.36.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
287
+ "model.layers.37.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
288
+ "model.layers.37.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
289
+ "model.layers.37.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
290
+ "model.layers.37.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
291
+ "model.layers.37.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
292
+ "model.layers.37.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
293
+ "model.layers.37.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
294
+ "model.layers.37.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
295
+ "model.layers.37.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
296
+ "model.layers.38.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
297
+ "model.layers.38.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
298
+ "model.layers.38.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
299
+ "model.layers.38.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
300
+ "model.layers.38.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
301
+ "model.layers.38.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
302
+ "model.layers.38.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
303
+ "model.layers.38.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
304
+ "model.layers.38.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
305
+ "model.layers.39.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
306
+ "model.layers.39.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
307
+ "model.layers.39.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
308
+ "model.layers.39.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
309
+ "model.layers.39.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
310
+ "model.layers.39.self_attn.k_proj.weight": "pytorch_model-00003-of-00003.bin",
311
+ "model.layers.39.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
312
+ "model.layers.39.self_attn.q_proj.weight": "pytorch_model-00003-of-00003.bin",
313
+ "model.layers.39.self_attn.v_proj.weight": "pytorch_model-00003-of-00003.bin",
314
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
315
+ "model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
316
+ "model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
317
+ "model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
318
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
319
+ "model.layers.4.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
320
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
321
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
322
+ "model.layers.4.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
323
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
324
+ "model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
325
+ "model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
326
+ "model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
327
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
328
+ "model.layers.5.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
329
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
330
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
331
+ "model.layers.5.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
332
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
333
+ "model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
334
+ "model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
335
+ "model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
336
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
337
+ "model.layers.6.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
338
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
339
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
340
+ "model.layers.6.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
341
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
342
+ "model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
343
+ "model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
344
+ "model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
345
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
346
+ "model.layers.7.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
347
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
348
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
349
+ "model.layers.7.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
350
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
351
+ "model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
352
+ "model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
353
+ "model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
354
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
355
+ "model.layers.8.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
356
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
357
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
358
+ "model.layers.8.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
359
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
360
+ "model.layers.9.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
361
+ "model.layers.9.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
362
+ "model.layers.9.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
363
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
364
+ "model.layers.9.self_attn.k_proj.weight": "pytorch_model-00001-of-00003.bin",
365
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
366
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00001-of-00003.bin",
367
+ "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00001-of-00003.bin",
368
+ "model.norm.weight": "pytorch_model-00003-of-00003.bin"
369
+ }
370
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "▁<PRE>",
4
+ "▁<MID>",
5
+ "▁<SUF>",
6
+ "▁<EOT>"
7
+ ],
8
+ "bos_token": {
9
+ "content": "<s>",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ },
15
+ "eos_token": {
16
+ "content": "▁<EOT>",
17
+ "lstrip": false,
18
+ "normalized": true,
19
+ "rstrip": false,
20
+ "single_word": false
21
+ },
22
+ "unk_token": {
23
+ "content": "<unk>",
24
+ "lstrip": false,
25
+ "normalized": true,
26
+ "rstrip": false,
27
+ "single_word": false
28
+ }
29
+ }
tokenization_sdsat.py ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, Thundersoft. All rights reserved.
2
+
3
+ import os
4
+ from shutil import copyfile
5
+ from typing import Any, Dict, List, Optional, Tuple
6
+
7
+ import sentencepiece as spm
8
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
9
+ from transformers.utils import logging
10
+ from transformers.convert_slow_tokenizer import import_protobuf
11
+
12
+ logger = logging.get_logger(__name__)
13
+
14
+ VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
15
+ PRETRAINED_VOCAB_FILES_MAP = {
16
+ "vocab_file": {},
17
+ "tokenizer_file": {},
18
+ }
19
+ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {}
20
+ SPIECE_UNDERLINE = "▁"
21
+
22
+ B_INST, E_INST = "[INST]", "[/INST]"
23
+ B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
24
+
25
+ # fmt: off
26
+ DEFAULT_SYSTEM_PROMPT = """You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your \
27
+ answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure\
28
+ that your responses are socially unbiased and positive in nature.
29
+
30
+ If a question does not make any sense, or is not factually coherent, explain why instead of answering something not \
31
+ correct. If you don't know the answer to a question, please don't share false information."""
32
+ # fmt: on
33
+
34
+
35
+ class SDSATTokenizer(PreTrainedTokenizer):
36
+ """
37
+ Construct a SDSAT tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
38
+ no padding token in the original model.
39
+
40
+ Args:
41
+ vocab_file (`str`):
42
+ Path to the vocabulary file.
43
+ legacy (`bool`, *optional*):
44
+ Whether or not the `legacy` behavior of the tokenizer should be used. Legacy is before the merge of #24622
45
+ and #25224 which includes fixes to properly handle tokens that appear after special tokens. A simple
46
+ example:
47
+
48
+ - `legacy=True`:
49
+ ```python
50
+ >>> from transformers import T5Tokenizer
51
+
52
+ >>> tokenizer = T5Tokenizer.from_pretrained("t5-base", legacy=True)
53
+ >>> tokenizer.encode("Hello <extra_id_0>.")
54
+ [8774, 32099, 3, 5, 1]
55
+ ```
56
+ - `legacy=False`:
57
+ ```python
58
+ >>> from transformers import T5Tokenizer
59
+
60
+ >>> tokenizer = T5Tokenizer.from_pretrained("t5-base", legacy=False)
61
+ >>> tokenizer.encode("Hello <extra_id_0>.") # the extra space `[3]` is no longer here
62
+ [8774, 32099, 5, 1]
63
+ ```
64
+ Checkout the [pull request](https://github.com/huggingface/transformers/pull/24565) for more details.
65
+
66
+ """
67
+
68
+ vocab_files_names = VOCAB_FILES_NAMES
69
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
70
+ max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
71
+ model_input_names = ["input_ids", "attention_mask"]
72
+
73
+ def __init__(
74
+ self,
75
+ vocab_file,
76
+ unk_token="<unk>",
77
+ bos_token="<s>",
78
+ eos_token="</s>",
79
+ pad_token=None,
80
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
81
+ add_bos_token=True,
82
+ add_eos_token=False,
83
+ clean_up_tokenization_spaces=False,
84
+ use_default_system_prompt=True,
85
+ spaces_between_special_tokens=False,
86
+ legacy=None,
87
+ **kwargs,
88
+ ):
89
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
90
+ bos_token = AddedToken(bos_token, lstrip=False, rstrip=False) if isinstance(bos_token, str) else bos_token
91
+ eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
92
+ unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
93
+ pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
94
+
95
+ if legacy is None:
96
+ logger.warning_once(
97
+ f"You are using the default legacy behaviour of the {self.__class__}. If you see this, DO NOT PANIC! This is"
98
+ " expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you."
99
+ " If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it"
100
+ " means, and thouroughly read the reason why this was added as explained in"
101
+ " https://github.com/huggingface/transformers/pull/24565"
102
+ )
103
+ legacy = True
104
+
105
+ self.legacy = legacy
106
+ self.vocab_file = vocab_file
107
+ self.add_bos_token = add_bos_token
108
+ self.add_eos_token = add_eos_token
109
+ self.use_default_system_prompt = use_default_system_prompt
110
+ self.sp_model = self.get_spm_processor()
111
+
112
+ super().__init__(
113
+ bos_token=bos_token,
114
+ eos_token=eos_token,
115
+ unk_token=unk_token,
116
+ pad_token=pad_token,
117
+ add_bos_token=add_bos_token,
118
+ add_eos_token=add_eos_token,
119
+ sp_model_kwargs=self.sp_model_kwargs,
120
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
121
+ use_default_system_prompt=use_default_system_prompt,
122
+ spaces_between_special_tokens=spaces_between_special_tokens,
123
+ legacy=legacy,
124
+ **kwargs,
125
+ )
126
+
127
+ @property
128
+ def unk_token_length(self):
129
+ return len(self.sp_model.encode(str(self.unk_token)))
130
+
131
+ # Copied from transformers.models.t5.tokenization_t5.T5Tokenizer.get_spm_processor
132
+ def get_spm_processor(self):
133
+ tokenizer = spm.SentencePieceProcessor(**self.sp_model_kwargs)
134
+ if self.legacy: # no dependency on protobuf
135
+ tokenizer.Load(self.vocab_file)
136
+ return tokenizer
137
+
138
+ with open(self.vocab_file, "rb") as f:
139
+ sp_model = f.read()
140
+ model_pb2 = import_protobuf(f"The new behaviour of {self.__class__.__name__} (with `self.legacy = False`)")
141
+ model = model_pb2.ModelProto.FromString(sp_model)
142
+ normalizer_spec = model_pb2.NormalizerSpec()
143
+ normalizer_spec.add_dummy_prefix = False
144
+ model.normalizer_spec.MergeFrom(normalizer_spec)
145
+ sp_model = model.SerializeToString()
146
+ tokenizer.LoadFromSerializedProto(sp_model)
147
+ return tokenizer
148
+
149
+ def __getstate__(self):
150
+ state = self.__dict__.copy()
151
+ state["sp_model"] = None
152
+ state["sp_model_proto"] = self.sp_model.serialized_model_proto()
153
+ return state
154
+
155
+ def __setstate__(self, d):
156
+ self.__dict__ = d
157
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
158
+ self.sp_model.LoadFromSerializedProto(self.sp_model_proto)
159
+
160
+ @property
161
+ def vocab_size(self):
162
+ """Returns vocab size"""
163
+ return self.sp_model.get_piece_size()
164
+
165
+ def get_vocab(self):
166
+ """Returns vocab as a dict"""
167
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
168
+ vocab.update(self.added_tokens_encoder)
169
+ return vocab
170
+
171
+ # Copied from transformers.models.t5.tokenization_t5.T5Tokenizer.tokenize
172
+ def tokenize(self, text: "TextInput", add_special_tokens=False, **kwargs) -> List[str]:
173
+ """
174
+ Converts a string to a list of tokens. If `self.legacy` is set to `False`, a prefix token is added unless the
175
+ first token is special.
176
+ """
177
+ if self.legacy or len(text) == 0:
178
+ return super().tokenize(text, **kwargs)
179
+
180
+ # tokens = super().tokenize(SPIECE_UNDERLINE + text.replace(SPIECE_UNDERLINE, " "), **kwargs)
181
+ tokens = super().tokenize(text.replace(SPIECE_UNDERLINE, " "), **kwargs) # liu
182
+
183
+ if len(tokens) > 1 and tokens[0] == SPIECE_UNDERLINE and tokens[1] in self.all_special_tokens:
184
+ tokens = tokens[1:]
185
+ return tokens
186
+
187
+ # Copied from transformers.models.t5.tokenization_t5.T5Tokenizer._tokenize
188
+ def _tokenize(self, text, **kwargs):
189
+ """
190
+ Returns a tokenized string.
191
+
192
+ We de-activated the `add_dummy_prefix` option, thus the sentencepiece internals will always strip any
193
+ SPIECE_UNDERLINE. For example: `self.sp_model.encode(f"{SPIECE_UNDERLINE}Hey", out_type = str)` will give
194
+ `['H', 'e', 'y']` instead of `['▁He', 'y']`. Thus we always encode `f"{unk_token}text"` and strip the
195
+ `unk_token`. Here is an example with `unk_token = "<unk>"` and `unk_token_length = 4`.
196
+ `self.tokenizer.sp_model.encode("<unk> Hey", out_type = str)[4:]`.
197
+ """
198
+ tokens = self.sp_model.encode(text, out_type=str)
199
+ if self.legacy or not text.startswith((SPIECE_UNDERLINE, " ")):
200
+ return tokens
201
+
202
+ # 1. Encode string + prefix ex: "<unk> Hey"
203
+ tokens = self.sp_model.encode(self.unk_token + text, out_type=str)
204
+ # 2. Remove self.unk_token from ['<','unk','>', '▁Hey']
205
+ return tokens[self.unk_token_length :] if len(tokens) >= self.unk_token_length else tokens
206
+
207
+ def _convert_token_to_id(self, token):
208
+ """Converts a token (str) in an id using the vocab."""
209
+ return self.sp_model.piece_to_id(token)
210
+
211
+ def _convert_id_to_token(self, index):
212
+ """Converts an index (integer) in a token (str) using the vocab."""
213
+ token = self.sp_model.IdToPiece(index)
214
+ return token
215
+
216
+ def convert_tokens_to_string(self, tokens):
217
+ """Converts a sequence of tokens (string) in a single string."""
218
+ # since we manually add the prefix space, we have to remove it when decoding
219
+ if tokens[0].startswith(SPIECE_UNDERLINE):
220
+ tokens[0] = tokens[0][1:]
221
+
222
+ current_sub_tokens = []
223
+ out_string = ""
224
+ prev_is_special = False
225
+ for i, token in enumerate(tokens):
226
+ # make sure that special tokens are not decoded using sentencepiece model
227
+ if token in self.all_special_tokens:
228
+ if not prev_is_special and i != 0 and self.legacy:
229
+ out_string += " "
230
+ out_string += self.sp_model.decode(current_sub_tokens) + token
231
+ prev_is_special = True
232
+ current_sub_tokens = []
233
+ else:
234
+ current_sub_tokens.append(token)
235
+ prev_is_special = False
236
+ out_string += self.sp_model.decode(current_sub_tokens)
237
+ return out_string
238
+
239
+ def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
240
+ """
241
+ Save the vocabulary and special tokens file to a directory.
242
+
243
+ Args:
244
+ save_directory (`str`):
245
+ The directory in which to save the vocabulary.
246
+
247
+ Returns:
248
+ `Tuple(str)`: Paths to the files saved.
249
+ """
250
+ if not os.path.isdir(save_directory):
251
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
252
+ return
253
+ out_vocab_file = os.path.join(
254
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
255
+ )
256
+
257
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
258
+ copyfile(self.vocab_file, out_vocab_file)
259
+ elif not os.path.isfile(self.vocab_file):
260
+ with open(out_vocab_file, "wb") as fi:
261
+ content_spiece_model = self.sp_model.serialized_model_proto()
262
+ fi.write(content_spiece_model)
263
+
264
+ return (out_vocab_file,)
265
+
266
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
267
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
268
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
269
+
270
+ output = bos_token_id + token_ids_0 + eos_token_id
271
+
272
+ if token_ids_1 is not None:
273
+ output = output + bos_token_id + token_ids_1 + eos_token_id
274
+
275
+ return output
276
+
277
+ def get_special_tokens_mask(
278
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
279
+ ) -> List[int]:
280
+ """
281
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
282
+ special tokens using the tokenizer `prepare_for_model` method.
283
+
284
+ Args:
285
+ token_ids_0 (`List[int]`):
286
+ List of IDs.
287
+ token_ids_1 (`List[int]`, *optional*):
288
+ Optional second list of IDs for sequence pairs.
289
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
290
+ Whether or not the token list is already formatted with special tokens for the model.
291
+
292
+ Returns:
293
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
294
+ """
295
+ if already_has_special_tokens:
296
+ return super().get_special_tokens_mask(
297
+ token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
298
+ )
299
+
300
+ bos_token_id = [1] if self.add_bos_token else []
301
+ eos_token_id = [1] if self.add_eos_token else []
302
+
303
+ if token_ids_1 is None:
304
+ return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id
305
+ return (
306
+ bos_token_id
307
+ + ([0] * len(token_ids_0))
308
+ + eos_token_id
309
+ + bos_token_id
310
+ + ([0] * len(token_ids_1))
311
+ + eos_token_id
312
+ )
313
+
314
+ def create_token_type_ids_from_sequences(
315
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
316
+ ) -> List[int]:
317
+ """
318
+ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
319
+ sequence pair mask has the following format:
320
+
321
+ ```
322
+ 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
323
+ | first sequence | second sequence |
324
+ ```
325
+
326
+ if token_ids_1 is None, only returns the first portion of the mask (0s).
327
+
328
+ Args:
329
+ token_ids_0 (`List[int]`):
330
+ List of ids.
331
+ token_ids_1 (`List[int]`, *optional*):
332
+ Optional second list of IDs for sequence pairs.
333
+
334
+ Returns:
335
+ `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
336
+ """
337
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
338
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
339
+
340
+ output = [0] * len(bos_token_id + token_ids_0 + eos_token_id)
341
+
342
+ if token_ids_1 is not None:
343
+ output += [1] * len(bos_token_id + token_ids_1 + eos_token_id)
344
+
345
+ return output
346
+
347
+ def _build_conversation_input_ids(self, conversation: "Conversation") -> List[int]:
348
+ r"""Builds the input ids for a conversation.
349
+ This is the format used in the provided examples. System prompts should be manually added at the beginning of
350
+ the conversation. If no system prompt is given, the `DEFAULT_SYSTEM_PROMPT` will be used.
351
+ ```
352
+ <bos>[INST] B_SYS SytemPrompt E_SYS Prompt [/INST] Answer <eos>
353
+ <bos>[INST] Prompt [/INST] Answer <eos>
354
+ <bos>[INST] Prompt [/INST]
355
+ ```
356
+
357
+ If you want to use your own system prompt, make sure to use both `B_SYS` and `E_SYS` use the following:
358
+ ```python
359
+ >>> from transformers import Conversation
360
+
361
+ >>> Conversation(
362
+ ... "<<SYS>>\n Only answer with emojis, and charades\n<</SYS>>\n\nHow can I build a house in 10 septs?"
363
+ ... ) # doctest: +IGNORE_RESULT
364
+ ```
365
+ Args:
366
+ conversation (`Conversation`):
367
+ Conversation to build input ids for.
368
+ Returns:
369
+ `List[int]`:
370
+ Input ids for the conversation.
371
+ """
372
+ if self.use_default_system_prompt:
373
+ if len(conversation.past_user_inputs) > 0:
374
+ if (
375
+ not conversation.past_user_inputs[0].startswith(B_SYS)
376
+ or E_SYS not in conversation.past_user_inputs[0]
377
+ ):
378
+ conversation.past_user_inputs[0] = (
379
+ B_SYS + DEFAULT_SYSTEM_PROMPT + E_SYS + conversation.past_user_inputs[0]
380
+ )
381
+ elif conversation.new_user_input:
382
+ if not conversation.new_user_input.startswith(B_SYS) or E_SYS not in conversation.new_user_input:
383
+ conversation.new_user_input = B_SYS + DEFAULT_SYSTEM_PROMPT + E_SYS + conversation.new_user_input
384
+ else:
385
+ raise ValueError("Last message must be from user")
386
+
387
+ dialogue = list(conversation.iter_texts())
388
+ if not all([is_user for is_user, msg in dialogue[::2]]) or not all(
389
+ [not is_user for is_user, msg in dialogue[1::2]]
390
+ ):
391
+ raise ValueError(
392
+ "The model only supports 'user' and 'assistant' roles, starting with user and alternating (u/a/u/a/u...)"
393
+ )
394
+
395
+ dialog_tokens: List[int] = []
396
+ dialog_tokens += sum(
397
+ [
398
+ [self.bos_token_id]
399
+ + self.encode(
400
+ f"{B_INST} {(prompt[1]).strip()} {E_INST} {(answer[1]).strip()} ", add_special_tokens=False
401
+ )
402
+ + [self.eos_token_id]
403
+ for prompt, answer in zip(dialogue[::2], dialogue[1::2])
404
+ ],
405
+ [],
406
+ )
407
+ dialog_tokens += [self.bos_token_id] + self.encode(
408
+ f"{B_INST} {(dialogue[-1][1]).strip()} {E_INST}", add_special_tokens=False
409
+ )
410
+ return dialog_tokens
411
+
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45ccb9c8b6b561889acea59191d66986d314e7cbd6a78abc6e49b139ca91c1e6
3
+ size 500058
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "auto_map": {
5
+ "AutoTokenizer": [
6
+ "tokenization_sdsat.SDSATTokenizer",
7
+ null
8
+ ]
9
+ },
10
+ "bos_token": {
11
+ "__type": "AddedToken",
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "clean_up_tokenization_spaces": false,
19
+ "eos_token": {
20
+ "__type": "AddedToken",
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "legacy": false,
28
+ "model_max_length": 1000000000000000019884624838656,
29
+ "pad_token": null,
30
+ "padding_side": "right",
31
+ "sp_model_kwargs": {},
32
+ "spaces_between_special_tokens": false,
33
+ "tokenizer_class": "SDSATTokenizer",
34
+ "unk_token": {
35
+ "__type": "AddedToken",
36
+ "content": "<unk>",
37
+ "lstrip": false,
38
+ "normalized": true,
39
+ "rstrip": false,
40
+ "single_word": false
41
+ },
42
+ "use_default_system_prompt": true
43
+ }