Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
fix sensevoice loss_rich
北念8aa01036b6b7
diff --git a/funasr/models/sense_voice/model.py b/funasr/models/sense_voice/model.pyindex 5159b82b0..1311987f2 100644--- a/funasr/models/sense_voice/model.py+++ b/funasr/models/sense_voice/model.py@@ -698,10 +698,11 @@ class SenseVoiceSmall(nn.Module):loss_rich, acc_rich = self._calc_rich_ce_loss(encoder_out[:, :4, :], text[:, :4])- loss = loss_ctc+ loss = loss_ctc + loss_rich# Collect total loss stats- stats["loss"] = torch.clone(loss.detach()) if loss_ctc is not None else None+ stats["loss_ctc"] = torch.clone(loss_ctc.detach()) if loss_ctc is not None else Nonestats["loss_rich"] = torch.clone(loss_rich.detach()) if loss_rich is not None else None+ stats["loss"] = torch.clone(loss.detach()) if loss is not None else Nonestats["acc_rich"] = acc_rich# force_gatherable: to-device and to-tensor if scalar for DataParallel