Skip to content

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

fix device bug

shixian.shic47ad73e46bb
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index d07221976..3986a110c 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -134,8 +134,6 @@ class AutoModel:
self.spk_model = spk_model
self.spk_kwargs = spk_kwargs
self.model_path = kwargs.get("model_path")
-
-
def build_model(self, **kwargs):
assert "model" in kwargs
@@ -146,7 +144,7 @@ class AutoModel:
set_all_random_seed(kwargs.get("seed", 0))
device = kwargs.get("device", "cuda")
- if not torch.cuda.is_available() or kwargs.get("ngpu", 0) == 0:
+ if not torch.cuda.is_available() or kwargs.get("ngpu", 1) == 0:
device = "cpu"
kwargs["batch_size"] = 1
kwargs["device"] = device
@@ -200,8 +198,6 @@ class AutoModel:
res = self.model(*args, kwargs)
return res
-
-
def generate(self, input, input_len=None, **cfg):
if self.vad_model is None:
return self.inference(input, input_len=input_len, **cfg)