Skip to content

Conversation

shirinyamani
Copy link
Member

What does this PR do?

Fixes discussion

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry forgot to git reset this!
this was my own tiny test!

@shirinyamani shirinyamani requested a review from kashif March 13, 2025 22:25
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
@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.

@qgallouedec
Copy link
Member

What happens if none of the reward functions return a valid reward? We should add a warning, something like:

# If all reward functions return None for a given row, issue a warning
if torch.isnan(rewards_per_func).all(dim=1).any():
    nan_row_idx = torch.isnan(rewards_per_func).all(dim=1).nonzero(as_tuple=True)[0][0]
    row_reward_kwargs = {key: value[nan_row_idx] for key, value in reward_kwargs.items()}
    row_reward_kwargs["prompt"] = prompts[nan_row_idx]
    row_reward_kwargs["completion"] = completions[nan_row_idx]
    warnings.warn(
        f"All reward functions returned None for the following kwargs: {row_reward_kwargs}. "
        "Please ensure that at least one reward function returns a valid reward."
    )

@qgallouedec
Copy link
Member

qgallouedec commented Mar 13, 2025

Please also add a unittest for such case

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
shirinyamani and others added 2 commits March 14, 2025 18:48
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
shirinyamani and others added 2 commits March 14, 2025 18:56
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
shirinyamani and others added 2 commits March 15, 2025 01:03
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
@qgallouedec
Copy link
Member

Let's see if the ci passes 🤞

@qgallouedec
Copy link
Member

You need to re-apply the pre-commits

@shirinyamani
Copy link
Member Author

You need to re-apply the pre-commits

I did and commit the changes suggested by i, and pushed now!

@shirinyamani shirinyamani merged commit 0f88c17 into main Mar 18, 2025
@shirinyamani shirinyamani deleted the flexible_reward branch March 18, 2025 17:32
yxliu-TAMU pushed a commit to mincheolseong/ECEN743-GRPO-Project-Proposal that referenced this pull request Apr 20, 2025
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.

3 participants