Fixes to logging statements.

This commit is contained in:
Daniel Povey 2022-10-22 15:08:07 +08:00
parent 74d775014d
commit 069125686e

View File

@ -845,9 +845,9 @@ def train_one_epoch(
if cur_grad_scale < 1.0 or (cur_grad_scale < 8.0 and batch_idx % 400 == 0):
scaler.update(cur_grad_scale * 2.0)
if cur_grad_scale < 0.01:
logging.warn("Grad scale is small: {cur_grad_scale}")
logging.warning(f"Grad scale is small: {cur_grad_scale}")
if cur_grad_scale < 1.0e-05:
raise RuntimeError("grad_scale is too small, exiting: {cur_grad_scale}")
raise RuntimeError(f"grad_scale is too small, exiting: {cur_grad_scale}")
if batch_idx % params.log_interval == 0:
cur_lr = scheduler.get_last_lr()[0]