Skip to content

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

update

speech_asrdf662541a887
diff --git a/funasr/models/frontend/abs_frontend.py b/funasr/models/frontend/abs_frontend.py
deleted file mode 100644
index 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 NotImplementedError
diff --git a/funasr/models/frontend/default.py b/funasr/models/frontend/default.py
index 9671fe9d9..5b034cf04 100644
--- a/funasr/models/frontend/default.py
+++ b/funasr/models/frontend/default.py
@@ -11,12 +11,11 @@ from typeguard import check_argument_types
from funasr.layers.log_mel import LogMel
from funasr.layers.stft import Stft
-from funasr.models.frontend.abs_frontend import AbsFrontend
from funasr.modules.frontends.frontend import Frontend
from 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 -> CMVN
diff --git a/funasr/models/frontend/fused.py b/funasr/models/frontend/fused.py
index 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 AbsFrontend
from funasr.models.frontend.default import DefaultFrontend
from funasr.models.frontend.s3prl import S3prlFrontend
import numpy as np
@@ -7,7 +6,7 @@ from typeguard import check_argument_types
from 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.py
index f2b6107d9..c0a526fae 100644
--- a/funasr/models/frontend/s3prl.py
+++ b/funasr/models/frontend/s3prl.py
@@ -10,7 +10,6 @@ import humanfriendly
import torch
from typeguard import check_argument_types
-from funasr.models.frontend.abs_frontend import AbsFrontend
from funasr.modules.frontends.frontend import Frontend
from funasr.modules.nets_utils import pad_list
from 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.py
index 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_sequence
from typeguard import check_argument_types
import funasr.models.frontend.eend_ola_feature as eend_ola_feature
-from funasr.models.frontend.abs_frontend import AbsFrontend
def 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.py
index 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 Tuple
import numpy as np
import torch
import torchaudio.compliance.kaldi as kaldi
-from funasr.models.frontend.abs_frontend import AbsFrontend
from typeguard import check_argument_types
from torch.nn.utils.rnn import pad_sequence
# import kaldifeat
diff --git a/funasr/models/frontend/windowing.py b/funasr/models/frontend/windowing.py
index 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 AbsFrontend
import torch
from typeguard import check_argument_types
from typing import Tuple
-class SlidingWindow(AbsFrontend):
+class SlidingWindow(torch.nn.Module):
"""Sliding Window.
Provides a sliding window over a batched continuous raw audio tensor.