Update tokenizer_config.json
Browse files**Fix: Add `chat_template` to tokenizer config**
Recent versions of `transformers` (v4.44+) no longer allow a default chat template.
The latest model revision removed this field, causing errors in vLLM and Hugging Face preprocessing:
```
ValueError: As of transformers v4.44, default chat template is no longer allowed...
```
**Change**
Restored the previous template in `tokenizer_config.json`:
```json
"chat_template": "{% set system_message = 'You are a helpful assistant.' %}{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<|im_start|>system\\n' + system_message + '<|im_end|>\\n' }}{% endif %}{% for message in messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|im_start|>user\\n' + content + '<|im_end|>\\n<|im_start|>assistant\\n' }}{% elif message['role'] == 'assistant' %}{{ content + '<|im_end|>' + '\\n' }}{% endif %}{% endfor %}"
```
**Result**
* `apply_chat_template` works again
* vLLM `/chat/completions` endpoint runs without error
* Maintains backward compatibility with earlier formatting
- tokenizer_config.json +1 -0
@@ -203,6 +203,7 @@
|
|
203 |
"AutoProcessor": "processing_qwen2_ts.Qwen2TSProcessor"
|
204 |
},
|
205 |
"bos_token": null,
|
|
|
206 |
"clean_up_tokenization_spaces": false,
|
207 |
"eos_token": "<|im_end|>",
|
208 |
"errors": "replace",
|
|
|
203 |
"AutoProcessor": "processing_qwen2_ts.Qwen2TSProcessor"
|
204 |
},
|
205 |
"bos_token": null,
|
206 |
+
"chat_template": "{% set system_message = 'You are a helpful assistant.' %}{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<|im_start|>system\n' + system_message + '<|im_end|>\n' }}{% endif %}{% for message in messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|im_start|>user\n' + content + '<|im_end|>\n<|im_start|>assistant\n' }}{% elif message['role'] == 'assistant' %}{{ content + '<|im_end|>' + '\n' }}{% endif %}{% endfor %}",
|
207 |
"clean_up_tokenization_spaces": false,
|
208 |
"eos_token": "<|im_end|>",
|
209 |
"errors": "replace",
|