-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto_insert_empty_system_msg
config flag
#123
Conversation
Also use the `maybe_insert_system_message` in dpo setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix, this LGTM! I think the small issue about DPO not being 100% consistent with the previous behaviour is fine for now
Co-authored-by: lewtun <[email protected]>
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
A small bug solution, if you encounter AttributeError: 'DataArguments' object has no attribute 'auto_insert_empty_system_msg' |
If you get the attribute error you'll likely just need to update the repo to the newer version. |
Currently there is functionality to automatically insert an empty system message if
system
occur in the Jinja template.alignment-handbook/src/alignment/data.py
Lines 27 to 38 in 87cc800
This is not foolproof method: GEMMA (SFT) for instance has an explicit part in its chat template that says that if the role is "system" that an error must be raised. So this leads to a conflict with the alignment handbook. Therefore I suggest giving all control to the user but doing so in a backwards-compatible manner: by adding a flag that, if True, adds the system message with the same behavior as before, and when False no system message will be added. To this end,
auto_insert_empty_system_msg
is added as a DataArguments argument (defaulting to True).Note that there is one small breaking change: the
maybe_insert_system_message
is currently implemented only for sft, generation and rm, but it was not used for dpo. There, a system message was ALWAYS added if the first message was not system, even if the Jinja template did not mention system. I changed that to be in line with the other tasks so the default behavior will be a litttle bit different when a tokenizer's chat template does not contain 'system' in DPO.