From 0c7ce5256f40369ed804e4bcce78f07fe8bb920e Mon Sep 17 00:00:00 2001 From: qweasdzxcvde <35418904+qweasdzxcvde@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:36:12 +0800 Subject: [PATCH] add tot_score inf mask to make training stable (#2019) I find there are some inf in tot_score, it makes model cannot converge, add inf mask can make training more stable. --- icefall/mmi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/icefall/mmi.py b/icefall/mmi.py index b7777b434..2de8f1aae 100644 --- a/icefall/mmi.py +++ b/icefall/mmi.py @@ -124,6 +124,7 @@ def _compute_mmi_loss_exact_non_optimized( den_tot_scores = den_lats.get_tot_scores(log_semiring=True, use_double_scores=True) tot_scores = num_tot_scores - den_scale * den_tot_scores + tot_scores = tot_scores.masked_fill(torch.isinf(tot_scores), 0.0) loss = -1 * tot_scores.sum() return loss