Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fixbug

游雁9e13f028bc4c
diff --git a/funasr/models/llm_asr/model.py b/funasr/models/llm_asr/model.py
index 57da105b8..66c416b3d 100644
--- a/funasr/models/llm_asr/model.py
+++ b/funasr/models/llm_asr/model.py
@@ -714,13 +714,17 @@ class LLMASR2(nn.Module):
]
llm_dtype = kwargs.get("llm_dtype", "fp32")
+ if llm_dtype == "fp32":
+ llm_dtype = "fp16" if kwargs.get("fp16", False) else llm_dtype
+ llm_dtype = "bf16" if kwargs.get("bf16", False) else llm_dtype
+
dtype_map = {"bf16": torch.bfloat16, "fp16": torch.float16, "fp32": torch.float32}
with torch.cuda.amp.autocast(
enabled=True if llm_dtype != "fp32" else False, dtype=dtype_map[llm_dtype]
):
label = contents["assistant"][0]
- # self.llm = self.llm.to(dtype_map[llm_dtype])
- # inputs_embeds = inputs_embeds.to(dtype_map[llm_dtype])
+ self.llm = self.llm.to(dtype_map[llm_dtype])
+ inputs_embeds = inputs_embeds.to(dtype_map[llm_dtype])
if not kwargs.get("tearchforing", False):