Skip to content

Conversation

@Peter-Chou
Copy link
Contributor

@Peter-Chou Peter-Chou commented Sep 2, 2025

What does this PR do?

Fixes scale_rewards malfunctioned in GRPOTrainer #3991

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?
  • Did you write any new necessary tests?

Who can review?

Amazing team members such as @qgallouedec

Copy link
Collaborator

@LeonEricsson LeonEricsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 618 to 623
self.scale_rewards = {"true": "group", "false": "none"}.get(self.scale_rewards.lower(), self.scale_rewards.lower())
if self.scale_rewards not in ["batch", "none", "group"]:
raise ValueError(
f"Invalid value for scale_rewards: {self.scale_rewards}. Must be one of 'batch', 'group', or 'none'."
)

Copy link
Collaborator

@LeonEricsson LeonEricsson Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qgallouedec I noticed that you moved this into the trainer in the original PR. Thoughts? I prefer eager validation like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I usually try to minimize what we have in post-init. But here I guess it's ok

@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.

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks a lot, a patch release will soon be released

@qgallouedec qgallouedec changed the title fix scale_rewards issue in GRPO ⚖️ Fix scale_rewards issue in GRPO Sep 2, 2025
@qgallouedec qgallouedec merged commit 35702ce into huggingface:main Sep 3, 2025
10 checks passed
@Peter-Chou Peter-Chou deleted the scale_rewards_fix branch September 3, 2025 01:27
qgallouedec added a commit that referenced this pull request Sep 3, 2025
Co-authored-by: Leon <[email protected]>
Co-authored-by: Quentin Gallouédec <[email protected]>
SamY724 pushed a commit to SamY724/trl that referenced this pull request Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scale_rewards malfunctioned in GRPOTrainer

4 participants