Closed dctanner closed 4 months ago
This PR should alleviate the issue. #123 By disabling auto_insert_empty_system_msg
, the system message should not be auto inserted. So the argument would be something like --no_auto_insert_empty_system_msg
.
Since #123 has been merged, this can be closed I think @dctanner
Some models include a chat template that inserts a default system message. E.g:
{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = 'You are a helpful assistant.' %}{% endif %}{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in loop_messages %}{% if loop.index0 == 0 %}{{'<|im_start|>system\n' + system_message + '<|im_end|>\n'}}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}
The problem is that this causes the system message to be included into the chosen and rejected samples. E.g:
Another issue is that the current logic to insert a system message into the prompt if it's missing, overwrites the default system message that is set using a chat template like the one above.