-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Scale loss before backward #35207
base: main
Are you sure you want to change the base?
Scale loss before backward #35207
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. |
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.
This one feels more like the right solution. Do the slow tests pass under this? (There is one in there for grad accum)
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.
Yes because in reality this is exactly the right solution: since we are no longer relying on accelerate to div the loss, we need to do so before backward()
if we don't know our num items in the batch
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.
LGTM !
They pass locally. I get errors but I think they aren't related:
|
@ArthurZucker @muellerzr @SunMarc I'll let you merge when you think it's good. |
What does this PR do?
Fixes huggingface/trl#2456
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.