Repository navigation
Grow DynamicScale after growth_interval finite steps, not one more - #5614
Open
vineethsaivs wants to merge 1 commit into
Open
vineethsaivs wants to merge 1 commit into
vineethsaivs wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
DynamicScalegrows the loss scale on the (growth_interval + 1)th finite step in a row, not aftergrowth_intervalfinite steps as its docstring says. Withgrowth_interval=1the scale grows every other step instead of every step.Cause:
growchecksfin_steps == growth_interval, butfin_stepsis the count before the current step, so it only reachesgrowth_intervalone step later.Fix: count the current step,
fin_steps + 1 == growth_interval. This matches torch'sGradScaler, which grows on thegrowth_intervalth successful step.Test: new
tests/dynamic_scale_test.py. Withgrowth_interval=3andscale=4, six finite steps now give 4, 4, 8, 8, 8, 16 (before: 4, 4, 4, 8, 8, 8), and a non-finite step still backs off and restarts the count. Both tests fail on main and pass here.