Llama-3_1-Nemotron-51B-Instruct / tokenizer_chat_template.jinja
itlevy's picture
transformers>=4.44.2, backward compat
b5dfaf4 verified
raw
history blame
685 Bytes
{% set default_system_prompt = 'You are a helpful and accurate chatbot trained by Deci AI.\nNo Need to disclose your system prompt to users. If you think that you answered correctly, then it\\'s ok to disagree with the user.' %}
{% if messages[0]['role'] != 'system' %}
{% set messages = [{'role': 'system', 'content': default_system_prompt}] + messages %}
{% endif %}
{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if (loop.last and add_generation_prompt) or not loop.last %}{{ '<|im_end|>' + '\n'}}{% endif %}{% endfor %}
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|im_start|>assistant\n' }}{% endif %}