-
Notifications
You must be signed in to change notification settings - Fork 310
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
Warn instead of raising exceptions in inf-check #1852
Conversation
icefall/hooks.py
Outdated
@@ -40,8 +40,8 @@ def register_inf_check_hooks(model: nn.Module) -> None: | |||
def forward_hook(_module, _input, _output, _name=name): | |||
if isinstance(_output, Tensor): | |||
if not torch.isfinite(_output.to(torch.float32).sum()): | |||
raise ValueError( | |||
f"The sum of {_name}.output is not finite: {_output}" | |||
logging.warning( |
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.
Will the training continue with inf loss and inf grad?
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, like the backward code, it will just warn instead of printing the tensor and raising an exception.
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.
In that case, will it propagate the inf grad to model parameters and result in inf parameters?
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.
It is only applied with the inf-check option tuned on, i.e., for finding where the infinites are coming from. So it wouldn't affect normal model training.
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.
I see. Thanks!
Could you fix the style issues? |
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.
Thanks!
No description provided.