feat(ppo): add save_value_model flag to PPOConfig#6120
Open
mukund1985 wants to merge 1 commit into
Open
Conversation
Adds a new `save_value_model: bool = False` field to `PPOConfig`. When enabled, `PPOTrainer.save_model()` writes the value model (critic) to a `value_model/` sub-directory alongside the policy checkpoint, making reward-model checkpointing and resume possible. Closes huggingface#3293
Author
|
Hi @qgallouedec @albertvillanova — tagging you both as the active maintainers in case this is useful. This PR addresses #3293. The value model (critic) is currently dropped at every checkpoint — only the policy is saved — so any interrupted PPO run has to re-initialise the critic from scratch on resume. The fix is a single new flag Happy to add tests or adjust to match whatever pattern you prefer. Thanks! |
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.
Adds a new
save_value_model: bool = Falsefield toPPOConfig. When enabled,PPOTrainer.save_model()writes the value model (critic) to avalue_model/sub-directory alongside the policy checkpoint, making critic checkpointing and faithful RLHF run resumption possible.Fixes #3293
Before submitting
AI writing disclosure
Note
Low Risk
Behavior is off by default and only extends checkpoint I/O on an explicit flag; no training-loop or inference path changes.
Overview
Adds an opt-in
save_value_modelflag onPPOConfig(defaultFalse) so PPO checkpoints can include the critic, not just the policy.When enabled,
PPOTrainer.save_model()still writes the policy as today, then savesbackup_model.value_modelunder avalue_model/subfolder in the same output/checkpoint directory, including the same DeepSpeed swap pattern used for the policy save.Reviewed by Cursor Bugbot for commit 482546f. Bugbot is set up for automated code reviews on this repo. Configure here.