Xenova HF staff commited on
Commit
8840764
1 Parent(s): 50cba23

Fix invalid characters in template

Browse files

```py
from transformers import AutoTokenizer

EXAMPLE_CHAT = [
{ "role": "user", "content": "Hello, how are you?" },
{ "role": "assistant", "content": "I'm doing great. How can I help you today?" },
{ "role": "user", "content": "I'd like to show off how chat templating works!" },
];

tokenizer = AutoTokenizer.from_pretrained("YokaiKoibito/llama2_70b_chat_uncensored-fp16")
prompt=tokenizer.apply_chat_template(EXAMPLE_CHAT, tokenize=False)
```
results in
```
TemplateSyntaxError: unexpected char '‘' at 246
```

This PR should fix that.

Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -9,7 +9,7 @@
9
  "rstrip": false,
10
  "single_word": false
11
  },
12
- "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ ‘### HUMAN:\\n + message['content'] + ‘\\n\\n }}{% elif message['role'] == 'assistant' %}{{ ‘### RESPONSE:\\n + message['content'] + eos_token + ‘\\n\\n' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}{{ ‘### RESPONSE:\\n }}",
13
  "clean_up_tokenization_spaces": false,
14
  "eos_token": {
15
  "__type": "AddedToken",
 
9
  "rstrip": false,
10
  "single_word": false
11
  },
12
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '### HUMAN:\\n' + message['content'] + '\\n\\n' }}{% elif message['role'] == 'assistant' %}{{ '### RESPONSE:\\n' + message['content'] + eos_token + '\\n\\n' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}{{ '### RESPONSE:\\n' }}",
13
  "clean_up_tokenization_spaces": false,
14
  "eos_token": {
15
  "__type": "AddedToken",