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 PEFT support for PPOTrainer #2344

Merged
merged 14 commits into from
Nov 18, 2024

Conversation

ccs96307
Copy link
Contributor

@ccs96307 ccs96307 commented Nov 11, 2024

What does this PR do?

This PR provides an initial implementation of PEFT support for PPOTrainer, targeted towards the policy model. The existing functionality remains fully intact and unaffected by these modifications.

The following tasks have been completed:

  • Add peft_config for PPOTrainer
  • Add unit test for tests/test_ppo_trainer.py (next: implement unit tests to cover the new peft_config integration)
  • Update examples/scripts/ppo/ppo_tldr.py
  • Update examples/scripts/ppo/ppo.py

As of now, this implementation does not support quantization or gradient checkpointing.

If there’s anything inappropriate or suboptimal in my implementation, please feel free to let me know—I’m open to all feedback and eager to improve to align with the project standards.

Fixes #1916

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@ccs96307 ccs96307 marked this pull request as ready for review November 11, 2024 11:25
@ccs96307 ccs96307 changed the title [Draft] Add PEFT Support for PPOTrainer Add PEFT Support for PPOTrainer Nov 11, 2024
@qgallouedec
Copy link
Member

very nice @ccs96307! looking into details

@qgallouedec qgallouedec changed the title Add PEFT Support for PPOTrainer 📉 Add PEFT support for PPOTrainer Nov 11, 2024
@HuggingFaceDocBuilderDev

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.

@ccs96307 ccs96307 reopened this Nov 12, 2024
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
@ccs96307 ccs96307 mentioned this pull request Nov 14, 2024
9 tasks
@qgallouedec
Copy link
Member

Thanks a lot @ccs96307 for your contribution!

@qgallouedec qgallouedec merged commit 1293f37 into huggingface:main Nov 18, 2024
@ccs96307 ccs96307 deleted the feature-ppo-peft branch November 18, 2024 11:49
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.

How to Add PEFT to PPO Trainer or PPO Config
3 participants