Skip to content

Commit

Permalink
Fix embarrassing typo in the doc chat template! (huggingface#26596)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocketknight1 authored Oct 4, 2023
1 parent 9deb18c commit 8b03615
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/en/chat_templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ If you like this one, here it is in one-liner form, ready to copy into your code
handy support for "generation prompts" - see the next section for more!

```
tokenizer.chat_template = "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %})"
tokenizer.chat_template = "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
```

This template wraps each message in `<|im_start|>` and `<|im_end|>` tokens, and simply writes the role as a string, which
Expand Down

0 comments on commit 8b03615

Please sign in to comment.