Skip to content
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 example YAML file for training Mistral using DPO #2029

Merged
merged 8 commits into from
Nov 13, 2024

Conversation

olivermolenschot
Copy link
Contributor

Description

I provided a YAML file that can be used as an example to perform DPO on a mistral model, using open source datasets and open source models.

Motivation and Context

This is required as the chat template used originally in a Mistral 7B model does not allow for us to regularly perform DPO on the model. The original chat template enforces iterating between user and assistant. However in the chosen and rejected columns of DPO, we only have an assistant turn. For reference, the original chat template can be found in this file. I gave an example where I use the chatml template instead and introduced the respective special tokens, which allows for training.

How has this been tested?

I ran the yaml file locally and trained the model. I merged the model and then tested if the model produced outputs and was successfully using the new special tokens. The whole testing environment is a regular conda environment with axolotl and its dependencies. My changes do not affect other areas of the code since it is a yaml file.

Screenshots (if appropriate)

Types of changes

None

Social Handles (Optional)

Copy link
Collaborator

@NanoCode012 NanoCode012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the PR. I listed a few small points in this yaml that stood out

examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo.yml Outdated Show resolved Hide resolved
olivermolenschot and others added 4 commits November 11, 2024 11:46
Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>
Adding qlora and removing role-related data (unecessary)
@olivermolenschot
Copy link
Contributor Author

I think I addressed all your concerns @NanoCode012. Let me know if there is anything else :)

Copy link
Collaborator

@NanoCode012 NanoCode012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two more tiny nitpicks, and it looks good to go!

examples/mistral/mistral-dpo-qlora.yml Outdated Show resolved Hide resolved
examples/mistral/mistral-dpo-qlora.yml Outdated Show resolved Hide resolved
olivermolenschot and others added 2 commits November 11, 2024 22:32
Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>
@olivermolenschot
Copy link
Contributor Author

Cool, I commited your comments @NanoCode012

@NanoCode012
Copy link
Collaborator

Thank you very much for the PR!

@olivermolenschot
Copy link
Contributor Author

You're welcome! Glad to help.

@winglian winglian merged commit a4b1cc6 into axolotl-ai-cloud:main Nov 13, 2024
1 check passed
bursteratom pushed a commit that referenced this pull request Nov 18, 2024
* Add example YAML file for training Mistral using DPO

* chore: lint

* Apply suggestions from code review

Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>

* Update mistral-dpo.yml 

Adding qlora and removing role-related data (unecessary)

* Rename mistral-dpo.yml to mistral-dpo-qlora.yml

* Apply suggestions from code review

Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>

---------

Co-authored-by: Wing Lian <wing.lian@gmail.com>
Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants