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
update
speech_asrdf662541a887
diff --git a/funasr/models/frontend/abs_frontend.py b/funasr/models/frontend/abs_frontend.pydeleted file mode 100644index 538236fe9..000000000--- a/funasr/models/frontend/abs_frontend.py+++ /dev/null@@ -1,17 +0,0 @@-from abc import ABC-from abc import abstractmethod-from typing import Tuple--import torch---class AbsFrontend(torch.nn.Module, ABC):- @abstractmethod- def output_size(self) -> int:- raise NotImplementedError-- @abstractmethod- def forward(- self, input: torch.Tensor, input_lengths: torch.Tensor- ) -> Tuple[torch.Tensor, torch.Tensor]:- raise NotImplementedErrordiff --git a/funasr/models/frontend/default.py b/funasr/models/frontend/default.pyindex 9671fe9d9..5b034cf04 100644--- a/funasr/models/frontend/default.py+++ b/funasr/models/frontend/default.py@@ -11,12 +11,11 @@ from typeguard import check_argument_typesfrom funasr.layers.log_mel import LogMelfrom funasr.layers.stft import Stft-from funasr.models.frontend.abs_frontend import AbsFrontendfrom funasr.modules.frontends.frontend import Frontendfrom funasr.utils.get_default_kwargs import get_default_kwargs-class DefaultFrontend(AbsFrontend):+class DefaultFrontend(torch.nn.Module):"""Conventional frontend structure for ASR.Stft -> WPE -> MVDR-Beamformer -> Power-spec -> Mel-Fbank -> CMVN@@ -135,7 +134,7 @@ class DefaultFrontend(AbsFrontend):-class MultiChannelFrontend(AbsFrontend):+class MultiChannelFrontend(torch.nn.Module):"""Conventional frontend structure for ASR.Stft -> WPE -> MVDR-Beamformer -> Power-spec -> Mel-Fbank -> CMVNdiff --git a/funasr/models/frontend/fused.py b/funasr/models/frontend/fused.pyindex 8b5e56ebf..7cebde770 100644--- a/funasr/models/frontend/fused.py+++ b/funasr/models/frontend/fused.py@@ -1,4 +1,3 @@-from funasr.models.frontend.abs_frontend import AbsFrontendfrom funasr.models.frontend.default import DefaultFrontendfrom funasr.models.frontend.s3prl import S3prlFrontendimport numpy as np@@ -7,7 +6,7 @@ from typeguard import check_argument_typesfrom typing import Tuple-class FusedFrontends(AbsFrontend):+class FusedFrontends(torch.nn.Module):def __init__(self, frontends=None, align_method="linear_projection", proj_dim=100, fs=16000):diff --git a/funasr/models/frontend/s3prl.py b/funasr/models/frontend/s3prl.pyindex f2b6107d9..c0a526fae 100644--- a/funasr/models/frontend/s3prl.py+++ b/funasr/models/frontend/s3prl.py@@ -10,7 +10,6 @@ import humanfriendlyimport torchfrom typeguard import check_argument_types-from funasr.models.frontend.abs_frontend import AbsFrontendfrom funasr.modules.frontends.frontend import Frontendfrom funasr.modules.nets_utils import pad_listfrom funasr.utils.get_default_kwargs import get_default_kwargs@@ -27,7 +26,7 @@ def base_s3prl_setup(args):return args-class S3prlFrontend(AbsFrontend):+class S3prlFrontend(torch.nn.Module):"""Speech Pretrained Representation frontend structure for ASR."""def __init__(diff --git a/funasr/models/frontend/wav_frontend.py b/funasr/models/frontend/wav_frontend.pyindex 475a9398a..fc02dc9de 100644--- a/funasr/models/frontend/wav_frontend.py+++ b/funasr/models/frontend/wav_frontend.py@@ -9,7 +9,6 @@ from torch.nn.utils.rnn import pad_sequencefrom typeguard import check_argument_typesimport funasr.models.frontend.eend_ola_feature as eend_ola_feature-from funasr.models.frontend.abs_frontend import AbsFrontenddef load_cmvn(cmvn_file):@@ -76,7 +75,7 @@ def apply_lfr(inputs, lfr_m, lfr_n):return LFR_outputs.type(torch.float32)-class WavFrontend(AbsFrontend):+class WavFrontend(torch.nn.Module):"""Conventional frontend structure for ASR."""@@ -207,7 +206,7 @@ class WavFrontend(AbsFrontend):return feats_pad, feats_lens-class WavFrontendOnline(AbsFrontend):+class WavFrontendOnline(torch.nn.Module):"""Conventional frontend structure for streaming ASR/VAD."""@@ -452,7 +451,7 @@ class WavFrontendOnline(AbsFrontend):self.lfr_splice_cache = []-class WavFrontendMel23(AbsFrontend):+class WavFrontendMel23(torch.nn.Module):"""Conventional frontend structure for ASR."""diff --git a/funasr/models/frontend/wav_frontend_kaldifeat.py b/funasr/models/frontend/wav_frontend_kaldifeat.pyindex b91ac635c..d4e775ea0 100644--- a/funasr/models/frontend/wav_frontend_kaldifeat.py+++ b/funasr/models/frontend/wav_frontend_kaldifeat.py@@ -6,7 +6,6 @@ from typing import Tupleimport numpy as npimport torchimport torchaudio.compliance.kaldi as kaldi-from funasr.models.frontend.abs_frontend import AbsFrontendfrom typeguard import check_argument_typesfrom torch.nn.utils.rnn import pad_sequence# import kaldifeatdiff --git a/funasr/models/frontend/windowing.py b/funasr/models/frontend/windowing.pyindex 7c4c56853..f7f1dc111 100644--- a/funasr/models/frontend/windowing.py+++ b/funasr/models/frontend/windowing.py@@ -4,13 +4,12 @@"""Sliding Window for raw audio input data."""-from funasr.models.frontend.abs_frontend import AbsFrontendimport torchfrom typeguard import check_argument_typesfrom typing import Tuple-class SlidingWindow(AbsFrontend):+class SlidingWindow(torch.nn.Module):"""Sliding Window.Provides a sliding window over a batched continuous raw audio tensor.