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

FIX: Correctly save a ArgillaTrainer + TRL model with peft_config #3795

Merged
merged 5 commits into from
Sep 28, 2023

Conversation

tomaarsen
Copy link
Contributor

Description

If you pass peft_config to trainer.update_config, then it will currently still save the full (but broken) model with some LoRA (or other PEFT) parts interspersed that can't be loaded again. This is because the self._transformers_model was saved, but that model was the original model (e.g. Llama 2 7b) and not the PEFT model, which is created internally in e.g. the SFTTrainer.

In short, this now saves the actual model and tokenizer used by the underlying trainer, so that if that trainer make any other changes to the model, those changes will be saved too.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested

Created a new test and verified that there's now adapter_model.bin and adapter_config.json files after training.

Checklist

  • I followed the style guidelines of this project
  • I did a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

  • Tom Aarsen

@tomaarsen tomaarsen added type: bug Indicates an unexpected problem or unintended behavior type: integration Indicates integrations with third parties area: trainer Indicates that an issue or pull request is related to the Argilla Trainer labels Sep 20, 2023
@tomaarsen
Copy link
Contributor Author

This also works in my RLHF tutorial.

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

@github-actions
Copy link

The URL of the deployed environment for this PR is https://argilla-quickstart-pr-3795-ki24f765kq-no.a.run.app

@davidberenstein1957 davidberenstein1957 merged commit 4dfa9e2 into develop Sep 28, 2023
@davidberenstein1957 davidberenstein1957 deleted the hotfix/updated_save branch September 28, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: trainer Indicates that an issue or pull request is related to the Argilla Trainer type: bug Indicates an unexpected problem or unintended behavior type: integration Indicates integrations with third parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants