Chillilly88 commited on
Commit
10fd1b7
·
verified ·
1 Parent(s): 1e46527

Upload folder using huggingface_hub

Browse files
Files changed (7) hide show
  1. README.md +138 -0
  2. README_zh.md +141 -0
  3. config.json +30 -0
  4. model.safetensors +3 -0
  5. special_tokens_map.json +33 -0
  6. tokenizer.model +3 -0
  7. tokenizer_config.json +242 -0
README.md CHANGED
@@ -1,3 +1,141 @@
1
  ---
 
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ - zh
5
  license: apache-2.0
6
+ tags:
7
+ - haidass
8
+ - ascend
9
+ - npu
10
+ - 910b
11
+ - atlas-a2
12
+ - bilingual
13
+ - from-scratch
14
+ - mindspeed-llm
15
+ library_name: transformers
16
+ pipeline_tag: text-generation
17
  ---
18
+
19
+ # haidass-143M
20
+
21
+ A bilingual (English/Chinese) small language model trained entirely on **Huawei Ascend** NPU ecosystem.
22
+
23
+ ## Model Overview
24
+
25
+ Haidass-143M is a 143M-parameter bilingual language model trained on approximately 100B tokens of English and Chinese data. The entire training pipeline runs on the Huawei Ascend ecosystem, using the **MindSpeed-LLM** framework on Atlas A2 servers (910B). A custom 64,000-token bilingual vocabulary (SentencePiece BPE) was trained alongside the model. This model is competitive among multilingual models under 150M parameters and ranks favorably across multiple evaluation benchmarks.
26
+
27
+ ## Model Architecture
28
+
29
+ | Parameter | Value |
30
+ |------|------|
31
+ | Architecture | Qwen3 |
32
+ | Layers | 30 |
33
+ | Hidden size | 576 |
34
+ | Attention heads | 9 |
35
+ | KV heads (GQA) | 3 |
36
+ | Head dim | 64 |
37
+ | FFN intermediate size | 1,536 |
38
+ | Vocabulary size | 64,000 |
39
+ | Max sequence length | 4,096 |
40
+ | Tie word embeddings | Yes |
41
+ | Activation | SwiGLU (SiLU) |
42
+ | Normalization | RMSNorm (eps=1e-6) |
43
+ | Position encoding | RoPE (θ=100,000) |
44
+ | Attention bias | None |
45
+ | Precision | BF16 |
46
+ | Total parameters | ~143M |
47
+
48
+ ## Training Data
49
+
50
+ The model was trained on approximately 100B tokens of mixed English and Chinese data. Primary data sources:
51
+
52
+ - [openbmb/Ultra-FineWeb](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) (ultrafineweb-en + ultrafineweb-zh)
53
+ - [mlfoundations/dclm-baseline-1.0-parquet](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0-parquet) (dclm)
54
+ - [HuggingFaceTB/finemath](https://huggingface.co/datasets/HuggingFaceTB/finemath) (finemath-4plus)
55
+
56
+
57
+ ## Training Configuration
58
+
59
+ | Parameter | Value |
60
+ |------|------|
61
+ | Framework | MindSpeed-LLM (v2.3.0) |
62
+ | Hardware | 8 × Atlas A2 servers (8 NPUs per node, 256 cores) |
63
+ | NPU model | Huawei Ascend 910B |
64
+ | Total NPUs | 64 (8 nodes × 8 cards) |
65
+ | Tensor parallelism | 1 |
66
+ | Pipeline parallelism | 1 |
67
+ | Data parallelism | 64 |
68
+ | Micro-batch size | 2 |
69
+ | Global batch size | 128 |
70
+ | Sequence length | 4,096 |
71
+ | Tokens per iteration | 524,288 |
72
+
73
+
74
+ ## Optimizer
75
+
76
+ | Parameter | Value |
77
+ |------|------|
78
+ | Optimizer | AdamW |
79
+ | Peak learning rate | 3e-4 |
80
+ | Min learning rate | 0 |
81
+ | Weight decay | 1e-5 |
82
+ | Gradient clipping | 2.0 |
83
+ | Adam β1 | 0.9 |
84
+ | Adam β2 | 0.95 |
85
+ | Initial loss scale | 4,096 |
86
+ | Random seed | 42 |
87
+
88
+ ## Tokenizer
89
+
90
+ | Property | Value |
91
+ |------|------|
92
+ | Type | SentencePiece BPE |
93
+ | Vocabulary size | 64,000 |
94
+ | Language coverage | English + Chinese |
95
+
96
+ ## Evaluation
97
+
98
+ Evaluated at checkpoint (iter 188,000, ~98B tokens) using the lighteval framework (v0.9.2).
99
+
100
+ | Benchmark | Score |
101
+ |------|------|
102
+ | ARC-Easy | 60.44 |
103
+ | ARC-Challenge | 27.13 |
104
+ | PIQA | 67.25 |
105
+ | HellaSwag |37.91 |
106
+ | OpenBookQA | 31.8 |
107
+ | Winogrande | 52.17 |
108
+ | agi_eval | 23.78 |
109
+
110
+ ## Key Features
111
+
112
+ - **Fully Ascend-native**: Trained entirely on Huawei Ascend 910B NPUs using the MindSpeed-LLM framework
113
+ - **Bilingual**: Trained on a mixture of English and Chinese data
114
+
115
+
116
+ ## Intended Use
117
+
118
+ This is a research model, suitable for:
119
+ - Studying training dynamics of small models on Ascend NPUs
120
+ - English/Chinese language modeling research
121
+ - Serving as a base model for fine-tuning or annealing experiments
122
+
123
+ ## Limitations
124
+
125
+ - Small model scale; reasoning and generation capabilities are limited
126
+ - No instruction tuning — raw pretrained model only
127
+ - No RLHF or alignment training
128
+
129
+ ## Citation
130
+
131
+ ```bibtex
132
+ @misc{haidass-143m,
133
+ title={haidass-143M: A Bilingual Small Language Model Trained on Ascend 910B},
134
+ year={2026},
135
+ note={Based on Qwen3 architecture, trained from scratch on 100B tokens using MindSpeed-LLM on 64× Ascend 910B NPUs}
136
+ }
137
+ ```
138
+
139
+ ## License
140
+
141
+ Apache 2.0
README_zh.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ license: apache-2.0
6
+ tags:
7
+ - haidass
8
+ - ascend
9
+ - npu
10
+ - 910b
11
+ - atlas-a2
12
+ - bilingual
13
+ - from-scratch
14
+ - mindspeed-llm
15
+ library_name: transformers
16
+ pipeline_tag: text-generation
17
+ ---
18
+
19
+ # haidass-143M
20
+
21
+ 中英双语小语言模型,在**华为昇腾**生态上进行全流程训练。
22
+
23
+ ## 模型简介
24
+
25
+ Haidass-143M 是一个 143M 参数的中英双语语言模型,在约 100B token 的中英文数据上训练完成。模型在华为昇腾生态上进行全流程训练,整体流程基于 **MindSpeed-LLM** 框架和 Atlas A2 服务器(910B)。同时配套训练了大小为 64,000 的中英双语词表。该模型在 150M 以下参数规模的多语言模型中具有较强竞争力,并在多个评测指标中排名靠前。
26
+
27
+ ## 模型架构
28
+
29
+ | 参数 | 值 |
30
+ |------|-----|
31
+ | 架构 | Qwen3 |
32
+ | 层数 | 30 |
33
+ | 隐层维度 | 576 |
34
+ | 注意力头数 | 9 |
35
+ | KV 头数 (GQA) | 3 |
36
+ | 头维度 | 64 |
37
+ | FFN 中间维度 | 1,536 |
38
+ | 词表大小 | 64,000 |
39
+ | 最大序列长度 | 4,096 |
40
+ | 绑定嵌入 | 是 |
41
+ | 激活函数 | SwiGLU (SiLU) |
42
+ | 归一化 | RMSNorm (eps=1e-6) |
43
+ | 位置编码 | RoPE (θ=100,000) |
44
+ | 注意力偏置 | 无 |
45
+ | 精度 | BF16 |
46
+ | 总参数量 | ~143M |
47
+
48
+ ## 训练数据
49
+
50
+ 模型在约 100B token 的中英文混合数据上训练。主要数据来源为:
51
+
52
+ - [openbmb/Ultra-FineWeb](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) (ultrafineweb-en + ultrafineweb-zh)
53
+ - [mlfoundations/dclm-baseline-1.0-parquet](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0-parquet) (dclm)
54
+ - [HuggingFaceTB/finemath](https://huggingface.co/datasets/HuggingFaceTB/finemath) (finemath-4plus)
55
+
56
+
57
+ ## 训练配置
58
+
59
+ | 参数 | 值 |
60
+ |------|------|
61
+ | 框架 | MindSpeed-LLM (v2.3.0) |
62
+ | 硬件 | 8 台 Atlas A2 服务器 (每台 8 卡 NPU,256 核) |
63
+ | NPU 型号 | 华为昇腾 910B |
64
+ | 总 NPU 数 | 64 (8 节点 × 8 卡) |
65
+ | 张量并行 | 1 |
66
+ | 流水线并行 | 1 |
67
+ | 数据并行 | 64 |
68
+ | 微批次 | 2 |
69
+ | 全局批次 | 128 |
70
+ | 序列长度 | 4,096 |
71
+ | 每迭代 token 数 | 524,288 |
72
+
73
+
74
+ ## 优化器
75
+
76
+ | 参数 | 值 |
77
+ |------|------|
78
+ | 优化器 | AdamW |
79
+ | 峰值学习率 | 3e-4 |
80
+ | 最低学习率 | 0 |
81
+ | 权重衰减 | 1e-5 |
82
+ | 梯度裁剪 | 2.0 |
83
+ | Adam β1 | 0.9 |
84
+ | Adam β2 | 0.95 |
85
+ | 初始 loss scale | 4,096 |
86
+ | 随机种子 | 42 |
87
+
88
+ ## 词表
89
+
90
+ | 属性 | 值 |
91
+ |------|------|
92
+ | 类型 | SentencePiece BPE |
93
+ | 词表大小 | 64,000 |
94
+ | 语言覆盖 | 英文 + 中文 |
95
+
96
+ ## 测评与对比(补)
97
+
98
+ 在 checkpoint (iter 188,000, ~98B tokens) 上基于 lighteval 框架(v0.9.2)测评。
99
+
100
+ | Benchmark | Score |
101
+ |------|------|
102
+ | ARC-Easy | 60.44 |
103
+ | ARC-Challenge | 27.13 |
104
+ | PIQA | 67.25 |
105
+ | HellaSwag | 37.91 |
106
+ | OpenBookQA | 31.8 |
107
+ | Winogrande | 52.17 |
108
+ | agi_eval | 23.78 |
109
+
110
+ ## 核心特点
111
+
112
+ - **全昇腾原生**: 完全在华为昇腾 910B NPU 上训练,使用 MindSpeed-LLM 框架
113
+ - **中英双语**: 模型基于中英混合数据集训练
114
+
115
+
116
+ ## 预期用途
117
+
118
+ 本模型为研究型模型,适用于:
119
+ - 研究小模型在昇腾 NPU 上的训练动态
120
+ - 中英文语言建模研究
121
+ - 作为后续微调或退火实验的基础模型
122
+
123
+ ## 局限性
124
+
125
+ - 模型规模较小,推理和生成能力有限
126
+ - 未经过指令微调 — 仅为原始预训练模型
127
+ - 未经过 RLHF 或对齐训练
128
+
129
+ ## Citation
130
+
131
+ ```bibtex
132
+ @misc{haidass-143m,
133
+ title={haidass-143M: A Bilingual Small Language Model Trained on Ascend 910B},
134
+ year={2026},
135
+ note={Based on Qwen3 architecture, trained from scratch on 100B tokens using MindSpeed-LLM on 64× Ascend 910B NPUs}
136
+ }
137
+ ```
138
+
139
+ ## License
140
+
141
+ Apache 2.0
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 3,
8
+ "eos_token_id": 5,
9
+ "head_dim": 64,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 576,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 1536,
14
+ "max_position_embeddings": 4096,
15
+ "max_window_layers": 30,
16
+ "model_type": "qwen3",
17
+ "num_attention_heads": 9,
18
+ "num_hidden_layers": 30,
19
+ "num_key_value_heads": 3,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_scaling": null,
22
+ "rope_theta": 100000,
23
+ "sliding_window": null,
24
+ "tie_word_embeddings": true,
25
+ "torch_dtype": "bfloat16",
26
+ "transformers_version": "4.51.0",
27
+ "use_cache": true,
28
+ "use_sliding_window": false,
29
+ "vocab_size": 64000
30
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c28738b1c14dc77891cd81160e7eec8d5b7b20f3f252364ce04bc642c20eefa2
3
+ size 286179680
special_tokens_map.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": null,
3
+ "eos_token": "<|im_end|>",
4
+ "pad_token": "<|im_end|>",
5
+ "unk_token": null,
6
+ "additional_special_tokens": [
7
+ "<|im_start|>",
8
+ "<|im_end|>",
9
+ "<|object_ref_start|>",
10
+ "<|object_ref_end|>",
11
+ "<|box_start|>",
12
+ "<|box_end|>",
13
+ "<|quad_start|>",
14
+ "<|quad_end|>",
15
+ "<|vision_start|>",
16
+ "<|vision_end|>",
17
+ "<|vision_pad|>",
18
+ "<|image_pad|>",
19
+ "<|video_pad|>",
20
+ "<tool_call>",
21
+ "</tool_call>",
22
+ "<|fim_prefix|>",
23
+ "<|fim_middle|>",
24
+ "<|fim_suffix|>",
25
+ "<|fim_pad|>",
26
+ "<|repo_name|>",
27
+ "<|file_sep|>",
28
+ "<tool_response>",
29
+ "</tool_response>",
30
+ "<think>",
31
+ "</think>"
32
+ ]
33
+ }
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dddb2e3e527f3ff79f3ee1e9c9282001c8c0505ef53107ba75126a26f9318c61
3
+ size 1298093
tokenizer_config.json ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "3": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "rstrip": false,
9
+ "normalized": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "4": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "rstrip": false,
17
+ "normalized": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "5": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "rstrip": false,
25
+ "normalized": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "6": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "rstrip": false,
33
+ "normalized": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "7": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "rstrip": false,
41
+ "normalized": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "8": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "rstrip": false,
49
+ "normalized": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "9": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "rstrip": false,
57
+ "normalized": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "10": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "rstrip": false,
65
+ "normalized": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "11": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "rstrip": false,
73
+ "normalized": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "12": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "rstrip": false,
81
+ "normalized": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "13": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "rstrip": false,
89
+ "normalized": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "14": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "rstrip": false,
97
+ "normalized": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "15": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "rstrip": false,
105
+ "normalized": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "16": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "rstrip": false,
113
+ "normalized": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "17": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "rstrip": false,
121
+ "normalized": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "18": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "rstrip": false,
129
+ "normalized": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "19": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "rstrip": false,
137
+ "normalized": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "20": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "rstrip": false,
145
+ "normalized": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "21": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "rstrip": false,
153
+ "normalized": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "22": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "rstrip": false,
161
+ "normalized": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "23": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "rstrip": false,
169
+ "normalized": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "24": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "rstrip": false,
177
+ "normalized": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "25": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "rstrip": false,
185
+ "normalized": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "26": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "rstrip": false,
193
+ "normalized": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "27": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "rstrip": false,
201
+ "normalized": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "28": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "rstrip": false,
209
+ "normalized": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
231
+ "clean_up_tokenization_spaces": false,
232
+ "eos_token": "<|im_end|>",
233
+ "errors": "replace",
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|im_end|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "LlamaTokenizer",
238
+ "unk_token": null,
239
+ "legacy": true,
240
+ "add_eos_token": false,
241
+ "sp_model_kwargs": {}
242
+ }