port OVERFLOW log to ZeRO-2#1593
Merged
tjruwase merged 1 commit intodeepspeedai:masterfrom Nov 27, 2021
Merged
Conversation
tjruwase
approved these changes
Nov 27, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR just ports to ZeRO2:
to be in sync with ZeRO3.
The only issue here is that the way zero2 is written is that it doesn't skip one step at a time - it continues to scale down until it runs out of loss scale in the same step. Perhaps that's why it wasn't logging that info in the first place.
The problem is that after I added this change, the user issue I'm trying to debug I'm trying to debug this Issue: huggingface/transformers#14531 gets:
which means it tried all
2**16->2**0and failed. But my first suspicion was that the user had"initial_scale_power": 0,set in the config file. Which wasn't the case - it was 16.Thus I'm not sure how to best flag to the user that the loss scaling started from
2**initial_scale_power- i.e. this logging I added has an issue.actually, I tried to find in the code where it goes through 216 -> 20 in a single step and I can't find it, it appears to be doing it one step at a time. Then I can't figure out how the first OVERFLOW report is with
Attempted loss scale: 1, reducing to 1p.s. zero3 does report a single step down in scale - so takes 17 steps to get to
Attempted loss scale: 1The rest probably belongs to a new Issue, but it's related to this PR.
I'm trying to debug this Issue: huggingface/transformers#14531
where the training works fine with
t5-smallort5-base, but switching tot5-largeor higher leads to an OVERFLOW on the first step from which it never recovers. And there is no diagnostic whatsoever.So I think besides this PR additional logging is needed to tell the user that the training is not happening since:
is an impasse from which deepspeed can't recover. i.e. Perhaps it should assert if that's the case.
but that's an additional feature.
and while at it 2 more related issues:
Attempted loss scale: 65536, reducing to 65536it's not scaling the first time around.loss="nan"where Deepspeed should probably assert. should dynamic scaling and overflow check happen only at the beginning? #931Apologies for such a huge info dump. It's just all related so I wasn't sure how to best communicate this clearly.
@tjruwase