Created GRPOTrainerWithEval subclass for different evaluation reward functions#8
Closed
jamesbraza wants to merge 3 commits into
Closed
Created GRPOTrainerWithEval subclass for different evaluation reward functions#8jamesbraza wants to merge 3 commits into
GRPOTrainerWithEval subclass for different evaluation reward functions#8jamesbraza wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
PR Overview
This PR introduces a subclass GRPOTrainerWithEval that extends GRPOTrainer to support evaluation reward functions and their associated processing classes while maintaining backward compatibility.
- Refactors model initialization to use an instance attribute (_model_init_kwargs) for improved consistency.
- Extracts reward processing class creation into a new helper method (_make_reward_processing_classes).
- Implements GRPOTrainerWithEval for handling separate training and evaluation reward functions and processing.
Reviewed Changes
| File | Description |
|---|---|
| trl/trainer/grpo_trainer.py | Added logging, refactored model initialization kwargs, created a helper for reward processing classes, and introduced a new subclass for evaluation reward support |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
trl/trainer/grpo_trainer.py:1257
- [nitpick] Consider handling cases where reward_func may not have a name attribute (e.g., when using lambdas or partial functions) to avoid potential AttributeErrors. A possible solution is to use getattr(reward_func, 'name', repr(reward_func)).
reward_func_name = reward_func.__name__
Member
Author
|
Closed in favor of #9 after a rebase onto |
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.
This PR creates a
GRPOTrainersubclassGRPOTrainerWithEvalthat adds support for optionaleval_reward_processing_classes.It should be backwards compatible with
GRPOTrainer.The only caveat here is I didn't comprehensively think about
args.reward_weights.