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

Apply scale loss when performing accum_freq #957

Open
AshStuff opened this issue Oct 14, 2024 · 1 comment
Open

Apply scale loss when performing accum_freq #957

AshStuff opened this issue Oct 14, 2024 · 1 comment

Comments

@AshStuff
Copy link

In this line

backward(total_loss, scaler)

We are trying to accumulate the gradients and perform optimizer step only after we accumulate gradients for accum_freq steps.

I am wondering whether do we need to divide the total_loss by accum_freq to scale the loss properly.

@rwightman
Copy link
Collaborator

@AshStuff dupe of #761 I have not used the grad accum myself, it would be worth someone with the resources doing a small scale experiment to run w/ and w/o scaling and see if there is any difference in behviour... though I would have thought that would have been tested against normal training before being added in first place. Perhaps not.

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

No branches or pull requests

2 participants