mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-09 05:55:26 +00:00
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:
parent
34fc1fdf0d
commit
1e3d264b46
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user