chestnutlzj
commited on
Commit
•
a6f5d3d
1
Parent(s):
0011d8a
Upload 9 files
Browse files- .gitattributes +1 -0
- README.md +30 -0
- config.json +31 -0
- generation_config.json +6 -0
- loss_plot.png +3 -0
- model.safetensors.index.json +466 -0
- qwen.tiktoken +0 -0
- special_tokens_map.json +3 -0
- tokenization_qwen.py +276 -0
- tokenizer_config.json +14 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
loss_plot.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 4x1.8B MoE Qwen Ckpt 18000
|
2 |
+
|
3 |
+
This is a MoE model project constructed based on the Qwen 1.8B model. In this project, we concatenated 4 original models and trained them using special training methods.
|
4 |
+
|
5 |
+
This model is a checkpoint model for the continue pretraining stage.
|
6 |
+
|
7 |
+
![](loss_plot.png)
|
8 |
+
|
9 |
+
# Evaluations
|
10 |
+
|
11 |
+
| Groups | Metric |Value | |Stderr|
|
12 |
+
|-----------|--------|-----:|---|-----:|
|
13 |
+
|boolq |acc |0.6502|± |0.0083|
|
14 |
+
|ceval-valid|acc |0.5171|± |0.1872|
|
15 |
+
| |acc_norm|0.5171|± |0.1872|
|
16 |
+
|cmmlu |acc |0.5041|± |0.1222|
|
17 |
+
| |acc_norm|0.5041|± |0.1222|
|
18 |
+
|mathqa |acc |0.2693|± |0.0081|
|
19 |
+
| |acc_norm|0.2693|± |0.0081|
|
20 |
+
|
21 |
+
# Acknowledgements
|
22 |
+
|
23 |
+
+ [Qwen](https://github.com/QwenLM/Qwen)
|
24 |
+
+ [mistral.ai](https://mistral.ai)
|
25 |
+
|
26 |
+
# License Agreement
|
27 |
+
|
28 |
+
This project is open source under the Tongyi Qianwen Research License Agreement. You can view the complete license agreement in this link: [https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20RESEARCH%20LICENSE%20AGREEMENT].
|
29 |
+
|
30 |
+
During the use of this project, please ensure that your usage behavior complies with the terms and conditions of the license agreement.
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "MoeChatlaw-checkpoint-13500",
|
3 |
+
"architectures": [
|
4 |
+
"MixtralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_bias": true,
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"bos_token_id": 1,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 2048,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 5504,
|
14 |
+
"max_position_embeddings": 8192,
|
15 |
+
"model_type": "mixtral",
|
16 |
+
"num_attention_heads": 16,
|
17 |
+
"num_experts_per_tok": 2,
|
18 |
+
"num_hidden_layers": 24,
|
19 |
+
"num_key_value_heads": 16,
|
20 |
+
"num_local_experts": 4,
|
21 |
+
"output_router_logits": true,
|
22 |
+
"rms_norm_eps": 1e-06,
|
23 |
+
"rope_theta": 10000.0,
|
24 |
+
"router_aux_loss_coef": 0.001,
|
25 |
+
"sliding_window": 4096,
|
26 |
+
"tie_word_embeddings": false,
|
27 |
+
"torch_dtype": "bfloat16",
|
28 |
+
"transformers_version": "4.36.2",
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 151936
|
31 |
+
}
|
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.36.2"
|
6 |
+
}
|
loss_plot.png
ADDED
Git LFS Details
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 8543543296
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "model-00002-of-00002.safetensors",
|
7 |
+
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
8 |
+
"model.layers.0.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
9 |
+
"model.layers.0.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
10 |
+
"model.layers.0.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
11 |
+
"model.layers.0.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
12 |
+
"model.layers.0.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
13 |
+
"model.layers.0.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
14 |
+
"model.layers.0.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
15 |
+
"model.layers.0.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
16 |
+
"model.layers.0.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
17 |
+
"model.layers.0.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
18 |
+
"model.layers.0.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
19 |
+
"model.layers.0.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
20 |
+
"model.layers.0.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
21 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
22 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
23 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
24 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
25 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
26 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
27 |
+
"model.layers.1.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
28 |
+
"model.layers.1.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
29 |
+
"model.layers.1.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
30 |
+
"model.layers.1.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
31 |
+
"model.layers.1.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
32 |
+
"model.layers.1.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
33 |
+
"model.layers.1.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
34 |
+
"model.layers.1.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
35 |
+
"model.layers.1.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
36 |
+
"model.layers.1.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
37 |
+
"model.layers.1.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
38 |
+
"model.layers.1.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
39 |
+
"model.layers.1.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
40 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
41 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
42 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
43 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
44 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
45 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
46 |
+
"model.layers.10.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
47 |
+
"model.layers.10.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
48 |
+
"model.layers.10.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
49 |
+
"model.layers.10.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
50 |
+
"model.layers.10.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
51 |
+
"model.layers.10.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
52 |
+
"model.layers.10.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
53 |
+
"model.layers.10.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
54 |
+
"model.layers.10.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
55 |
+
"model.layers.10.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
56 |
+
"model.layers.10.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
57 |
+
"model.layers.10.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
58 |
+
"model.layers.10.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
59 |
+
"model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
60 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
61 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
62 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
63 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
64 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
65 |
+
"model.layers.11.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
66 |
+
"model.layers.11.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
67 |
+
"model.layers.11.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
68 |
+
"model.layers.11.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
69 |
+
"model.layers.11.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
70 |
+
"model.layers.11.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
71 |
+
"model.layers.11.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
72 |
+
"model.layers.11.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
73 |
+
"model.layers.11.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
74 |
+
"model.layers.11.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
75 |
+
"model.layers.11.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
76 |
+
"model.layers.11.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
77 |
+
"model.layers.11.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
78 |
+
"model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
79 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
80 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
81 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
82 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
83 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
84 |
+
"model.layers.12.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
85 |
+
"model.layers.12.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
86 |
+
"model.layers.12.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
87 |
+
"model.layers.12.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
88 |
+
"model.layers.12.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
89 |
+
"model.layers.12.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
90 |
+
"model.layers.12.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
91 |
+
"model.layers.12.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
92 |
+
"model.layers.12.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
93 |
+
"model.layers.12.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
94 |
+
"model.layers.12.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
95 |
+
"model.layers.12.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
96 |
+
"model.layers.12.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
97 |
+
"model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
98 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
99 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
100 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
101 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
102 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
103 |
+
"model.layers.13.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
104 |
+
"model.layers.13.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
105 |
+
"model.layers.13.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
106 |
+
"model.layers.13.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
107 |
+
"model.layers.13.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
108 |
+
"model.layers.13.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
109 |
+
"model.layers.13.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
110 |
+
"model.layers.13.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
111 |
+
"model.layers.13.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
112 |
+
"model.layers.13.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
113 |
+
"model.layers.13.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
114 |
+
"model.layers.13.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
115 |
+
"model.layers.13.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
116 |
+
"model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
117 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
118 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
119 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
120 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
121 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
122 |
+
"model.layers.14.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
123 |
+
"model.layers.14.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
124 |
+
"model.layers.14.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
125 |
+
"model.layers.14.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
126 |
+
"model.layers.14.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
127 |
+
"model.layers.14.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
128 |
+
"model.layers.14.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
129 |
+
"model.layers.14.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
130 |
+
"model.layers.14.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
131 |
+
"model.layers.14.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
132 |
+
"model.layers.14.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
133 |
+
"model.layers.14.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
134 |
+
"model.layers.14.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
135 |
+
"model.layers.14.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
136 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
137 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
138 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
139 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
140 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
141 |
+
"model.layers.15.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
142 |
+
"model.layers.15.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
143 |
+
"model.layers.15.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
144 |
+
"model.layers.15.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
145 |
+
"model.layers.15.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
146 |
+
"model.layers.15.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
147 |
+
"model.layers.15.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
148 |
+
"model.layers.15.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
149 |
+
"model.layers.15.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
150 |
+
"model.layers.15.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
151 |
+
"model.layers.15.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
152 |
+
"model.layers.15.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
153 |
+
"model.layers.15.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
154 |
+
"model.layers.15.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
155 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
156 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
157 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
158 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
159 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
160 |
+
"model.layers.16.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
161 |
+
"model.layers.16.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
162 |
+
"model.layers.16.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
163 |
+
"model.layers.16.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
164 |
+
"model.layers.16.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
165 |
+
"model.layers.16.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
166 |
+
"model.layers.16.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
167 |
+
"model.layers.16.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
168 |
+
"model.layers.16.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
169 |
+
"model.layers.16.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
170 |
+
"model.layers.16.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
171 |
+
"model.layers.16.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
172 |
+
"model.layers.16.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
173 |
+
"model.layers.16.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
174 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
175 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
176 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
177 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
178 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
179 |
+
"model.layers.17.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
180 |
+
"model.layers.17.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
181 |
+
"model.layers.17.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
182 |
+
"model.layers.17.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
183 |
+
"model.layers.17.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
184 |
+
"model.layers.17.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
185 |
+
"model.layers.17.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
186 |
+
"model.layers.17.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
187 |
+
"model.layers.17.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
188 |
+
"model.layers.17.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
189 |
+
"model.layers.17.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
190 |
+
"model.layers.17.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
191 |
+
"model.layers.17.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
192 |
+
"model.layers.17.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
193 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
194 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
195 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
196 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
197 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
198 |
+
"model.layers.18.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
199 |
+
"model.layers.18.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
200 |
+
"model.layers.18.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
201 |
+
"model.layers.18.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
202 |
+
"model.layers.18.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
203 |
+
"model.layers.18.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
204 |
+
"model.layers.18.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
205 |
+
"model.layers.18.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
206 |
+
"model.layers.18.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
207 |
+
"model.layers.18.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
208 |
+
"model.layers.18.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
209 |
+
"model.layers.18.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
210 |
+
"model.layers.18.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
211 |
+
"model.layers.18.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
212 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
213 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
214 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
215 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
216 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
217 |
+
"model.layers.19.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
218 |
+
"model.layers.19.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
219 |
+
"model.layers.19.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
220 |
+
"model.layers.19.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
221 |
+
"model.layers.19.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
222 |
+
"model.layers.19.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
223 |
+
"model.layers.19.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
224 |
+
"model.layers.19.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
225 |
+
"model.layers.19.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
226 |
+
"model.layers.19.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
227 |
+
"model.layers.19.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
228 |
+
"model.layers.19.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
229 |
+
"model.layers.19.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
230 |
+
"model.layers.19.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
231 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
232 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
233 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
234 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
235 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
236 |
+
"model.layers.2.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
237 |
+
"model.layers.2.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
238 |
+
"model.layers.2.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
239 |
+
"model.layers.2.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
240 |
+
"model.layers.2.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
241 |
+
"model.layers.2.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
242 |
+
"model.layers.2.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
243 |
+
"model.layers.2.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
244 |
+
"model.layers.2.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
245 |
+
"model.layers.2.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
246 |
+
"model.layers.2.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
247 |
+
"model.layers.2.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
248 |
+
"model.layers.2.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
249 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
250 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
251 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
252 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
253 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
254 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
255 |
+
"model.layers.20.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
256 |
+
"model.layers.20.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
257 |
+
"model.layers.20.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
258 |
+
"model.layers.20.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
259 |
+
"model.layers.20.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
260 |
+
"model.layers.20.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
261 |
+
"model.layers.20.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
262 |
+
"model.layers.20.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
263 |
+
"model.layers.20.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
264 |
+
"model.layers.20.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
265 |
+
"model.layers.20.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
266 |
+
"model.layers.20.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
267 |
+
"model.layers.20.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
268 |
+
"model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
269 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
270 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
271 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
272 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
273 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
274 |
+
"model.layers.21.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
275 |
+
"model.layers.21.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
276 |
+
"model.layers.21.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
277 |
+
"model.layers.21.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
278 |
+
"model.layers.21.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
279 |
+
"model.layers.21.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
280 |
+
"model.layers.21.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
281 |
+
"model.layers.21.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
282 |
+
"model.layers.21.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
283 |
+
"model.layers.21.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
284 |
+
"model.layers.21.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
285 |
+
"model.layers.21.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
286 |
+
"model.layers.21.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
287 |
+
"model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
288 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
289 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
290 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
291 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
292 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
293 |
+
"model.layers.22.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
294 |
+
"model.layers.22.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
295 |
+
"model.layers.22.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
296 |
+
"model.layers.22.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
297 |
+
"model.layers.22.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
298 |
+
"model.layers.22.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
299 |
+
"model.layers.22.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
300 |
+
"model.layers.22.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
301 |
+
"model.layers.22.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
302 |
+
"model.layers.22.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
303 |
+
"model.layers.22.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
304 |
+
"model.layers.22.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
305 |
+
"model.layers.22.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
306 |
+
"model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
307 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
308 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
309 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
310 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
311 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
312 |
+
"model.layers.23.block_sparse_moe.experts.0.w1.weight": "model-00002-of-00002.safetensors",
|
313 |
+
"model.layers.23.block_sparse_moe.experts.0.w2.weight": "model-00002-of-00002.safetensors",
|
314 |
+
"model.layers.23.block_sparse_moe.experts.0.w3.weight": "model-00002-of-00002.safetensors",
|
315 |
+
"model.layers.23.block_sparse_moe.experts.1.w1.weight": "model-00002-of-00002.safetensors",
|
316 |
+
"model.layers.23.block_sparse_moe.experts.1.w2.weight": "model-00002-of-00002.safetensors",
|
317 |
+
"model.layers.23.block_sparse_moe.experts.1.w3.weight": "model-00002-of-00002.safetensors",
|
318 |
+
"model.layers.23.block_sparse_moe.experts.2.w1.weight": "model-00002-of-00002.safetensors",
|
319 |
+
"model.layers.23.block_sparse_moe.experts.2.w2.weight": "model-00002-of-00002.safetensors",
|
320 |
+
"model.layers.23.block_sparse_moe.experts.2.w3.weight": "model-00002-of-00002.safetensors",
|
321 |
+
"model.layers.23.block_sparse_moe.experts.3.w1.weight": "model-00002-of-00002.safetensors",
|
322 |
+
"model.layers.23.block_sparse_moe.experts.3.w2.weight": "model-00002-of-00002.safetensors",
|
323 |
+
"model.layers.23.block_sparse_moe.experts.3.w3.weight": "model-00002-of-00002.safetensors",
|
324 |
+
"model.layers.23.block_sparse_moe.gate.weight": "model-00002-of-00002.safetensors",
|
325 |
+
"model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
326 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
327 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
328 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
329 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
330 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
331 |
+
"model.layers.3.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
332 |
+
"model.layers.3.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
333 |
+
"model.layers.3.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
334 |
+
"model.layers.3.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
335 |
+
"model.layers.3.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
336 |
+
"model.layers.3.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
337 |
+
"model.layers.3.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
338 |
+
"model.layers.3.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
339 |
+
"model.layers.3.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
340 |
+
"model.layers.3.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
341 |
+
"model.layers.3.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
342 |
+
"model.layers.3.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
343 |
+
"model.layers.3.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
344 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
345 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
346 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
347 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
348 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
349 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
350 |
+
"model.layers.4.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
351 |
+
"model.layers.4.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
352 |
+
"model.layers.4.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
353 |
+
"model.layers.4.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
354 |
+
"model.layers.4.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
355 |
+
"model.layers.4.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
356 |
+
"model.layers.4.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
357 |
+
"model.layers.4.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
358 |
+
"model.layers.4.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
359 |
+
"model.layers.4.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
360 |
+
"model.layers.4.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
361 |
+
"model.layers.4.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
362 |
+
"model.layers.4.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
363 |
+
"model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
364 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
365 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
366 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
367 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
368 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
369 |
+
"model.layers.5.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
370 |
+
"model.layers.5.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
371 |
+
"model.layers.5.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
372 |
+
"model.layers.5.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
373 |
+
"model.layers.5.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
374 |
+
"model.layers.5.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
375 |
+
"model.layers.5.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
376 |
+
"model.layers.5.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
377 |
+
"model.layers.5.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
378 |
+
"model.layers.5.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
379 |
+
"model.layers.5.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
380 |
+
"model.layers.5.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
381 |
+
"model.layers.5.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
382 |
+
"model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
383 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
384 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
385 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
386 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
387 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
388 |
+
"model.layers.6.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
389 |
+
"model.layers.6.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
390 |
+
"model.layers.6.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
391 |
+
"model.layers.6.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
392 |
+
"model.layers.6.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
393 |
+
"model.layers.6.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
394 |
+
"model.layers.6.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
395 |
+
"model.layers.6.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
396 |
+
"model.layers.6.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
397 |
+
"model.layers.6.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
398 |
+
"model.layers.6.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
399 |
+
"model.layers.6.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
400 |
+
"model.layers.6.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
401 |
+
"model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
402 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
403 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
404 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
405 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
406 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
407 |
+
"model.layers.7.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
408 |
+
"model.layers.7.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
409 |
+
"model.layers.7.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
410 |
+
"model.layers.7.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
411 |
+
"model.layers.7.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
412 |
+
"model.layers.7.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
413 |
+
"model.layers.7.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
414 |
+
"model.layers.7.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
415 |
+
"model.layers.7.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
416 |
+
"model.layers.7.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
417 |
+
"model.layers.7.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
418 |
+
"model.layers.7.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
419 |
+
"model.layers.7.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
420 |
+
"model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
421 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
422 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
423 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
424 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
425 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
426 |
+
"model.layers.8.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
427 |
+
"model.layers.8.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
428 |
+
"model.layers.8.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
429 |
+
"model.layers.8.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
430 |
+
"model.layers.8.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
431 |
+
"model.layers.8.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
432 |
+
"model.layers.8.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
433 |
+
"model.layers.8.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
434 |
+
"model.layers.8.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
435 |
+
"model.layers.8.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
436 |
+
"model.layers.8.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
437 |
+
"model.layers.8.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
438 |
+
"model.layers.8.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
439 |
+
"model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
440 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
441 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
442 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
443 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
444 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
445 |
+
"model.layers.9.block_sparse_moe.experts.0.w1.weight": "model-00001-of-00002.safetensors",
|
446 |
+
"model.layers.9.block_sparse_moe.experts.0.w2.weight": "model-00001-of-00002.safetensors",
|
447 |
+
"model.layers.9.block_sparse_moe.experts.0.w3.weight": "model-00001-of-00002.safetensors",
|
448 |
+
"model.layers.9.block_sparse_moe.experts.1.w1.weight": "model-00001-of-00002.safetensors",
|
449 |
+
"model.layers.9.block_sparse_moe.experts.1.w2.weight": "model-00001-of-00002.safetensors",
|
450 |
+
"model.layers.9.block_sparse_moe.experts.1.w3.weight": "model-00001-of-00002.safetensors",
|
451 |
+
"model.layers.9.block_sparse_moe.experts.2.w1.weight": "model-00001-of-00002.safetensors",
|
452 |
+
"model.layers.9.block_sparse_moe.experts.2.w2.weight": "model-00001-of-00002.safetensors",
|
453 |
+
"model.layers.9.block_sparse_moe.experts.2.w3.weight": "model-00001-of-00002.safetensors",
|
454 |
+
"model.layers.9.block_sparse_moe.experts.3.w1.weight": "model-00001-of-00002.safetensors",
|
455 |
+
"model.layers.9.block_sparse_moe.experts.3.w2.weight": "model-00001-of-00002.safetensors",
|
456 |
+
"model.layers.9.block_sparse_moe.experts.3.w3.weight": "model-00001-of-00002.safetensors",
|
457 |
+
"model.layers.9.block_sparse_moe.gate.weight": "model-00001-of-00002.safetensors",
|
458 |
+
"model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
459 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
460 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
461 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
462 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
463 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
464 |
+
"model.norm.weight": "model-00002-of-00002.safetensors"
|
465 |
+
}
|
466 |
+
}
|
qwen.tiktoken
ADDED
The diff for this file is too large to render.
See raw diff
|
|
special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"pad_token": "<|endoftext|>"
|
3 |
+
}
|
tokenization_qwen.py
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
"""Tokenization classes for QWen."""
|
7 |
+
|
8 |
+
import base64
|
9 |
+
import logging
|
10 |
+
import os
|
11 |
+
import unicodedata
|
12 |
+
from typing import Collection, Dict, List, Set, Tuple, Union
|
13 |
+
|
14 |
+
import tiktoken
|
15 |
+
from transformers import PreTrainedTokenizer, AddedToken
|
16 |
+
|
17 |
+
logger = logging.getLogger(__name__)
|
18 |
+
|
19 |
+
|
20 |
+
VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken"}
|
21 |
+
|
22 |
+
PAT_STR = r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+"""
|
23 |
+
ENDOFTEXT = "<|endoftext|>"
|
24 |
+
IMSTART = "<|im_start|>"
|
25 |
+
IMEND = "<|im_end|>"
|
26 |
+
# as the default behavior is changed to allow special tokens in
|
27 |
+
# regular texts, the surface forms of special tokens need to be
|
28 |
+
# as different as possible to minimize the impact
|
29 |
+
EXTRAS = tuple((f"<|extra_{i}|>" for i in range(205)))
|
30 |
+
# changed to use actual index to avoid misconfiguration with vocabulary expansion
|
31 |
+
SPECIAL_START_ID = 151643
|
32 |
+
SPECIAL_TOKENS = tuple(
|
33 |
+
enumerate(
|
34 |
+
(
|
35 |
+
(
|
36 |
+
ENDOFTEXT,
|
37 |
+
IMSTART,
|
38 |
+
IMEND,
|
39 |
+
)
|
40 |
+
+ EXTRAS
|
41 |
+
),
|
42 |
+
start=SPECIAL_START_ID,
|
43 |
+
)
|
44 |
+
)
|
45 |
+
SPECIAL_TOKENS_SET = set(t for i, t in SPECIAL_TOKENS)
|
46 |
+
|
47 |
+
|
48 |
+
def _load_tiktoken_bpe(tiktoken_bpe_file: str) -> Dict[bytes, int]:
|
49 |
+
with open(tiktoken_bpe_file, "rb") as f:
|
50 |
+
contents = f.read()
|
51 |
+
return {
|
52 |
+
base64.b64decode(token): int(rank)
|
53 |
+
for token, rank in (line.split() for line in contents.splitlines() if line)
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
class QWenTokenizer(PreTrainedTokenizer):
|
58 |
+
"""QWen tokenizer."""
|
59 |
+
|
60 |
+
vocab_files_names = VOCAB_FILES_NAMES
|
61 |
+
|
62 |
+
def __init__(
|
63 |
+
self,
|
64 |
+
vocab_file,
|
65 |
+
errors="replace",
|
66 |
+
extra_vocab_file=None,
|
67 |
+
**kwargs,
|
68 |
+
):
|
69 |
+
super().__init__(**kwargs)
|
70 |
+
|
71 |
+
# how to handle errors in decoding UTF-8 byte sequences
|
72 |
+
# use ignore if you are in streaming inference
|
73 |
+
self.errors = errors
|
74 |
+
|
75 |
+
self.mergeable_ranks = _load_tiktoken_bpe(vocab_file) # type: Dict[bytes, int]
|
76 |
+
self.special_tokens = {
|
77 |
+
token: index
|
78 |
+
for index, token in SPECIAL_TOKENS
|
79 |
+
}
|
80 |
+
|
81 |
+
# try load extra vocab from file
|
82 |
+
if extra_vocab_file is not None:
|
83 |
+
used_ids = set(self.mergeable_ranks.values()) | set(self.special_tokens.values())
|
84 |
+
extra_mergeable_ranks = _load_tiktoken_bpe(extra_vocab_file)
|
85 |
+
for token, index in extra_mergeable_ranks.items():
|
86 |
+
if token in self.mergeable_ranks:
|
87 |
+
logger.info(f"extra token {token} exists, skipping")
|
88 |
+
continue
|
89 |
+
if index in used_ids:
|
90 |
+
logger.info(f'the index {index} for extra token {token} exists, skipping')
|
91 |
+
continue
|
92 |
+
self.mergeable_ranks[token] = index
|
93 |
+
# the index may be sparse after this, but don't worry tiktoken.Encoding will handle this
|
94 |
+
|
95 |
+
enc = tiktoken.Encoding(
|
96 |
+
"Qwen",
|
97 |
+
pat_str=PAT_STR,
|
98 |
+
mergeable_ranks=self.mergeable_ranks,
|
99 |
+
special_tokens=self.special_tokens,
|
100 |
+
)
|
101 |
+
assert (
|
102 |
+
len(self.mergeable_ranks) + len(self.special_tokens) == enc.n_vocab
|
103 |
+
), f"{len(self.mergeable_ranks) + len(self.special_tokens)} != {enc.n_vocab} in encoding"
|
104 |
+
|
105 |
+
self.decoder = {
|
106 |
+
v: k for k, v in self.mergeable_ranks.items()
|
107 |
+
} # type: dict[int, bytes|str]
|
108 |
+
self.decoder.update({v: k for k, v in self.special_tokens.items()})
|
109 |
+
|
110 |
+
self.tokenizer = enc # type: tiktoken.Encoding
|
111 |
+
|
112 |
+
self.eod_id = self.tokenizer.eot_token
|
113 |
+
self.im_start_id = self.special_tokens[IMSTART]
|
114 |
+
self.im_end_id = self.special_tokens[IMEND]
|
115 |
+
|
116 |
+
def __getstate__(self):
|
117 |
+
# for pickle lovers
|
118 |
+
state = self.__dict__.copy()
|
119 |
+
del state["tokenizer"]
|
120 |
+
return state
|
121 |
+
|
122 |
+
def __setstate__(self, state):
|
123 |
+
# tokenizer is not python native; don't pass it; rebuild it
|
124 |
+
self.__dict__.update(state)
|
125 |
+
enc = tiktoken.Encoding(
|
126 |
+
"Qwen",
|
127 |
+
pat_str=PAT_STR,
|
128 |
+
mergeable_ranks=self.mergeable_ranks,
|
129 |
+
special_tokens=self.special_tokens,
|
130 |
+
)
|
131 |
+
self.tokenizer = enc
|
132 |
+
|
133 |
+
def __len__(self) -> int:
|
134 |
+
return self.tokenizer.n_vocab
|
135 |
+
|
136 |
+
def get_vocab(self) -> Dict[bytes, int]:
|
137 |
+
return self.mergeable_ranks
|
138 |
+
|
139 |
+
def convert_tokens_to_ids(
|
140 |
+
self, tokens: Union[bytes, str, List[Union[bytes, str]]]
|
141 |
+
) -> List[int]:
|
142 |
+
ids = []
|
143 |
+
if isinstance(tokens, (str, bytes)):
|
144 |
+
if tokens in self.special_tokens:
|
145 |
+
return self.special_tokens[tokens]
|
146 |
+
else:
|
147 |
+
return self.mergeable_ranks.get(tokens)
|
148 |
+
for token in tokens:
|
149 |
+
if token in self.special_tokens:
|
150 |
+
ids.append(self.special_tokens[token])
|
151 |
+
else:
|
152 |
+
ids.append(self.mergeable_ranks.get(token))
|
153 |
+
return ids
|
154 |
+
|
155 |
+
def _add_tokens(
|
156 |
+
self,
|
157 |
+
new_tokens: Union[List[str], List[AddedToken]],
|
158 |
+
special_tokens: bool = False,
|
159 |
+
) -> int:
|
160 |
+
if not special_tokens and new_tokens:
|
161 |
+
raise ValueError("Adding regular tokens is not supported")
|
162 |
+
for token in new_tokens:
|
163 |
+
surface_form = token.content if isinstance(token, AddedToken) else token
|
164 |
+
if surface_form not in SPECIAL_TOKENS_SET:
|
165 |
+
raise ValueError("Adding unknown special tokens is not supported")
|
166 |
+
return 0
|
167 |
+
|
168 |
+
def save_vocabulary(self, save_directory: str, **kwargs) -> Tuple[str]:
|
169 |
+
"""
|
170 |
+
Save only the vocabulary of the tokenizer (vocabulary).
|
171 |
+
|
172 |
+
Returns:
|
173 |
+
`Tuple(str)`: Paths to the files saved.
|
174 |
+
"""
|
175 |
+
file_path = os.path.join(save_directory, "qwen.tiktoken")
|
176 |
+
with open(file_path, "w", encoding="utf8") as w:
|
177 |
+
for k, v in self.mergeable_ranks.items():
|
178 |
+
line = base64.b64encode(k).decode("utf8") + " " + str(v) + "\n"
|
179 |
+
w.write(line)
|
180 |
+
return (file_path,)
|
181 |
+
|
182 |
+
def tokenize(
|
183 |
+
self,
|
184 |
+
text: str,
|
185 |
+
allowed_special: Union[Set, str] = "all",
|
186 |
+
disallowed_special: Union[Collection, str] = (),
|
187 |
+
**kwargs,
|
188 |
+
) -> List[Union[bytes, str]]:
|
189 |
+
"""
|
190 |
+
Converts a string in a sequence of tokens.
|
191 |
+
|
192 |
+
Args:
|
193 |
+
text (`str`):
|
194 |
+
The sequence to be encoded.
|
195 |
+
allowed_special (`Literal["all"]` or `set`):
|
196 |
+
The surface forms of the tokens to be encoded as special tokens in regular texts.
|
197 |
+
Default to "all".
|
198 |
+
disallowed_special (`Literal["all"]` or `Collection`):
|
199 |
+
The surface forms of the tokens that should not be in regular texts and trigger errors.
|
200 |
+
Default to an empty tuple.
|
201 |
+
|
202 |
+
kwargs (additional keyword arguments, *optional*):
|
203 |
+
Will be passed to the underlying model specific encode method.
|
204 |
+
|
205 |
+
Returns:
|
206 |
+
`List[bytes|str]`: The list of tokens.
|
207 |
+
"""
|
208 |
+
tokens = []
|
209 |
+
text = unicodedata.normalize("NFC", text)
|
210 |
+
|
211 |
+
# this implementation takes a detour: text -> token id -> token surface forms
|
212 |
+
for t in self.tokenizer.encode(
|
213 |
+
text, allowed_special=allowed_special, disallowed_special=disallowed_special
|
214 |
+
):
|
215 |
+
tokens.append(self.decoder[t])
|
216 |
+
return tokens
|
217 |
+
|
218 |
+
def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) -> str:
|
219 |
+
"""
|
220 |
+
Converts a sequence of tokens in a single string.
|
221 |
+
"""
|
222 |
+
text = ""
|
223 |
+
temp = b""
|
224 |
+
for t in tokens:
|
225 |
+
if isinstance(t, str):
|
226 |
+
if temp:
|
227 |
+
text += temp.decode("utf-8", errors=self.errors)
|
228 |
+
temp = b""
|
229 |
+
text += t
|
230 |
+
elif isinstance(t, bytes):
|
231 |
+
temp += t
|
232 |
+
else:
|
233 |
+
raise TypeError("token should only be of type types or str")
|
234 |
+
if temp:
|
235 |
+
text += temp.decode("utf-8", errors=self.errors)
|
236 |
+
return text
|
237 |
+
|
238 |
+
@property
|
239 |
+
def vocab_size(self):
|
240 |
+
return self.tokenizer.n_vocab
|
241 |
+
|
242 |
+
def _convert_id_to_token(self, index: int) -> Union[bytes, str]:
|
243 |
+
"""Converts an id to a token, special tokens included"""
|
244 |
+
if index in self.decoder:
|
245 |
+
return self.decoder[index]
|
246 |
+
raise ValueError("unknown ids")
|
247 |
+
|
248 |
+
def _convert_token_to_id(self, token: Union[bytes, str]) -> int:
|
249 |
+
"""Converts a token to an id using the vocab, special tokens included"""
|
250 |
+
if token in self.special_tokens:
|
251 |
+
return self.special_tokens[token]
|
252 |
+
if token in self.mergeable_ranks:
|
253 |
+
return self.mergeable_ranks[token]
|
254 |
+
raise ValueError("unknown token")
|
255 |
+
|
256 |
+
def _tokenize(self, text: str, **kwargs):
|
257 |
+
"""
|
258 |
+
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based
|
259 |
+
vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).
|
260 |
+
|
261 |
+
Do NOT take care of added tokens.
|
262 |
+
"""
|
263 |
+
raise NotImplementedError
|
264 |
+
|
265 |
+
def _decode(
|
266 |
+
self,
|
267 |
+
token_ids: Union[int, List[int]],
|
268 |
+
skip_special_tokens: bool = False,
|
269 |
+
errors: str = None,
|
270 |
+
**kwargs,
|
271 |
+
) -> str:
|
272 |
+
if isinstance(token_ids, int):
|
273 |
+
token_ids = [token_ids]
|
274 |
+
if skip_special_tokens:
|
275 |
+
token_ids = [i for i in token_ids if i < self.eod_id]
|
276 |
+
return self.tokenizer.decode(token_ids, errors=errors or self.errors)
|
tokenizer_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {},
|
3 |
+
"auto_map": {
|
4 |
+
"AutoTokenizer": [
|
5 |
+
"tokenization_qwen.QWenTokenizer",
|
6 |
+
null
|
7 |
+
]
|
8 |
+
},
|
9 |
+
"clean_up_tokenization_spaces": true,
|
10 |
+
"model_max_length": 8192,
|
11 |
+
"pad_token": "<|endoftext|>",
|
12 |
+
"tokenizer_class": "QWenTokenizer",
|
13 |
+
"use_fast": false
|
14 |
+
}
|