🧩 PPO/RLOO/OnlineDPO sequence generation: make deepsped 3 weight gathering optional#2557
Merged
qgallouedec merged 7 commits intohuggingface:mainfrom Jan 21, 2025
Merged
Conversation
|
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. |
This was
linked to
issues
Jan 21, 2025
5 tasks
5 tasks
|
how to change this code for bigger model like >14B model training? |
yxliu-TAMU
pushed a commit
to mincheolseong/ECEN743-GRPO-Project-Proposal
that referenced
this pull request
Apr 20, 2025
…ering optional (huggingface#2557) * PPO/RLOO/OnlineDPO: add ds3_gather_for_generation argument to control weights gathering for generation * code formatting * rephrase and document * more doc * style [ci skip] * Trigger CI --------- Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com> Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This is my approach to address #2529. Gathering was introduced in #1483 to speed up generation significantly, but it may cause OOM with bigger models (#2250) here:
trl/trl/models/utils.py
Line 184 in edabe0a
I've introduced parameter
ds3_gather_for_generationin trainer's configurations. With defaultTruevalue, behavior is the same as before.I ran official examples for PPO and RLOO with these changes. I only modified
examples/accelerate_configs/deepspeed_zero3.yamlwithoffload_optimizer_device: cpuandnum_processes: 4.In both cases, for
ds3_gather_for_generation True, I got expected OOM:With
ds3_gather_for_generation False, sequences generation is successful. It's slow, as shown in #1483, but in private experiments I found it useful.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines.
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.