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
decoding key
游雁46e5beede954
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.pyindex e77f04ffc..577c328a6 100644--- a/funasr/auto/auto_model.py+++ b/funasr/auto/auto_model.py@@ -107,6 +107,10 @@ def prepare_data_iterator(data_in, input_len=None, data_type=None, key=None):class AutoModel:def __init__(self, **kwargs):++ log_level = getattr(logging, kwargs.get("log_level", "INFO").upper())+ logging.basicConfig(level=log_level)+if not kwargs.get("disable_log", True):tables.print()diff --git a/funasr/bin/export.py b/funasr/bin/export.pyindex 6c9b49fd8..9d0140102 100644--- a/funasr/bin/export.py+++ b/funasr/bin/export.py@@ -17,9 +17,6 @@ def main_hydra(cfg: DictConfig):return cfg_itemkwargs = to_plain_list(cfg)- log_level = getattr(logging, kwargs.get("log_level", "INFO").upper())-- logging.basicConfig(level=log_level)if kwargs.get("debug", False):import pdbdiff --git a/funasr/bin/inference.py b/funasr/bin/inference.pyindex 2a1b6aaaa..39ee5c067 100644--- a/funasr/bin/inference.py+++ b/funasr/bin/inference.py@@ -16,9 +16,6 @@ def main_hydra(cfg: DictConfig):return cfg_itemkwargs = to_plain_list(cfg)- log_level = getattr(logging, kwargs.get("log_level", "INFO").upper())-- logging.basicConfig(level=log_level)if kwargs.get("debug", False):import pdbdiff --git a/funasr/models/sense_voice/model.py b/funasr/models/sense_voice/model.pyindex dcf18fd88..023063896 100644--- a/funasr/models/sense_voice/model.py+++ b/funasr/models/sense_voice/model.py@@ -803,7 +803,10 @@ class SenseVoiceFSMN(nn.Module):tokenizer=tokenizer,)- if len(kwargs.get("data_type", [])) > 1:+ if (+ isinstance(kwargs.get("data_type", None), (list, tuple))+ and len(kwargs.get("data_type", [])) > 1+ ):audio_sample_list, text_token_int_list = audio_sample_listtext_token_int = text_token_int_list[0]else:@@ -857,7 +860,7 @@ class SenseVoiceFSMN(nn.Module):ys_pad = torch.tensor(sos_int + text_token_int, dtype=torch.int64).to(kwargs["device"])[None, :]- ys_pad_lens = torch.tensor([len(text_token_int)], dtype=torch.int64).to(+ ys_pad_lens = torch.tensor([len(sos_int + text_token_int)], dtype=torch.int64).to(kwargs["device"])[None, :]decoder_out = self.model.decoder(diff --git a/funasr/models/sense_voice/search.py b/funasr/models/sense_voice/search.pyindex 98d02db9d..694e569ea 100644--- a/funasr/models/sense_voice/search.py+++ b/funasr/models/sense_voice/search.py@@ -370,6 +370,8 @@ class BeamSearch(torch.nn.Module):# post process of one iterationrunning_hyps = self.post_process(i, maxlen, maxlenratio, best, ended_hyps)# end detection+ # if len(ended_hyps) > 0:+ # print(f"ended_hyps: {ended_hyps}")if maxlenratio == 0.0 and end_detect([h.asdict() for h in ended_hyps], i):logging.info(f"end detected at {i}")break