Join the conversation

Join the community of Machine Learners and AI enthusiasts.

Sign Up
nroggendorff 
posted an update Jul 16
Post
552
What could have been

"{{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' %}{{ '<|user|>\n' + message['content'] + '<|end|>\n' }}{% elif message['role'] == 'assistant' %}{{ '<|bot|>\n' + message['content'] }}{% if loop.last %}{{ '<|end|>' + eos_token }}{% else %}{{ '<|end|>\n' }}{% endif %}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}"

lovers.png