add tot_score inf mask to make training stable

I find there are some inf in tot_score, it makes model cannot converge, add inf mask can make training more stable.
This commit is contained in:
qweasdzxcvde 2025-09-08 14:29:57 +08:00 committed by GitHub
parent 34fc1fdf0d
commit 1e3d264b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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