developerjeremylive nchudleigh commited on
Commit
88df30e
·
0 Parent(s):

Duplicate from superwhisper/s1-mini

Browse files

Co-authored-by: Neil <nchudleigh@users.noreply.huggingface.co>

Files changed (12) hide show
  1. .gitattributes +37 -0
  2. LICENSE +212 -0
  3. README.md +415 -0
  4. banner.jpg +3 -0
  5. chat_template.jinja +89 -0
  6. config.json +30 -0
  7. generation_config.json +10 -0
  8. merges.txt +0 -0
  9. model.safetensors +3 -0
  10. tokenizer.json +3 -0
  11. tokenizer_config.json +239 -0
  12. vocab.json +0 -0
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.jpg filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar filter=lfs diff=lfs merge=lfs -text
30
+ *.tflite filter=lfs diff=lfs merge=lfs -text
31
+ *.tgz filter=lfs diff=lfs merge=lfs -text
32
+ *.wasm filter=lfs diff=lfs merge=lfs -text
33
+ *.xz filter=lfs diff=lfs merge=lfs -text
34
+ *.zip filter=lfs diff=lfs merge=lfs -text
35
+ *.zst filter=lfs diff=lfs merge=lfs -text
36
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+ ------------------------------------------------------------------------
204
+
205
+ ADDITIONAL TERM
206
+
207
+ In addition to the terms of the Apache License, Version 2.0 above: any
208
+ use, distribution, or integration of this model, whether unmodified or
209
+ as part of a derivative work or product, must continue to identify it
210
+ by its original name, "S1-mini" by "Superwhisper", using that exact
211
+ capitalization, regardless of any other name under which the model or
212
+ a product incorporating it is marketed or distributed.
README.md ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: s1-mini-license
4
+ license_link: LICENSE
5
+ base_model: Qwen/Qwen3-0.6B
6
+ base_model_relation: finetune
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ language:
10
+ - en
11
+ tags:
12
+ - asr
13
+ - text-normalization
14
+ - inverse-text-normalization
15
+ - punctuation
16
+ - truecasing
17
+ - speech-to-text
18
+ - dictation
19
+ - post-processing
20
+ - qwen3
21
+ ---
22
+
23
+ # S1-mini by [Superwhisper](https://superwhisper.com)
24
+
25
+ <div align="center">
26
+ <img src="./banner.jpg" alt="S1-mini banner" width="100%">
27
+
28
+ [![Website](https://img.shields.io/badge/Website-blue?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIi8+PGxpbmUgeDE9IjIiIHkxPSIxMiIgeDI9IjIyIiB5Mj0iMTIiLz48cGF0aCBkPSJNMTIgMmExNS4zIDE1LjMgMCAwIDEgNCAxMCAxNS4zIDE1LjMgMCAwIDEtNCAxMCAxNS4zIDE1LjMgMCAwIDEtNC0xMCAxNS4zIDE1LjMgMCAwIDEgNC0xMHoiLz48L3N2Zz4=)](https://superwhisper.com)
29
+ [![Discord](https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/tF98XvJNvB)
30
+ [![v1](https://img.shields.io/badge/v1-2EA44F?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMC41OSAxMy40MUwxMy40MiAyMC41OGEyIDIgMCAwIDEtMi44MyAwTDIgMTJWMmgxMGw4LjU5IDguNTlhMiAyIDAgMCAxIDAgMi44MnoiLz48bGluZSB4MT0iNyIgeTE9IjciIHgyPSI3LjAxIiB5Mj0iNyIvPjwvc3ZnPg==&logoColor=white)](https://huggingface.co/superwhisper/s1-mini/tree/v1)
31
+ </div>
32
+
33
+ A 0.6B-parameter text normalizer for speech-to-text output. It takes a raw ASR
34
+ transcript and rewrites it as clean written text: fillers removed, false starts
35
+ and self-corrections resolved to the value the speaker landed on, punctuation
36
+ and capitalization applied, and spoken numbers, dates, times, currency and
37
+ email addresses rendered in written form.
38
+
39
+ On a held-out set of 7,519 English cases it reaches 94.8% token accuracy, and
40
+ the quantized build is a 462 MiB file that runs comfortably on a laptop CPU.
41
+
42
+ This is release v1, and it covers English only. S1-mini is not a chat model
43
+ and will not follow general instructions; it does one job, and you steer it
44
+ with a control line at the top of the input.
45
+
46
+ Fine-tuned from [Qwen/Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B). If
47
+ you want to run it in llama.cpp, Ollama, LM Studio, or anything else built on
48
+ llama.cpp, grab the GGUF builds from
49
+ [superwhisper/s1-mini-GGUF](https://huggingface.co/superwhisper/s1-mini-GGUF).
50
+ You can use it in your own dictation app too, just check the license first.
51
+
52
+ Releases are tagged, so you can pin one:
53
+ `from_pretrained("superwhisper/s1-mini", revision="v1")`.
54
+
55
+ ## Model overview
56
+
57
+ | | |
58
+ |---|---|
59
+ | Type | Causal language model, fine-tuned for a single transformation task |
60
+ | Base model | [Qwen/Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B) |
61
+ | Parameters | 596M total (0.44B non-embedding), embeddings tied |
62
+ | Layers | 28 |
63
+ | Attention heads | 16 for Q, 8 for KV (GQA) |
64
+ | Precision | BF16 |
65
+ | Recommended input | Up to ~1,000 tokens; chunk longer transcripts |
66
+ | Language | English |
67
+ | License | Apache 2.0 + naming clause ([LICENSE](LICENSE)) |
68
+
69
+ > [!NOTE]
70
+ > The Hub sidebar reports 0.8B parameters for this repo. `config.json` sets
71
+ > `tie_word_embeddings`, but `model.safetensors` still stores `lm_head.weight`
72
+ > as a materialized copy of the input embedding, so the 155.6M-parameter
73
+ > embedding is counted twice: 751.6M tensor elements against 596.0M unique
74
+ > parameters. The layout is inherited from `Qwen/Qwen3-0.6B`, which reports 0.8B
75
+ > on the Hub for the same reason. The table above counts unique parameters.
76
+
77
+ **Input.** The model expects the system prompt, then a control line, a
78
+ newline, and one raw ASR transcript, which will usually arrive lowercase and
79
+ unpunctuated. That is the shape it was trained on.
80
+
81
+ **Output.** It returns the cleaned transcript as plain text and nothing else,
82
+ with no preamble and no explanation. Under `Structure: lists` the output may
83
+ contain Markdown bullets, and under `Context: email` it may contain blank
84
+ lines separating a greeting, body and sign-off. When the input is nothing but
85
+ filler or noise, the correct output is an empty string, and that is what you
86
+ get.
87
+
88
+ ## Quickstart
89
+
90
+ Qwen3 support landed in `transformers` 4.51.0; with anything older you will
91
+ get `KeyError: 'qwen3'`.
92
+
93
+ ```bash
94
+ pip install "transformers>=4.51.0" torch
95
+ ```
96
+
97
+ ```python
98
+ from transformers import AutoModelForCausalLM, AutoTokenizer
99
+
100
+ MODEL = "superwhisper/s1-mini"
101
+
102
+ tok = AutoTokenizer.from_pretrained(MODEL)
103
+ model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype="auto")
104
+
105
+ # Required. Use this exact system prompt.
106
+ SYSTEM = (
107
+ "You are a text normalizer for speech-to-text transcripts. The input begins "
108
+ "with a control line specifying the styling, structure, and context settings; "
109
+ "clean the transcript to match those settings and output only the cleaned text."
110
+ )
111
+
112
+ def normalize(transcript, styling="semi-formal", structure="prose", context="general"):
113
+ control = f"[Styling: {styling}] [Structure: {structure}] [Context: {context}]"
114
+ messages = [
115
+ {"role": "system", "content": SYSTEM},
116
+ {"role": "user", "content": f"{control}\n{transcript}"},
117
+ ]
118
+ text = tok.apply_chat_template(
119
+ messages,
120
+ tokenize=False,
121
+ add_generation_prompt=True,
122
+ enable_thinking=False, # required, see below
123
+ )
124
+ inputs = tok(text, return_tensors="pt").to(model.device)
125
+ out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
126
+ return tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
127
+
128
+
129
+ raw = "so um i need to like send the the report by uh friday no wait make that thursday"
130
+ print(normalize(raw))
131
+ # I need to send the report by Thursday.
132
+ ```
133
+
134
+ `torch_dtype="auto"` picks up the BF16 in `config.json`. At 0.6B this runs
135
+ comfortably on CPU; add `device_map="auto"` to place it on a GPU automatically
136
+ (requires `accelerate`).
137
+
138
+ ## The control line
139
+
140
+ Every input starts with a control line, then a newline, then the transcript:
141
+
142
+ ```
143
+ [Styling: <value>] [Structure: <value>] [Context: <value>]
144
+ <raw transcript>
145
+ ```
146
+
147
+ | Axis | Values | What it does |
148
+ |---|---|---|
149
+ | `Styling` | `casual`, `semi-casual`, `semi-formal`, `formal` | Sets the register: how much capitalization, apostrophe and contraction cleanup to apply. |
150
+ | `Structure` | `prose`, `lists` | Whether the model may break enumerable content into a bulleted list. It needs at least three items, and anything that isn't really a list stays as prose. |
151
+ | `Context` | `general`, `email` | Destination conventions. `email` turns on greeting-line and sign-off-block layout. |
152
+
153
+ The three axes are independent and every combination was trained.
154
+
155
+ > [!IMPORTANT]
156
+ > The system prompt and the control line are part of the input format the
157
+ > model was trained on. Skip either one, change the system prompt's wording,
158
+ > or send values outside the trained sets, and the model can hallucinate or
159
+ > produce garbled output. Always send both, exactly as shown.
160
+
161
+ ### Styling
162
+
163
+ The register decides how much of the speaker's voice survives into the
164
+ written text.
165
+
166
+ | Value | Behavior |
167
+ |---|---|
168
+ | `casual` | Everything lowercase, apostrophes stripped, colloquialisms kept, final period usually omitted. |
169
+ | `semi-casual` | Keeps the speaker's phrasing. `I` and its contractions are capitalized, sentence starts stay lowercase, final period usually omitted. |
170
+ | `semi-formal` | Standard written English: full capitalization and punctuation, contractions kept, colloquialisms smoothed (`gonna` becomes `going to`). A good default. |
171
+ | `formal` | Like `semi-formal`, with contractions expanded (`I am`, `cannot`). |
172
+
173
+ Here is the same input under all four registers:
174
+
175
+ Input: `hmm im gonna be late theres a cute dog outside i cant just walk past him`
176
+
177
+ | Styling | Output |
178
+ |---|---|
179
+ | `casual` | `hmm im gonna be late. theres a cute dog outside. i cant just walk past him` |
180
+ | `semi-casual` | `hmm, I'm gonna be late. there's a cute dog outside. I can't just walk past him` |
181
+ | `semi-formal` | `I'm going to be late. There's a cute dog outside. I can't just walk past him.` |
182
+ | `formal` | `I am going to be late. There is a cute dog outside. I cannot just walk past him.` |
183
+
184
+ Filled pauses like `um` and `uh` are removed in every register. Apostrophes
185
+ are decided by the register rather than the raw transcript, so the input can
186
+ arrive as `im` or `I'm` and the output comes out the same either way.
187
+
188
+ ### Structure
189
+
190
+ `prose` keeps everything in sentences and paragraphs. `lists` permits the
191
+ model to break enumerable content into Markdown bullets, and it is
192
+ deliberately conservative about it: it wants at least three items, and
193
+ content that is not clearly an enumeration stays as prose. Here is the same
194
+ input under both values:
195
+
196
+ Input: `so for the trip we need to pack sunscreen and then also a first aid kit and um chargers for everything`
197
+
198
+ `Structure: prose`
199
+
200
+ ```
201
+ So for the trip, we need to pack sunscreen and then also a first aid kit and chargers for everything.
202
+ ```
203
+
204
+ `Structure: lists`
205
+
206
+ ```
207
+ So for the trip, we need to pack:
208
+ - Sunscreen
209
+ - A first aid kit
210
+ - Chargers for everything
211
+ ```
212
+
213
+ ### Context
214
+
215
+ `general` produces flowing text, while `email` reshapes the transcript into
216
+ email layout, with a greeting line, the body and a sign-off block separated by
217
+ blank lines. Here is the same input under both values:
218
+
219
+ Input: `hey sarah just wanted to follow up on the proposal can you send the numbers by end of week thanks john`
220
+
221
+ `Context: general`
222
+
223
+ ```
224
+ Hey Sarah, just wanted to follow up on the proposal. Can you send the numbers by end of week? Thanks, John.
225
+ ```
226
+
227
+ `Context: email`
228
+
229
+ ```
230
+ Hey Sarah,
231
+
232
+ Just wanted to follow up on the proposal. Can you send the numbers by end of week?
233
+
234
+ Thanks,
235
+ John
236
+ ```
237
+
238
+ ## Examples
239
+
240
+ All of these were measured on the BF16 weights in this repo with greedy
241
+ decoding, under `[Styling: semi-formal] [Structure: prose] [Context: general]`.
242
+
243
+ | Input | Output |
244
+ |---|---|
245
+ | `so um i need to like send the the report by uh friday no wait make that thursday` | `I need to send the report by Thursday.` |
246
+ | `i think the answer is forty two no sorry forty three` | `I think the answer is 43.` |
247
+ | `let's meet at half past two tomorrow uh actually make it three fifteen p m` | `Let's meet at 3:15pm tomorrow.` |
248
+ | `the invoice came to twenty three thousand four hundred and fifty dollars and it's due on march third twenty twenty six` | `The invoice came to $23,450, and it's due on March 3, 2026.` |
249
+ | `send it to support at superwhisper dot com` | `Send it to support@superwhisper.com.` |
250
+ | `um` | *(empty string)* |
251
+
252
+ ## Set `enable_thinking=False`
253
+
254
+ The chat template comes from Qwen3 unchanged, and Qwen3 turns on thinking mode
255
+ by default. S1-mini was trained with thinking off and has no reasoning traces
256
+ in its training data.
257
+
258
+ > [!WARNING]
259
+ > If you leave the flag out you will usually get **no usable output at all**:
260
+ > the model emits an empty `<think>` block and stops. This is the single most
261
+ > common way to get a blank result from this model.
262
+
263
+ The flag makes the template emit an empty think block before the assistant
264
+ turn. That is the exact prefix the model saw during training. The template
265
+ ships as `chat_template.jinja` in this repo, so `apply_chat_template` picks it
266
+ up with no extra configuration. If you build prompts by hand instead, the
267
+ literal string is:
268
+
269
+ ```
270
+ <|im_start|>system
271
+ You are a text normalizer for speech-to-text transcripts. The input begins with a control line specifying the styling, structure, and context settings; clean the transcript to match those settings and output only the cleaned text.<|im_end|>
272
+ <|im_start|>user
273
+ [Styling: semi-formal] [Structure: prose] [Context: general]
274
+ <raw transcript><|im_end|>
275
+ <|im_start|>assistant
276
+ <think>
277
+
278
+ </think>
279
+
280
+ ```
281
+
282
+ Written out, the assistant prefix is
283
+ `<|im_start|>assistant\n<think>\n\n</think>\n\n`, with two newlines inside the
284
+ think block and two more after it.
285
+
286
+ ## Deployment
287
+
288
+ **vLLM.** Serve normally, then disable thinking per request:
289
+
290
+ ```bash
291
+ vllm serve superwhisper/s1-mini
292
+ ```
293
+
294
+ ```bash
295
+ curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
296
+ "model": "superwhisper/s1-mini",
297
+ "messages": [
298
+ {"role": "system", "content": "You are a text normalizer for speech-to-text transcripts. The input begins with a control line specifying the styling, structure, and context settings; clean the transcript to match those settings and output only the cleaned text."},
299
+ {"role": "user", "content": "[Styling: semi-formal] [Structure: prose] [Context: general]\nso um send the report by uh friday"}
300
+ ],
301
+ "temperature": 0,
302
+ "chat_template_kwargs": {"enable_thinking": false}
303
+ }'
304
+ ```
305
+
306
+ **SGLang.** The same request shape works here, since `chat_template_kwargs`
307
+ is supported on the OpenAI-compatible endpoint.
308
+
309
+ ```bash
310
+ python -m sglang.launch_server --model-path superwhisper/s1-mini
311
+ ```
312
+
313
+ **llama.cpp.** Use the [GGUF
314
+ builds](https://huggingface.co/superwhisper/s1-mini-GGUF). The template must be
315
+ applied with thinking disabled, which means passing `--jinja` together with
316
+ `--chat-template-kwargs`. Don't substitute `--reasoning-budget 0`, which
317
+ suppresses the think block a different way and degrades the output:
318
+
319
+ ```bash
320
+ llama-server -hf superwhisper/s1-mini-GGUF:Q4_K_M --jinja --chat-template-kwargs '{"enable_thinking":false}' --temp 0
321
+ ```
322
+
323
+ **Ollama and LM Studio.** Both work from the GGUF builds, but both inherit
324
+ Qwen3's thinking-on-by-default template. Make sure the assistant turn begins
325
+ with the empty think block shown above, or you will get blank output.
326
+
327
+ ## Best practices
328
+
329
+ 1. **Send the system prompt and the control line, exactly as documented.**
330
+ They are the only steering mechanism, and the model was never trained
331
+ without them.
332
+ 2. **Decode greedily.** `generation_config.json` already ships `do_sample:
333
+ false`, and for good reason: normalization is a deterministic
334
+ transformation, and sampling only adds variance. If you override the
335
+ config, use temperature 0.
336
+ 3. **Size `max_new_tokens` to the input.** Output length closely tracks input
337
+ length; `1.3 × input_tokens + 32` is a safe ceiling, and much cheaper than
338
+ leaving it at 1024.
339
+ 4. **Chunk long transcripts at sentence boundaries.** The model is built for
340
+ dictation-length input; keep single passes under roughly 1,000 tokens.
341
+ 5. **Expect an empty string sometimes.** Filler-only input returns nothing,
342
+ and your pipeline should treat that as a valid result rather than a
343
+ failure.
344
+
345
+ ## Evaluation
346
+
347
+ Evaluated on a held-out English test set of 7,519 cases covering real ASR
348
+ output and synthetic stress sets for numbers, self-corrections, lists, email
349
+ and adversarial inputs: 94.8% token accuracy, measured greedy on the Q4_K_M
350
+ GGUF build. The BF16 weights here should do at least as well.
351
+
352
+ ## Using S1-mini in your own app
353
+
354
+ S1-mini is Apache 2.0 plus a naming clause, the same base license it inherits
355
+ from Qwen3-0.6B, so it can be embedded in open-source and commercial software
356
+ alike: dictation apps,
357
+ meeting-notes tools, live captioning, voice-driven editors, or any pipeline
358
+ that has to turn raw ASR output into text a person will read.
359
+
360
+ It is a post-processing stage rather than a standalone system:
361
+
362
+ ```
363
+ audio ──▶ ASR (Whisper, Parakeet, …) ──▶ S1-mini ──▶ clean text
364
+ ```
365
+
366
+ The ASR's raw transcript becomes the transcript line, your app's settings
367
+ choose the three control-line values, and the model returns text ready to
368
+ display. At 0.6B it is small enough to ship on-device, and the
369
+ [GGUF builds](https://huggingface.co/superwhisper/s1-mini-GGUF) exist for
370
+ exactly that.
371
+
372
+ Nothing about the model is Superwhisper-specific. The two things to get right
373
+ in any integration are the input format documented above and the thinking
374
+ flag; nearly every integration bug traces back to one of those.
375
+
376
+ > [!IMPORTANT]
377
+ > Read the [LICENSE](LICENSE) before you ship. Apache 2.0 is permissive but
378
+ > not obligation-free: you must retain the license text and attribution
379
+ > notices, and state significant changes if you redistribute a modified
380
+ > version. It also carries one additional term: the model must keep its
381
+ > name, "S1-mini" by "Superwhisper", with that exact capitalization,
382
+ > wherever it's used. If you are bundling S1-mini into a commercial
383
+ > dictation app or redistributing the weights yourself, confirm the terms
384
+ > cover your case rather than assuming they do.
385
+
386
+ ## License
387
+
388
+ S1-mini is released under Apache 2.0, which it inherits from Qwen3-0.6B, plus
389
+ one additional term: wherever it's used, it must keep its name, "S1-mini" by
390
+ "Superwhisper", with that exact capitalization. See [LICENSE](LICENSE).
391
+
392
+ ## Citation
393
+
394
+ ```bibtex
395
+ @misc{s1mini2026,
396
+ title = {S1-mini: a small text normalizer for speech-to-text output},
397
+ author = {Superwhisper},
398
+ year = {2026},
399
+ url = {https://huggingface.co/superwhisper/s1-mini}
400
+ }
401
+ ```
402
+
403
+ Built on Qwen3:
404
+
405
+ ```bibtex
406
+ @misc{qwen3technicalreport,
407
+ title = {Qwen3 Technical Report},
408
+ author = {Qwen Team},
409
+ year = {2025},
410
+ eprint = {2505.09388},
411
+ archivePrefix = {arXiv},
412
+ primaryClass = {cs.CL},
413
+ url = {https://arxiv.org/abs/2505.09388}
414
+ }
415
+ ```
banner.jpg ADDED

Git LFS Details

  • SHA256: c17fc850506c928b2213cac6becec3b315fb96c0064b97a25de9be71964c5fbb
  • Pointer size: 131 Bytes
  • Size of remote file: 154 kB
chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- 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>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
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": 151643,
8
+ "eos_token_id": 151645,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 1024,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "max_position_embeddings": 40960,
15
+ "max_window_layers": 28,
16
+ "model_type": "qwen3",
17
+ "num_attention_heads": 16,
18
+ "num_hidden_layers": 28,
19
+ "num_key_value_heads": 8,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_scaling": null,
22
+ "rope_theta": 1000000,
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": 151936
30
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "transformers_version": "4.51.0"
10
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69d2057077ab4dc738aaaab75d2a8ffa141e3a09fb9d956198cfce46f381131a
3
+ size 1503300328
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": 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": "<|endoftext|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "Qwen2Tokenizer",
238
+ "unk_token": null
239
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff