Upload tokenizer_config.json
Browse filesThe current chat_template adds an extra EOS token when `add_generation_prompt=False`.
Please replace it with the correct chat_template to fix this behavior.
```
from transformers import AutoTokenizer
message = [{"role": "user" , "content": 'How are you?'}]
tame_tokenizer = AutoTokenizer.from_pretrained('yentinglin/Llama-3-Taiwan-70B-Instruct')
tame_tokenizer.apply_chat_template(message , tokenize=False,add_generation_prompt=False)
```
You can see an extra EOS token in the output :
```
<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHow are you?<|eot_id|><|eot_id|>
```
- tokenizer_config.json +1 -2
tokenizer_config.json
CHANGED
@@ -2050,7 +2050,7 @@
|
|
2050 |
}
|
2051 |
},
|
2052 |
"bos_token": "<|begin_of_text|>",
|
2053 |
-
"chat_template": "{%
|
2054 |
"clean_up_tokenization_spaces": true,
|
2055 |
"eos_token": "<|eot_id|>",
|
2056 |
"model_input_names": [
|
@@ -2058,6 +2058,5 @@
|
|
2058 |
"attention_mask"
|
2059 |
],
|
2060 |
"model_max_length": 1000000000000000019884624838656,
|
2061 |
-
"pad_token": "<|end_of_text|>",
|
2062 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
2063 |
}
|
|
|
2050 |
}
|
2051 |
},
|
2052 |
"bos_token": "<|begin_of_text|>",
|
2053 |
+
"chat_template": "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}",
|
2054 |
"clean_up_tokenization_spaces": true,
|
2055 |
"eos_token": "<|eot_id|>",
|
2056 |
"model_input_names": [
|
|
|
2058 |
"attention_mask"
|
2059 |
],
|
2060 |
"model_max_length": 1000000000000000019884624838656,
|
|
|
2061 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
2062 |
}
|