Skip to content

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

perf: move model.eval() from inference() to build_model()

游雁65d1fd55541a
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index 9b0054e32..25f3b1f99 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -320,6 +320,7 @@ class AutoModel:
elif kwargs.get("bf16", False):
model.to(torch.bfloat16)
model.to(device)
+ model.eval()
if not kwargs.get("disable_log", True):
tables.print()
@@ -371,7 +372,6 @@ class AutoModel:
kwargs.pop("cache")
deep_update(kwargs, cfg)
model = self.model if model is None else model
- model.eval()
batch_size = kwargs.get("batch_size", 1)
# if kwargs.get("device", "cpu") == "cpu":