-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[GRPO] switch grpo liger loss to triton version #4519
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
base: main
Are you sure you want to change the base?
Conversation
|
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. |
|
@lewtun would you be able to benchmark this branch for memory usage of grpo trainer? |
lewtun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding this @kashif ! LGTM with a question about adding 1 to logits_to_keep twice. Could you also add your nice plots showing the memory improvement with the Triton loss to the PR description?
Also, do we need to bump the minimum liger version?
| model_inputs[key] = inputs[key] | ||
| model_inputs["use_cache"] = False | ||
| if "logits_to_keep" in self.model_kwarg_keys: | ||
| model_inputs["logits_to_keep"] = logits_to_keep + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small suggestion since it wasn't clear to me why we're doing this:
| model_inputs["logits_to_keep"] = logits_to_keep + 1 | |
| # Add 1 because the last logits of the sequence is later excluded | |
| model_inputs["logits_to_keep"] = logits_to_keep + 1 |
| model_inputs["logits_to_keep"] = logits_to_keep + 1 | ||
|
|
||
| logits = model(**model_inputs).logits | ||
| logits = logits[:, -(logits_to_keep + 1) :, :].contiguous() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If logits_to_keep is in model_kwarg_keys we add 1 above to model_inputs, but then here we also add 1. Is that a form of double counting or is it correct as currently implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking wiht example... let me report back
What does this PR do?
Fixes dapo loss type support, but needs to wait for upstream merge and release linkedin/Liger-Kernel#939
Before submitting
Pull Request section?
to it if that's the case.
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.