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

[Trainer] Fix nan-loss condition #13911

Merged
merged 1 commit into from Oct 6, 2021
Merged

[Trainer] Fix nan-loss condition #13911

merged 1 commit into from Oct 6, 2021

Conversation

anton-l
Copy link
Member

@anton-l anton-l commented Oct 6, 2021

Fixes a change in the nan loss handling logic introduced by #13896

With is_torch_tpu_available()==False and (torch.isnan(tr_loss_step) or torch.isinf(tr_loss_step))==False
the else: condition was never reached, so the training loss was always 0.0.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work fine, thanks for fixing!

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@LysandreJik LysandreJik merged commit 5d390e9 into huggingface:master Oct 6, 2021
@anton-l anton-l deleted the fix-zero-train-loss branch October 6, 2021 19:41
lapisfluvialis pushed a commit to lapisfluvialis/transformers that referenced this pull request Oct 27, 2021
Albertobegue pushed a commit to Albertobegue/transformers that referenced this pull request Jan 27, 2022
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

Successfully merging this pull request may close these issues.

None yet

4 participants