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
fp16
游雁63e60cc43dda
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.pyindex 7b5a02fff..22b1ac0ec 100644--- a/funasr/auto/auto_model.py+++ b/funasr/auto/auto_model.py@@ -233,6 +233,8 @@ class AutoModel:# fp16if kwargs.get("fp16", False):model.to(torch.float16)+ elif kwargs.get("bf16", False):+ model.to(torch.bfloat16)return model, kwargsdef __call__(self, *args, **cfg):diff --git a/funasr/models/llm_asr/model.py b/funasr/models/llm_asr/model.pyindex 5f1530992..f72b2c814 100644--- a/funasr/models/llm_asr/model.py+++ b/funasr/models/llm_asr/model.py@@ -684,6 +684,13 @@ class LLMASR2(nn.Module):# audio encoderspeech = batch["speech"]speech_lengths = batch["speech_lengths"][:, 0]+ # fp16+ if kwargs.get("fp16", False):+ speech = speech.to(torch.float16)+ encoder_out_lens = encoder_out_lens.to(torch.float16)+ elif kwargs.get("bf16", False):+ speech = speech.to(torch.bfloat16)+ encoder_out_lens = encoder_out_lens.to(torch.bfloat16)encoder_out, encoder_out_lens = self.audio_encoder(speech.permute(0, 2, 1), speech_lengths)# audio_adaptor