From df662541a887feafd1c17eda790be67c8711a20f Mon Sep 17 00:00:00 2001
From: speech_asr <wangjiaming.wjm@alibaba-inc.com>
Date: 星期二, 11 四月 2023 00:13:30 +0800
Subject: [PATCH] update

---
 funasr/models/frontend/wav_frontend_kaldifeat.py |    1 -
 /dev/null                                        |   17 -----------------
 funasr/models/frontend/default.py                |    5 ++---
 funasr/models/frontend/s3prl.py                  |    3 +--
 funasr/models/frontend/windowing.py              |    3 +--
 funasr/models/frontend/wav_frontend.py           |    7 +++----
 funasr/models/frontend/fused.py                  |    3 +--
 7 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/funasr/models/frontend/abs_frontend.py b/funasr/models/frontend/abs_frontend.py
deleted file mode 100644
index 538236f..0000000
--- 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 9671fe9..5b034cf 100644
--- a/funasr/models/frontend/default.py
+++ b/funasr/models/frontend/default.py
@@ -11,12 +11,11 @@
 
 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 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 8b5e56e..7cebde7 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 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 f2b6107..c0a526f 100644
--- a/funasr/models/frontend/s3prl.py
+++ b/funasr/models/frontend/s3prl.py
@@ -10,7 +10,6 @@
 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 @@
     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 475a939..fc02dc9 100644
--- a/funasr/models/frontend/wav_frontend.py
+++ b/funasr/models/frontend/wav_frontend.py
@@ -9,7 +9,6 @@
 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 @@
     return LFR_outputs.type(torch.float32)
 
 
-class WavFrontend(AbsFrontend):
+class WavFrontend(torch.nn.Module):
     """Conventional frontend structure for ASR.
     """
 
@@ -207,7 +206,7 @@
         return feats_pad, feats_lens
 
 
-class WavFrontendOnline(AbsFrontend):
+class WavFrontendOnline(torch.nn.Module):
     """Conventional frontend structure for streaming ASR/VAD.
     """
 
@@ -452,7 +451,7 @@
         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 b91ac63..d4e775e 100644
--- a/funasr/models/frontend/wav_frontend_kaldifeat.py
+++ b/funasr/models/frontend/wav_frontend_kaldifeat.py
@@ -6,7 +6,6 @@
 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 7c4c568..f7f1dc1 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.

--
Gitblit v1.9.1