Text Generation
Transformers
Safetensors
qwen3_5_text
dense
coding
agentic
unimodal
repackaged
quantized
compressed-tensors
int4
conversational
Instructions to use Jaidchen/Focus-Red-Int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jaidchen/Focus-Red-Int4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Jaidchen/Focus-Red-Int4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Jaidchen/Focus-Red-Int4") model = AutoModelForCausalLM.from_pretrained("Jaidchen/Focus-Red-Int4", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jaidchen/Focus-Red-Int4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jaidchen/Focus-Red-Int4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jaidchen/Focus-Red-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Jaidchen/Focus-Red-Int4
- SGLang
How to use Jaidchen/Focus-Red-Int4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Jaidchen/Focus-Red-Int4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jaidchen/Focus-Red-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Jaidchen/Focus-Red-Int4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jaidchen/Focus-Red-Int4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Jaidchen/Focus-Red-Int4 with Docker Model Runner:
docker model run hf.co/Jaidchen/Focus-Red-Int4
Add Focus-Red Int4 model
Browse files- .gitattributes +1 -35
- README.md +186 -0
- chat_template.jinja +174 -0
- config.json +1 -0
- configuration.json +1 -0
- generation_config.json +1 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -1,35 +1 @@
|
|
| 1 |
-
*.
|
| 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 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz 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
|
|
|
|
| 1 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE
|
| 5 |
+
base_model: Jaidchen/Focus-Red
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- dense
|
| 9 |
+
- coding
|
| 10 |
+
- agentic
|
| 11 |
+
- unimodal
|
| 12 |
+
- repackaged
|
| 13 |
+
- quantized
|
| 14 |
+
- compressed-tensors
|
| 15 |
+
- int4
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
<center>
|
| 19 |
+
<img style='height: 16em' src='https://cdn-uploads.huggingface.co/production/uploads/63e9a1c4ccae1fe5c622b9f6/zOXMkdhMfeQWxDq6JHj0B.webp'/>
|
| 20 |
+
</center>
|
| 21 |
+
|
| 22 |
+
# Focus-Red-W4
|
| 23 |
+
|
| 24 |
+
4-bit quantization of [Focus-Red](https://huggingface.co/Jaidchen/Focus-Red), itself a text-only repackaging of [Qwen 3.8 27B](https://huggingface.co/Qwen/Qwen3.8-27B).
|
| 25 |
+
|
| 26 |
+
- W4A16, group size 32, asymmetric weights
|
| 27 |
+
- `compressed-tensors` / `pack-quantized` format
|
| 28 |
+
- selected linear-attention projections and `lm_head` remain BF16
|
| 29 |
+
- single `model.safetensors` file
|
| 30 |
+
|
| 31 |
+
## comparison
|
| 32 |
+
|
| 33 |
+
<table>
|
| 34 |
+
<tr>
|
| 35 |
+
<th></th>
|
| 36 |
+
<th>Qwen 3.8 27B</th>
|
| 37 |
+
<th>Focus-Red-W4</th>
|
| 38 |
+
</tr>
|
| 39 |
+
<tr>
|
| 40 |
+
<td>author</td>
|
| 41 |
+
<td><a href='https://huggingface.co/Qwen'>Alibaba Qwen</a></td>
|
| 42 |
+
<td><a href='https://huggingface.co/Jaidchen'>Jaid</a></td>
|
| 43 |
+
</tr>
|
| 44 |
+
<tr>
|
| 45 |
+
<td>repository</td>
|
| 46 |
+
<td><a href='https://huggingface.co/Qwen/Qwen3.8-27B'>Qwen/Qwen3.8-27B</a></td>
|
| 47 |
+
<td><a href='https://huggingface.co/Jaidchen/Focus-Red-W4'>Jaidchen/Focus-Red-W4</a></td>
|
| 48 |
+
</tr>
|
| 49 |
+
<tr>
|
| 50 |
+
<td>architecture</td>
|
| 51 |
+
<td><code>qwen3_5</code></td>
|
| 52 |
+
<td><code>qwen3_5_text</code></td>
|
| 53 |
+
</tr>
|
| 54 |
+
<tr>
|
| 55 |
+
<td>Transformers handler</td>
|
| 56 |
+
<td>
|
| 57 |
+
<a href='https://huggingface.co/docs/transformers/model_doc/qwen3_5#transformers.Qwen3_5ForConditionalGeneration'><code>Qwen3_5ForConditionalGeneration</code></a>
|
| 58 |
+
</td>
|
| 59 |
+
<td>
|
| 60 |
+
<a href='https://huggingface.co/docs/transformers/model_doc/qwen3_5#transformers.Qwen3_5ForCausalLM'><code>Qwen3_5ForCausalLM</code></a>
|
| 61 |
+
</td>
|
| 62 |
+
</tr>
|
| 63 |
+
<tr>
|
| 64 |
+
<td>tensor entries</td>
|
| 65 |
+
<td>1199</td>
|
| 66 |
+
<td>2051</td>
|
| 67 |
+
</tr>
|
| 68 |
+
<tr style='opacity: 50%'>
|
| 69 |
+
<td>tensor type</td>
|
| 70 |
+
<td>bf16</td>
|
| 71 |
+
<td>W4A16 G32 asymmetric + selected BF16</td>
|
| 72 |
+
</tr>
|
| 73 |
+
<tr>
|
| 74 |
+
<td>parameters</td>
|
| 75 |
+
<td>27 781 427 952</td>
|
| 76 |
+
<td>26 895 998 464</td>
|
| 77 |
+
</tr>
|
| 78 |
+
<tr style='opacity: 50%'>
|
| 79 |
+
<td>active</td>
|
| 80 |
+
<td>100%</td>
|
| 81 |
+
<td>100%</td>
|
| 82 |
+
</tr>
|
| 83 |
+
<tr style='opacity: 50%'>
|
| 84 |
+
<td>vocabulary size</td>
|
| 85 |
+
<td>248 320</td>
|
| 86 |
+
<td>248 320</td>
|
| 87 |
+
</tr>
|
| 88 |
+
<tr style='opacity: 50%'>
|
| 89 |
+
<td>context size</td>
|
| 90 |
+
<td>262 144</td>
|
| 91 |
+
<td>262 144</td>
|
| 92 |
+
</tr>
|
| 93 |
+
<tr style='opacity: 50%'>
|
| 94 |
+
<td>MTP</td>
|
| 95 |
+
<td>integrated</td>
|
| 96 |
+
<td>detached → <a href='https://huggingface.co/Jaidchen/Focus-Red-MTP'>Focus-Red-MTP</a></td>
|
| 97 |
+
</tr>
|
| 98 |
+
<tr>
|
| 99 |
+
<td>sampling strategy</td>
|
| 100 |
+
<td>random sampling</td>
|
| 101 |
+
<td>greedy/deterministic</td>
|
| 102 |
+
</tr>
|
| 103 |
+
<tr>
|
| 104 |
+
<td>sampling parameters</td>
|
| 105 |
+
<td>
|
| 106 |
+
<div style='font-family: Jaidevka Code, JetBrains Mono, monospace; line-height: initial'>
|
| 107 |
+
<span style='color: hsl(from currentColor 0 100% l)'>do_sample</span>: <span style='color: hsl(from currentColor 50 80% l)'>true</span><br>
|
| 108 |
+
<span style='color: hsl(from currentColor 0 100% l)'>temperature</span>: <span style='color: hsl(from currentColor 50 80% l)'>1.0</span><br>
|
| 109 |
+
<span style='color: hsl(from currentColor 0 100% l)'>top_k</span>: <span style='color: hsl(from currentColor 50 80% l)'>20</span><br>
|
| 110 |
+
<span style='color: hsl(from currentColor 0 100% l)'>top_p</span>: <span style='color: hsl(from currentColor 50 80% l)'>0.95</span></div>
|
| 111 |
+
</td>
|
| 112 |
+
<td>
|
| 113 |
+
<div style='font-family: Jaidevka Code, JetBrains Mono, monospace; line-height: initial'>
|
| 114 |
+
<span style='color: hsl(from currentColor 0 100% l)'>do_sample</span>: <span style='color: hsl(from currentColor 50 80% l)'>false</span><br>
|
| 115 |
+
<span style='color: hsl(from currentColor 0 100% l)'>temperature</span>: <span style='color: hsl(from currentColor 50 80% l)'>0</span><br>
|
| 116 |
+
<span style='color: hsl(from currentColor 0 100% l)'>top_k</span>: <span style='color: hsl(from currentColor 50 80% l)'>1</span><br>
|
| 117 |
+
<span style='color: hsl(from currentColor 0 100% l)'>top_p</span>: <span style='color: hsl(from currentColor 50 80% l)'>1</span></div>
|
| 118 |
+
</div>
|
| 119 |
+
</td>
|
| 120 |
+
</tr>
|
| 121 |
+
<tr>
|
| 122 |
+
<td>input modality</td>
|
| 123 |
+
<td>text, image, video</td>
|
| 124 |
+
<td>text</td>
|
| 125 |
+
</tr>
|
| 126 |
+
<tr>
|
| 127 |
+
<td>model size</td>
|
| 128 |
+
<td>55 562 855 904</td>
|
| 129 |
+
<td>19 202 352 336 bytes on disk</td>
|
| 130 |
+
</tr>
|
| 131 |
+
<tr>
|
| 132 |
+
<td>splits</td>
|
| 133 |
+
<td>18</td>
|
| 134 |
+
<td>none</td>
|
| 135 |
+
</tr>
|
| 136 |
+
<tr>
|
| 137 |
+
<td>Jinja template</td>
|
| 138 |
+
<td><a href='https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/chat_template.jinja'>Qwen original</a></td>
|
| 139 |
+
<td><a href='https://github.com/jaidlab/focus-chat-template'>focus-chat-template</a> dist build</td>
|
| 140 |
+
</tr>
|
| 141 |
+
</table>
|
| 142 |
+
|
| 143 |
+
## quantization
|
| 144 |
+
|
| 145 |
+
- method: `compressed-tensors`
|
| 146 |
+
- format: `pack-quantized`
|
| 147 |
+
- weights: 4-bit integer, group size 32, asymmetric
|
| 148 |
+
- activations: unquantized / BF16
|
| 149 |
+
- quantization status: `compressed`
|
| 150 |
+
- model file: 19,202,352,336 bytes
|
| 151 |
+
|
| 152 |
+
## pros
|
| 153 |
+
|
| 154 |
+
- reduced storage needs
|
| 155 |
+
- reduced loading time
|
| 156 |
+
- reduced VRAM occupancy, thus more room for context
|
| 157 |
+
- increased inference speed
|
| 158 |
+
- simplified architecture, unlocking some further potential for optimizing low-level procedures
|
| 159 |
+
|
| 160 |
+
## cons
|
| 161 |
+
|
| 162 |
+
- legally blind
|
| 163 |
+
- Pictures and video frames can still be present in the context without crashing, but their contents are no longer interpreted by the model and won’t do anything else than waste space.
|
| 164 |
+
- If you occasionally rely on those capabilities, I suggest adding a `consult` tool to your harness that calls a vision-enabled subagent model like [Gemini Flash](https://openrouter.ai/~google/gemini-flash-latest) or [GPT](https://openrouter.ai/~openai/gpt-latest).
|
| 165 |
+
- reduced compatibility
|
| 166 |
+
- The simplified architecture is handled by the `Qwen3_5ForCausalLM` class which may not be included in your inference engine. In this case you would need to ask your agent or integrate it yourself.
|
| 167 |
+
- Inference engines confirmed to have native support:
|
| 168 |
+
- [SGLang](https://github.com/sgl-project/sglang) ≥ v0.5.17 (PR [#32401](https://github.com/sgl-project/sglang/pull/32401))
|
| 169 |
+
- [vLLM](https://github.com/vllm-project/vllm) ≥ v0.26.0 (PR [#50210](https://github.com/vllm-project/vllm/pull/50210))
|
| 170 |
+
- The applied coercions may confuse your inference engine in case it has fixed expectations about the model’s architecture and thus lead to unpredictable behavior.
|
| 171 |
+
|
| 172 |
+
## caveats
|
| 173 |
+
|
| 174 |
+
- model file not split, possibly causing issues if intended to be stored on an HDD from the previous century
|
| 175 |
+
- random sampling disabled by default, less suitable for long-form writing, entertainment and casual chat
|
| 176 |
+
|
| 177 |
+
## Jinja template
|
| 178 |
+
|
| 179 |
+
This build uses `dist/chat_template.jinja` from [jaidlab/focus-chat-template](https://github.com/jaidlab/focus-chat-template). The template is reproducibly built from Qwen/Qwen3.8-27B's pinned upstream template at commit `1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0` plus the repository's ordered patch stack.
|
| 180 |
+
|
| 181 |
+
- template SHA-256: `5c381ca45e9538c7a2406331b554ee7d62cf3d0b8c115f17687d4fdd5590a239`
|
| 182 |
+
- template size: 9,710 bytes
|
| 183 |
+
|
| 184 |
+
## license
|
| 185 |
+
|
| 186 |
+
Apache 2.0 – inherited from [Qwen 3.8 27B](https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE)
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro render_content(content) %}
|
| 2 |
+
{%- if content is string %}
|
| 3 |
+
{{- content }}
|
| 4 |
+
{%- elif content is iterable and content is not mapping %}
|
| 5 |
+
{%- for item in content %}
|
| 6 |
+
{%- if item is mapping %}
|
| 7 |
+
{%- if ('type' in item and (item.type == 'image' or item.type == 'image_url')) or 'image' in item or 'image_url' in item %}
|
| 8 |
+
{{- '[image]' }}
|
| 9 |
+
{%- elif ('type' in item and item.type == 'video') or 'video' in item %}
|
| 10 |
+
{{- '[video]' }}
|
| 11 |
+
{%- elif 'text' in item %}
|
| 12 |
+
{{- item.text }}
|
| 13 |
+
{%- else %}
|
| 14 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- else %}
|
| 17 |
+
{{- item | string }}
|
| 18 |
+
{%- endif %}
|
| 19 |
+
{%- endfor %}
|
| 20 |
+
{%- elif content is none or content is undefined %}
|
| 21 |
+
{{- '' }}
|
| 22 |
+
{%- else %}
|
| 23 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 24 |
+
{%- endif %}
|
| 25 |
+
{%- endmacro %}
|
| 26 |
+
{%- if not messages %}
|
| 27 |
+
{{- raise_exception('No messages provided.') }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- set reasoning_instructions = '' %}
|
| 30 |
+
{%- if enable_thinking is undefined or enable_thinking is true %}
|
| 31 |
+
{%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}
|
| 32 |
+
{%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}
|
| 33 |
+
{{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- if resolved_reasoning_effort == 'xhigh' %}
|
| 36 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
|
| 37 |
+
{%- elif resolved_reasoning_effort == 'low' %}
|
| 38 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- set _preserve_thinking = preserve_thinking if preserve_thinking is defined else true %}
|
| 42 |
+
{%- set leading = namespace(active=true, count=0, content='') %}
|
| 43 |
+
{%- for message in messages %}
|
| 44 |
+
{%- if leading.active and (message.role == 'system' or message.role == 'developer') %}
|
| 45 |
+
{%- set rendered = render_content(message.content) | trim %}
|
| 46 |
+
{%- if rendered %}
|
| 47 |
+
{%- if leading.content %}
|
| 48 |
+
{%- set leading.content = leading.content + '\n' + rendered %}
|
| 49 |
+
{%- else %}
|
| 50 |
+
{%- set leading.content = rendered %}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- set leading.count = leading.count + 1 %}
|
| 54 |
+
{%- else %}
|
| 55 |
+
{%- set leading.active = false %}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
{%- endfor %}
|
| 58 |
+
{%- set _has_tools = tools is defined and tools and tools is iterable and tools is not mapping %}
|
| 59 |
+
{%- if _has_tools %}
|
| 60 |
+
{{- '<|im_start|>system\n' }}
|
| 61 |
+
{%- if reasoning_instructions %}
|
| 62 |
+
{{- reasoning_instructions + '\n\n' }}
|
| 63 |
+
{%- endif %}
|
| 64 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 65 |
+
{%- for tool in tools %}
|
| 66 |
+
{{- "\n" }}
|
| 67 |
+
{{- tool | tojson }}
|
| 68 |
+
{%- endfor %}
|
| 69 |
+
{{- "\n</tools>" }}
|
| 70 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 71 |
+
{%- if leading.content %}
|
| 72 |
+
{{- '\n\n' + leading.content }}
|
| 73 |
+
{%- endif %}
|
| 74 |
+
{{- '<|im_end|>\n' }}
|
| 75 |
+
{%- else %}
|
| 76 |
+
{%- if leading.content %}
|
| 77 |
+
{{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + leading.content + '<|im_end|>\n' }}
|
| 78 |
+
{%- elif reasoning_instructions %}
|
| 79 |
+
{{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 83 |
+
{%- for message in messages[::-1] %}
|
| 84 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 85 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 86 |
+
{%- set content = render_content(message.content)|trim %}
|
| 87 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 88 |
+
{%- set ns.multi_step_tool = false %}
|
| 89 |
+
{%- set ns.last_query_index = index %}
|
| 90 |
+
{%- endif %}
|
| 91 |
+
{%- endif %}
|
| 92 |
+
{%- endfor %}
|
| 93 |
+
{%- for message in messages %}
|
| 94 |
+
{%- set content = render_content(message.content) | trim %}
|
| 95 |
+
{%- if loop.index0 < leading.count %}
|
| 96 |
+
{%- elif message.role == 'system' or message.role == 'developer' %}
|
| 97 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 98 |
+
{%- elif message.role == 'user' %}
|
| 99 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 100 |
+
{%- elif message.role == "assistant" %}
|
| 101 |
+
{%- set reasoning_content = '' %}
|
| 102 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is string %}
|
| 103 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 104 |
+
{%- elif message.thinking is defined and message.thinking is string %}
|
| 105 |
+
{%- set reasoning_content = message.thinking %}
|
| 106 |
+
{%- elif content.startswith('</think>') %}
|
| 107 |
+
{%- set content = (content.split('</think>')[1:] | join('</think>')).lstrip('\n') %}
|
| 108 |
+
{%- elif '\n</think>' in content %}
|
| 109 |
+
{%- set reasoning_content = content.split('\n</think>')[0] %}
|
| 110 |
+
{%- if reasoning_content.startswith('<think>\n') %}
|
| 111 |
+
{%- set reasoning_content = reasoning_content[8:] %}
|
| 112 |
+
{%- elif reasoning_content.startswith('<think>') %}
|
| 113 |
+
{%- set reasoning_content = reasoning_content[7:].lstrip('\n') %}
|
| 114 |
+
{%- endif %}
|
| 115 |
+
{%- set content = (content.split('\n</think>')[1:] | join('\n</think>')).lstrip('\n') %}
|
| 116 |
+
{%- endif %}
|
| 117 |
+
{%- set reasoning_content = reasoning_content | trim %}
|
| 118 |
+
{%- if reasoning_content and (_preserve_thinking or loop.index0 > ns.last_query_index) %}
|
| 119 |
+
{{- '<|im_start|>assistant\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 120 |
+
{%- else %}
|
| 121 |
+
{{- '<|im_start|>assistant\n' + content }}
|
| 122 |
+
{%- endif %}
|
| 123 |
+
{%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 124 |
+
{%- for tool_call in message.tool_calls %}
|
| 125 |
+
{%- set call = tool_call.function if tool_call.function is defined and tool_call.function is not none else tool_call %}
|
| 126 |
+
{%- if loop.first %}
|
| 127 |
+
{%- if content | trim %}
|
| 128 |
+
{{- '\n\n<tool_call>\n<function=' + call.name + '>\n' }}
|
| 129 |
+
{%- else %}
|
| 130 |
+
{{- '<tool_call>\n<function=' + call.name + '>\n' }}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{%- else %}
|
| 133 |
+
{{- '\n<tool_call>\n<function=' + call.name + '>\n' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{%- if call.arguments is defined and call.arguments is mapping %}
|
| 136 |
+
{%- for args_name in call.arguments %}
|
| 137 |
+
{%- set args_value = call.arguments[args_name] %}
|
| 138 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 139 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 140 |
+
{{- args_value }}
|
| 141 |
+
{{- '\n</parameter>\n' }}
|
| 142 |
+
{%- endfor %}
|
| 143 |
+
{%- elif call.arguments is defined and call.arguments is string and call.arguments %}
|
| 144 |
+
{{- call.arguments }}
|
| 145 |
+
{{- '\n' }}
|
| 146 |
+
{%- endif %}
|
| 147 |
+
{{- '</function>\n</tool_call>' }}
|
| 148 |
+
{%- endfor %}
|
| 149 |
+
{%- endif %}
|
| 150 |
+
{%- if not (loop.last and continue_final_message is defined and continue_final_message) %}
|
| 151 |
+
{{- '<|im_end|>\n' }}
|
| 152 |
+
{%- endif %}
|
| 153 |
+
{%- elif message.role == 'tool' %}
|
| 154 |
+
{%- set previous_role = messages[loop.index0 - 1].role if loop.index0 > 0 else '' %}
|
| 155 |
+
{%- if previous_role != 'tool' %}
|
| 156 |
+
{{- '<|im_start|>user' }}
|
| 157 |
+
{%- endif %}
|
| 158 |
+
{{- '\n<tool_response>\n' + content + '\n</tool_response>' }}
|
| 159 |
+
{%- set next_role = messages[loop.index0 + 1].role if not loop.last else '' %}
|
| 160 |
+
{%- if loop.last or next_role != 'tool' %}
|
| 161 |
+
{{- '<|im_end|>\n' }}
|
| 162 |
+
{%- endif %}
|
| 163 |
+
{%- else %}
|
| 164 |
+
{{- raise_exception('Unexpected message role: ' + message.role) }}
|
| 165 |
+
{%- endif %}
|
| 166 |
+
{%- endfor %}
|
| 167 |
+
{%- if add_generation_prompt %}
|
| 168 |
+
{{- '<|im_start|>assistant\n' }}
|
| 169 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 170 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 171 |
+
{%- else %}
|
| 172 |
+
{{- '<think>\n' }}
|
| 173 |
+
{%- endif %}
|
| 174 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"attention_bias":false,"attention_dropout":0,"attn_output_gate":true,"bos_token_id":248044,"dtype":"bfloat16","eos_token_id":248044,"full_attention_interval":4,"head_dim":256,"hidden_act":"silu","hidden_size":5120,"initializer_range":0.02,"intermediate_size":17408,"layer_types":["linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention","linear_attention","linear_attention","linear_attention","full_attention"],"linear_conv_kernel_dim":4,"linear_key_head_dim":128,"linear_num_key_heads":16,"linear_num_value_heads":48,"linear_value_head_dim":128,"mamba_ssm_dtype":"float32","max_position_embeddings":262144,"model_type":"qwen3_5_text","num_attention_heads":24,"num_hidden_layers":64,"num_key_value_heads":4,"output_gate_type":"swish","pad_token_id":null,"partial_rotary_factor":0.25,"rms_norm_eps":0.000001,"rope_parameters":{"mrope_interleaved":true,"mrope_section":[11,11,10],"partial_rotary_factor":0.25,"rope_theta":10000000,"rope_type":"default"},"tie_word_embeddings":false,"use_cache":true,"vocab_size":248320,"architectures":["Qwen3_5ForCausalLM"],"transformers_version":"5.8.0.dev0","quantization_config":{"config_groups":{"group_0":{"format":"pack-quantized","input_activations":null,"output_activations":null,"targets":["Linear"],"weights":{"actorder":null,"block_structure":null,"dynamic":false,"group_size":32,"num_bits":4,"observer":"mse","observer_kwargs":{},"scale_dtype":null,"strategy":"group","symmetric":false,"type":"int","zp_dtype":"torch.int8"}}},"format":"pack-quantized","global_compression_ratio":null,"ignore":["model.layers.0.linear_attn.in_proj_a","model.layers.0.linear_attn.in_proj_b","model.layers.1.linear_attn.in_proj_a","model.layers.1.linear_attn.in_proj_b","model.layers.10.linear_attn.in_proj_a","model.layers.10.linear_attn.in_proj_b","model.layers.12.linear_attn.in_proj_a","model.layers.12.linear_attn.in_proj_b","model.layers.13.linear_attn.in_proj_a","model.layers.13.linear_attn.in_proj_b","model.layers.14.linear_attn.in_proj_a","model.layers.14.linear_attn.in_proj_b","model.layers.16.linear_attn.in_proj_a","model.layers.16.linear_attn.in_proj_b","model.layers.17.linear_attn.in_proj_a","model.layers.17.linear_attn.in_proj_b","model.layers.18.linear_attn.in_proj_a","model.layers.18.linear_attn.in_proj_b","model.layers.2.linear_attn.in_proj_a","model.layers.2.linear_attn.in_proj_b","model.layers.20.linear_attn.in_proj_a","model.layers.20.linear_attn.in_proj_b","model.layers.21.linear_attn.in_proj_a","model.layers.21.linear_attn.in_proj_b","model.layers.22.linear_attn.in_proj_a","model.layers.22.linear_attn.in_proj_b","model.layers.24.linear_attn.in_proj_a","model.layers.24.linear_attn.in_proj_b","model.layers.25.linear_attn.in_proj_a","model.layers.25.linear_attn.in_proj_b","model.layers.26.linear_attn.in_proj_a","model.layers.26.linear_attn.in_proj_b","model.layers.28.linear_attn.in_proj_a","model.layers.28.linear_attn.in_proj_b","model.layers.29.linear_attn.in_proj_a","model.layers.29.linear_attn.in_proj_b","model.layers.30.linear_attn.in_proj_a","model.layers.30.linear_attn.in_proj_b","model.layers.32.linear_attn.in_proj_a","model.layers.32.linear_attn.in_proj_b","model.layers.33.linear_attn.in_proj_a","model.layers.33.linear_attn.in_proj_b","model.layers.34.linear_attn.in_proj_a","model.layers.34.linear_attn.in_proj_b","model.layers.36.linear_attn.in_proj_a","model.layers.36.linear_attn.in_proj_b","model.layers.37.linear_attn.in_proj_a","model.layers.37.linear_attn.in_proj_b","model.layers.38.linear_attn.in_proj_a","model.layers.38.linear_attn.in_proj_b","model.layers.4.linear_attn.in_proj_a","model.layers.4.linear_attn.in_proj_b","model.layers.40.linear_attn.in_proj_a","model.layers.40.linear_attn.in_proj_b","model.layers.41.linear_attn.in_proj_a","model.layers.41.linear_attn.in_proj_b","model.layers.42.linear_attn.in_proj_a","model.layers.42.linear_attn.in_proj_b","model.layers.44.linear_attn.in_proj_a","model.layers.44.linear_attn.in_proj_b","model.layers.45.linear_attn.in_proj_a","model.layers.45.linear_attn.in_proj_b","model.layers.46.linear_attn.in_proj_a","model.layers.46.linear_attn.in_proj_b","model.layers.48.linear_attn.in_proj_a","model.layers.48.linear_attn.in_proj_b","model.layers.49.linear_attn.in_proj_a","model.layers.49.linear_attn.in_proj_b","model.layers.5.linear_attn.in_proj_a","model.layers.5.linear_attn.in_proj_b","model.layers.50.linear_attn.in_proj_a","model.layers.50.linear_attn.in_proj_b","model.layers.52.linear_attn.in_proj_a","model.layers.52.linear_attn.in_proj_b","model.layers.53.linear_attn.in_proj_a","model.layers.53.linear_attn.in_proj_b","model.layers.54.linear_attn.in_proj_a","model.layers.54.linear_attn.in_proj_b","model.layers.56.linear_attn.in_proj_a","model.layers.56.linear_attn.in_proj_b","model.layers.57.linear_attn.in_proj_a","model.layers.57.linear_attn.in_proj_b","model.layers.58.linear_attn.in_proj_a","model.layers.58.linear_attn.in_proj_b","model.layers.6.linear_attn.in_proj_a","model.layers.6.linear_attn.in_proj_b","model.layers.60.linear_attn.in_proj_a","model.layers.60.linear_attn.in_proj_b","model.layers.61.linear_attn.in_proj_a","model.layers.61.linear_attn.in_proj_b","model.layers.62.linear_attn.in_proj_a","model.layers.62.linear_attn.in_proj_b","model.layers.8.linear_attn.in_proj_a","model.layers.8.linear_attn.in_proj_b","model.layers.9.linear_attn.in_proj_a","model.layers.9.linear_attn.in_proj_b","lm_head"],"kv_cache_scheme":null,"quant_method":"compressed-tensors","quantization_status":"compressed","sparsity_config":{},"transform_config":{},"version":"0.18.0"}}
|
configuration.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"framework":"Pytorch","task":"text-generation"}
|
generation_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token_id":248044,"do_sample":false,"eos_token_id":[248046,248044],"pad_token_id":248044}
|
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:1db6c0a56ecdd5842b2620f59b9d48c3a6e235f2c8e99c3c39edc214e1e553f6
|
| 3 |
+
size 19202352336
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"add_prefix_space":false,"added_tokens_decoder":{"248044":{"content":"<|endoftext|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248045":{"content":"<|im_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248046":{"content":"<|im_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248047":{"content":"<|object_ref_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248048":{"content":"<|object_ref_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248049":{"content":"<|box_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248050":{"content":"<|box_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248051":{"content":"<|quad_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248052":{"content":"<|quad_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248053":{"content":"<|vision_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248054":{"content":"<|vision_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248055":{"content":"<|vision_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248056":{"content":"<|image_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248057":{"content":"<|video_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248058":{"content":"<tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248059":{"content":"</tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248060":{"content":"<|fim_prefix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248061":{"content":"<|fim_middle|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248062":{"content":"<|fim_suffix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248063":{"content":"<|fim_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248064":{"content":"<|repo_name|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248065":{"content":"<|file_sep|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248066":{"content":"<tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248067":{"content":"</tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248068":{"content":"<think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248069":{"content":"</think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248070":{"content":"<|audio_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248071":{"content":"<|audio_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248072":{"content":"<tts_pad>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248073":{"content":"<tts_text_bos>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248074":{"content":"<tts_text_eod>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248075":{"content":"<tts_text_bos_single>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248076":{"content":"<|audio_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true}},"additional_special_tokens":["<|im_start|>","<|im_end|>","<|object_ref_start|>","<|object_ref_end|>","<|box_start|>","<|box_end|>","<|quad_start|>","<|quad_end|>","<|vision_start|>","<|vision_end|>","<|vision_pad|>","<|image_pad|>","<|video_pad|>"],"bos_token":null,"chat_template":"{%- macro render_content(content) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if item is mapping %}\n {%- if ('type' in item and (item.type == 'image' or item.type == 'image_url')) or 'image' in item or 'image_url' in item %}\n {{- '[image]' }}\n {%- elif ('type' in item and item.type == 'video') or 'video' in item %}\n {{- '[video]' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- else %}\n {{- item | string }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set reasoning_instructions = '' %}\n{%- if enable_thinking is undefined or enable_thinking is true %}\n {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}\n {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}\n {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}\n {%- endif %}\n {%- if resolved_reasoning_effort == 'xhigh' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}\n {%- elif resolved_reasoning_effort == 'low' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}\n {%- endif %}\n{%- endif %}\n{%- set _preserve_thinking = preserve_thinking if preserve_thinking is defined else true %}\n{%- set leading = namespace(active=true, count=0, content='') %}\n{%- for message in messages %}\n {%- if leading.active and (message.role == 'system' or message.role == 'developer') %}\n {%- set rendered = render_content(message.content) | trim %}\n {%- if rendered %}\n {%- if leading.content %}\n {%- set leading.content = leading.content + '\\n' + rendered %}\n {%- else %}\n {%- set leading.content = rendered %}\n {%- endif %}\n {%- endif %}\n {%- set leading.count = leading.count + 1 %}\n {%- else %}\n {%- set leading.active = false %}\n {%- endif %}\n{%- endfor %}\n{%- set _has_tools = tools is defined and tools and tools is iterable and tools is not mapping %}\n{%- if _has_tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if reasoning_instructions %}\n {{- reasoning_instructions + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if leading.content %}\n {{- '\\n\\n' + leading.content }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if leading.content %}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + leading.content + '<|im_end|>\\n' }}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|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\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- set content = render_content(message.content) | trim %}\n {%- if loop.index0 < leading.count %}\n {%- elif message.role == 'system' or message.role == 'developer' %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- elif message.role == 'user' %}\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 defined and message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- elif message.thinking is defined and message.thinking is string %}\n {%- set reasoning_content = message.thinking %}\n {%- elif content.startswith('</think>') %}\n {%- set content = (content.split('</think>')[1:] | join('</think>')).lstrip('\\n') %}\n {%- elif '\\n</think>' in content %}\n {%- set reasoning_content = content.split('\\n</think>')[0] %}\n {%- if reasoning_content.startswith('<think>\\n') %}\n {%- set reasoning_content = reasoning_content[8:] %}\n {%- elif reasoning_content.startswith('<think>') %}\n {%- set reasoning_content = reasoning_content[7:].lstrip('\\n') %}\n {%- endif %}\n {%- set content = (content.split('\\n</think>')[1:] | join('\\n</think>')).lstrip('\\n') %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content | trim %}\n {%- if reasoning_content and (_preserve_thinking or loop.index0 > ns.last_query_index) %}\n {{- '<|im_start|>assistant\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>assistant\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- set call = tool_call.function if tool_call.function is defined and tool_call.function is not none else tool_call %}\n {%- if loop.first %}\n {%- if content | trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- if call.arguments is defined and call.arguments is mapping %}\n {%- for args_name in call.arguments %}\n {%- set args_value = call.arguments[args_name] %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- elif call.arguments is defined and call.arguments is string and call.arguments %}\n {{- call.arguments }}\n {{- '\\n' }}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {%- if not (loop.last and continue_final_message is defined and continue_final_message) %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- elif message.role == 'tool' %}\n {%- set previous_role = messages[loop.index0 - 1].role if loop.index0 > 0 else '' %}\n {%- if previous_role != 'tool' %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' + content + '\\n</tool_response>' }}\n {%- set next_role = messages[loop.index0 + 1].role if not loop.last else '' %}\n {%- if loop.last or next_role != 'tool' %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role: ' + message.role) }}\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 {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}","clean_up_tokenization_spaces":false,"eos_token":"<|im_end|>","errors":"replace","model_max_length":262144,"pad_token":"<|endoftext|>","split_special_tokens":false,"tokenizer_class":"Qwen2Tokenizer","unk_token":null,"add_bos_token":false,"pretokenize_regex":"(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+","extra_special_tokens":{"audio_bos_token":"<|audio_start|>","audio_eos_token":"<|audio_end|>","audio_token":"<|audio_pad|>","image_token":"<|image_pad|>","video_token":"<|video_pad|>","vision_bos_token":"<|vision_start|>","vision_eos_token":"<|vision_end|>"}}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|