Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grpo loss #553

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Grpo loss #553

wants to merge 19 commits into from

Conversation

kashif
Copy link
Contributor

@kashif kashif commented Feb 1, 2025

Summary

Adds the GRPO chunked loss

fixes issue #548

Testing Done

  • Hardware Type:
  • run make test to ensure correctness
  • run make checkstyle to ensure code style
  • run make test-convergence to ensure convergence

attention_mask.view(-1)[mask_indices] = 0

# Create rewards with shape [B, num_generations]
rewards = torch.randn(B * num_generations, device=device, dtype=dtype)

Choose a reason for hiding this comment

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

If it is not too much work, would it be possible to test a scenario where the rewards are same same, i.e all 1s?

Copy link

@edbeeching edbeeching left a comment

Choose a reason for hiding this comment

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

LGTM, nice test.

@hongpeng-guo hongpeng-guo self-assigned this Feb 5, 2025
Copy link

@RichhLi RichhLi left a comment

Choose a reason for hiding this comment

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

Great work! Great use of comments

@kashif
Copy link
Contributor Author

kashif commented Feb 18, 2025

so there was a small change to the loss: huggingface/trl#2881 which i will integrate here too

@lancerts
Copy link
Collaborator

Nice work!!

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.

6 participants