Dont print out full non-finite tensor

This commit is contained in:
Daniel Povey 2022-10-22 23:03:19 +08:00
parent e0c1dc66da
commit ad2d3c2b36

View File

@ -66,7 +66,7 @@ def register_inf_check_hooks(model: nn.Module) -> None:
continue
if not torch.isfinite(o.to(torch.float32).sum()):
logging.warning(
f"The sum of {_name}.grad[{i}] is not finite: {o}"
f"The sum of {_name}.grad[{i}] is not finite"
)
module.register_forward_hook(forward_hook)