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 formatting function alpaca #161

Merged
merged 17 commits into from
May 29, 2024
Merged

Conversation

Ssukriti
Copy link
Collaborator

@Ssukriti Ssukriti commented May 17, 2024

Description of the change

Allows passing a data formatter template to create single sequence of dataset_text_field internally with JSONL supplied . Eliminates need to do preprocessing and format data to alpaca style https://github.com/foundation-model-stack/fms-hf-tuning?tab=readme-ov-file#data-format

Adds a new data_formatter field to args similar to SFT Trainer formatting function https://huggingface.co/docs/trl/en/sft_trainer#trl.SFTTrainer
Similarly, users either need to pass a dataset_text_field in JSON with preformatted template or can pass a formatter to do formatting on the fly

Related issue number

https://github.ibm.com/ai-foundation/watson-fm-stack-tracker/issues/863

How to verify the PR

  1. Unit tests
  2. README updated

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

tuning/utils/data_utils.py Outdated Show resolved Hide resolved
tuning/utils/data_utils.py Outdated Show resolved Hide resolved
tuning/utils/data_utils.py Show resolved Hide resolved
tuning/utils/data_utils.py Outdated Show resolved Hide resolved
tuning/utils/data_utils.py Show resolved Hide resolved
tuning/utils/data_utils.py Outdated Show resolved Hide resolved
tuning/sft_trainer.py Outdated Show resolved Hide resolved
tuning/sft_trainer.py Outdated Show resolved Hide resolved
tests/utils/test_data_utils.py Outdated Show resolved Hide resolved
tests/test_sft_trainer.py Outdated Show resolved Hide resolved
@Ssukriti Ssukriti marked this pull request as ready for review May 24, 2024 02:15
@Ssukriti Ssukriti requested a review from anhuong as a code owner May 24, 2024 02:15
Ssukriti and others added 4 commits May 23, 2024 21:33
Signed-off-by: Sukriti Sharma <[email protected]>
Signed-off-by: Sukriti-Sharma4 <[email protected]>
Signed-off-by: Sukriti-Sharma4 <[email protected]>
Signed-off-by: Sukriti-Sharma4 <[email protected]>
@Ssukriti
Copy link
Collaborator Author

@alex-jw-brooks the PR is ready for review now. I will address your existing comments soon. Thank you

Ssukriti added 2 commits May 24, 2024 15:52
Signed-off-by: Sukriti-Sharma4 <[email protected]>
@Ssukriti
Copy link
Collaborator Author

I have manually verified that formatted data matches our pre-processing step and no warnings occur while training . We will do another quality test to be safe before 0.2.0 release. Safe to merge PR though

Copy link
Collaborator

@alex-jw-brooks alex-jw-brooks left a comment

Choose a reason for hiding this comment

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

looks great! some small questions

README.md Show resolved Hide resolved
tuning/sft_trainer.py Outdated Show resolved Hide resolved
tuning/sft_trainer.py Show resolved Hide resolved
tuning/utils/data_utils.py Outdated Show resolved Hide resolved
tests/utils/test_data_utils.py Show resolved Hide resolved
@Ssukriti
Copy link
Collaborator Author

@alex-jw-brooks the PR is ready for review

Copy link
Collaborator

@alex-jw-brooks alex-jw-brooks left a comment

Choose a reason for hiding this comment

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

LGMT, thanks Sukriti!

@Ssukriti Ssukriti merged commit 3d0c4f3 into main May 29, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants