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
auto frontend
游雁b2be308de0a4
diff --git a/funasr/models/llm_asr/model.py b/funasr/models/llm_asr/model.pyindex 0d9bf7f09..e2880c831 100644--- a/funasr/models/llm_asr/model.py+++ b/funasr/models/llm_asr/model.py@@ -468,7 +468,7 @@ class LLMASR2(nn.Module):if len(speech_lengths.size()) > 1:speech_lengths = speech_lengths[:, 0]- batch_size = speech.shape[0]+ batch_size, frames, _ = speech.shape# audio encoderencoder_out, encoder_out_lens = self.audio_encoder(speech.permute(0, 2, 1), speech_lengths)@@ -499,6 +499,13 @@ class LLMASR2(nn.Module):stats["acc"] = acc_attstats["loss"] = torch.clone(loss.detach())+ stats["batch_size"] = batch_size+ stats["batch_size_x_frames"] = frames * batch_size+ stats["batch_size_real_frames"] = speech_lengths.sum().item()+ stats["padding_frames"] = stats["batch_size_x_frames"] - stats["batch_size_real_frames"]+ stats["batch_size_x_tokens"] = token_num * batch_size+ stats["batch_size_real_tokens"] = attention_mask.sum().item()+ stats["padding_tokens"] = stats["batch_size_x_tokens"] - stats["batch_size_real_tokens"]# force_gatherable: to-device and to-tensor if scalar for DataParallelif self.length_normalized_loss: