From d550a62bead38c06ab1430ae63c30fa46243e3c3 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期四, 29 六月 2023 19:40:39 +0800
Subject: [PATCH] Merge branch 'main' of https://github.com/alibaba-damo-academy/FunASR into main
---
funasr/datasets/small_datasets/length_batch_sampler.py | 2
funasr/models/e2e_asr.py | 2
funasr/datasets/small_datasets/preprocessor.py | 11
funasr/text/token_id_converter.py | 2
funasr/bin/lm_inference_launch.py | 2
funasr/build_utils/build_trainer.py | 5
funasr/runtime/readme_cn.md | 31 +
funasr/optimizers/sgd.py | 2
funasr/tasks/vad.py | 8
funasr/tasks/sa_asr.py | 8
funasr/tasks/punctuation.py | 9
funasr/text/cleaner.py | 2
funasr/runtime/python/onnxruntime/funasr_onnx/utils/utils.py | 3
funasr/modules/eend_ola/utils/report.py | 2
funasr/models/encoder/opennmt_encoders/conv_encoder.py | 2
funasr/main_funcs/collect_stats.py | 2
funasr/runtime/docs/images/aliyun4.png | 0
funasr/bin/sv_inference_launch.py | 7
funasr/models/encoder/conformer_encoder.py | 3
funasr/models/encoder/sanm_encoder.py | 4
funasr/tasks/diar.py | 16
funasr/tasks/lm.py | 8
funasr/torch_utils/initialize.py | 2
funasr/bin/punc_inference_launch.py | 3
funasr/layers/mask_along_axis.py | 4
funasr/runtime/docs/images/aliyun12.png | 0
funasr/tasks/abs_task.py | 16
funasr/text/sentencepiece_tokenizer.py | 2
funasr/bin/asr_infer.py | 52 --
funasr/fileio/datadir_writer.py | 6
funasr/runtime/docs/aliyun_server_tutorial.md | 28
funasr/layers/label_aggregation.py | 2
funasr/models/encoder/data2vec_encoder.py | 2
funasr/models/decoder/rnnt_decoder.py | 2
funasr/runtime/docs/images/aliyun6.png | 0
funasr/models/e2e_diar_eend_ola.py | 2
funasr/datasets/collate_fn.py | 7
funasr/models/e2e_diar_sond.py | 2
funasr/models/e2e_tp.py | 2
funasr/train/abs_model.py | 3
funasr/samplers/num_elements_batch_sampler.py | 2
funasr/models/frontend/windowing.py | 2
funasr/fileio/rand_gen_dataset.py | 3
funasr/text/build_tokenizer.py | 2
funasr/datasets/iterable_dataset.py | 2
funasr/models/preencoder/sinc.py | 3
funasr/build_utils/build_model_from_file.py | 2
funasr/models/decoder/sanm_decoder.py | 3
funasr/text/phoneme_tokenizer.py | 2
funasr/bin/vad_infer.py | 4
funasr/models/decoder/transformer_decoder.py | 10
funasr/runtime/docs/images/aliyun8.png | 0
funasr/train/class_choices.py | 5
funasr/models/decoder/rnn_decoder.py | 2
funasr/utils/griffin_lim.py | 2
funasr/datasets/dataset.py | 6
funasr/layers/utterance_mvn.py | 2
funasr/text/word_tokenizer.py | 2
funasr/models/e2e_asr_transducer.py | 9
funasr/models/encoder/rnn_encoder.py | 2
egs/alimeeting/sa_asr/local/format_wav_scp.py | 2
funasr/train/reporter.py | 9
funasr/bin/vad_inference_launch.py | 3
funasr/models/e2e_asr_paraformer.py | 6
funasr/bin/diar_inference_launch.py | 3
funasr/build_utils/build_sv_model.py | 2
funasr/models/postencoder/hugging_face_transformers_postencoder.py | 2
funasr/runtime/docs/images/aliyun3.png | 0
funasr/samplers/length_batch_sampler.py | 2
funasr/runtime/docs/images/aliyun1.png | 0
funasr/main_funcs/average_nbest_models.py | 2
funasr/samplers/sorted_batch_sampler.py | 2
funasr/models/e2e_asr_contextual_paraformer.py | 2
funasr/schedulers/warmup_lr.py | 2
funasr/layers/global_mvn.py | 2
funasr/models/e2e_sv.py | 2
funasr/models/preencoder/linear.py | 2
funasr/datasets/large_datasets/build_dataloader.py | 2
funasr/train/trainer.py | 5
setup.py | 54 -
funasr/datasets/small_datasets/dataset.py | 6
funasr/bin/diar_infer.py | 65 --
funasr/export/export_model.py | 2
funasr/runtime/docs/images/aliyun5.png | 0
funasr/torch_utils/forward_adaptor.py | 2
funasr/bin/tp_inference_launch.py | 2
funasr/layers/stft.py | 2
funasr/models/data2vec.py | 2
funasr/models/encoder/transformer_encoder.py | 2
funasr/text/char_tokenizer.py | 2
funasr/runtime/docs/images/aliyun7.png | 0
funasr/models/encoder/opennmt_encoders/self_attention_encoder.py | 2
egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/finetune.py | 38 -
funasr/runtime/docs/images/aliyun11.png | 0
funasr/schedulers/noam_lr.py | 2
funasr/bin/sv_infer.py | 35 -
funasr/datasets/small_datasets/collate_fn.py | 5
funasr/runtime/docs/SDK_tutorial_cn.md | 328 +++++++++++++
funasr/models/seq_rnn_lm.py | 2
funasr/fileio/read_text.py | 3
funasr/iterators/chunk_iter_factory.py | 2
funasr/runtime/python/libtorch/funasr_torch/utils/utils.py | 3
funasr/fileio/sound_scp.py | 3
funasr/runtime/docs/images/aliyun10.png | 0
funasr/samplers/build_batch_sampler.py | 4
funasr/iterators/multiple_iter_factory.py | 2
funasr/models/e2e_asr_mfcca.py | 2
funasr/models/e2e_sa_asr.py | 2
funasr/samplers/folded_batch_sampler.py | 2
funasr/models/encoder/mfcca_encoder.py | 2
funasr/samplers/unsorted_batch_sampler.py | 2
funasr/build_utils/build_streaming_iterator.py | 2
funasr/runtime/docs/images/aliyun9.png | 0
funasr/iterators/sequence_iter_factory.py | 2
funasr/models/frontend/fused.py | 2
funasr/datasets/preprocessor.py | 11
funasr/models/frontend/s3prl.py | 2
funasr/fileio/npy_scp.py | 3
funasr/models/e2e_uni_asr.py | 2
funasr/models/encoder/opennmt_encoders/fsmn_encoder.py | 1
funasr/layers/sinc_conv.py | 4
funasr/runtime/docs/images/aliyun2.png | 0
funasr/runtime/docs/SDK_advanced_guide_cn.md | 256 ++++++++++
funasr/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py | 2
funasr/tasks/sv.py | 9
funasr/models/decoder/contextual_decoder.py | 2
funasr/tasks/data2vec.py | 8
funasr/tasks/asr.py | 22
funasr/runtime/readme.md | 30 +
funasr/models/frontend/wav_frontend.py | 4
funasr/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py | 1
funasr/schedulers/tri_stage_scheduler.py | 2
funasr/bin/tp_infer.py | 3
funasr/models/frontend/default.py | 3
funasr/bin/tokenize_text.py | 2
funasr/models/ctc.py | 7
egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/infer.py | 33 -
funasr/bin/asr_inference_launch.py | 9
funasr/runtime/python/libtorch/funasr_torch/utils/frontend.py | 2
139 files changed, 681 insertions(+), 702 deletions(-)
diff --git a/egs/alimeeting/sa_asr/local/format_wav_scp.py b/egs/alimeeting/sa_asr/local/format_wav_scp.py
index 1fd63d6..cb0eac3 100755
--- a/egs/alimeeting/sa_asr/local/format_wav_scp.py
+++ b/egs/alimeeting/sa_asr/local/format_wav_scp.py
@@ -11,7 +11,6 @@
import resampy
import soundfile
from tqdm import tqdm
-from typeguard import check_argument_types
from funasr.utils.cli_utils import get_commandline_args
from funasr.fileio.read_text import read_2column_text
@@ -31,7 +30,6 @@
(3, 4, 5)
"""
- assert check_argument_types()
if integers.strip() in ("none", "None", "NONE", "null", "Null", "NULL"):
return None
return tuple(map(int, integers.strip().split(",")))
diff --git a/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/finetune.py b/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/finetune.py
index 0393212..79fd34d 100644
--- a/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/finetune.py
+++ b/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/finetune.py
@@ -1,5 +1,4 @@
import os
-<<<<<<< HEAD
from modelscope.metainfo import Trainers
from modelscope.trainers import build_trainer
@@ -21,50 +20,17 @@
batch_bins=params.batch_bins,
max_epoch=params.max_epoch,
lr=params.lr)
-=======
-from modelscope.metainfo import Trainers
-from modelscope.trainers import build_trainer
-from funasr.datasets.ms_dataset import MsDataset
-
-
-def modelscope_finetune(params):
- if not os.path.exists(params["output_dir"]):
- os.makedirs(params["output_dir"], exist_ok=True)
- # dataset split ["train", "validation"]
- ds_dict = MsDataset.load(params["data_dir"])
- kwargs = dict(
- model=params["model"],
- model_revision=params["model_revision"],
- data_dir=ds_dict,
- dataset_type=params["dataset_type"],
- work_dir=params["output_dir"],
- batch_bins=params["batch_bins"],
- max_epoch=params["max_epoch"],
- lr=params["lr"])
->>>>>>> main
trainer = build_trainer(Trainers.speech_asr_trainer, default_args=kwargs)
trainer.train()
if __name__ == '__main__':
-<<<<<<< HEAD
params = modelscope_args(model="damo/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch", data_path="./data")
params.output_dir = "./checkpoint" # m妯″瀷淇濆瓨璺緞
params.data_path = "./example_data/" # 鏁版嵁璺緞
params.dataset_type = "small" # 灏忔暟鎹噺璁剧疆small锛岃嫢鏁版嵁閲忓ぇ浜�1000灏忔椂锛岃浣跨敤large
params.batch_bins = 2000 # batch size锛屽鏋渄ataset_type="small"锛宐atch_bins鍗曚綅涓篺bank鐗瑰緛甯ф暟锛屽鏋渄ataset_type="large"锛宐atch_bins鍗曚綅涓烘绉掞紝
- params.max_epoch = 50 # 鏈�澶ц缁冭疆鏁�
+ params.max_epoch = 20 # 鏈�澶ц缁冭疆鏁�
params.lr = 0.00005 # 璁剧疆瀛︿範鐜�
-=======
- params = {}
- params["output_dir"] = "./checkpoint"
- params["data_dir"] = "./data"
- params["batch_bins"] = 2000
- params["dataset_type"] = "small"
- params["max_epoch"] = 50
- params["lr"] = 0.00005
- params["model"] = "damo/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch"
- params["model_revision"] = None
->>>>>>> main
- modelscope_finetune(params)
+ modelscope_finetune(params)
\ No newline at end of file
diff --git a/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/infer.py b/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/infer.py
index a0f0965..da8859e 100644
--- a/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/infer.py
+++ b/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch/infer.py
@@ -1,33 +1,3 @@
-<<<<<<< HEAD
-import os
-import shutil
-import argparse
-from modelscope.pipelines import pipeline
-from modelscope.utils.constant import Tasks
-
-def modelscope_infer(args):
- os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpuid)
- inference_pipeline = pipeline(
- task=Tasks.auto_speech_recognition,
- model=args.model,
- output_dir=args.output_dir,
- batch_size=args.batch_size,
- param_dict={"decoding_model": args.decoding_mode, "hotword": args.hotword_txt}
- )
- inference_pipeline(audio_in=args.audio_in)
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument('--model', type=str, default="damo/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch")
- parser.add_argument('--audio_in', type=str, default="./data/test/wav.scp")
- parser.add_argument('--output_dir', type=str, default="./results/")
- parser.add_argument('--decoding_mode', type=str, default="normal")
- parser.add_argument('--hotword_txt', type=str, default=None)
- parser.add_argument('--batch_size', type=int, default=64)
- parser.add_argument('--gpuid', type=str, default="0")
- args = parser.parse_args()
- modelscope_infer(args)
-=======
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
@@ -40,5 +10,4 @@
output_dir=output_dir,
)
rec_result = inference_pipeline(audio_in=audio_in, param_dict={"decoding_model":"offline"})
- print(rec_result)
->>>>>>> main
+ print(rec_result)
\ No newline at end of file
diff --git a/funasr/bin/asr_infer.py b/funasr/bin/asr_infer.py
index a537a73..259a286 100644
--- a/funasr/bin/asr_infer.py
+++ b/funasr/bin/asr_infer.py
@@ -22,9 +22,7 @@
import requests
import torch
from packaging.version import parse as V
-from typeguard import check_argument_types
-from typeguard import check_return_type
-from funasr.build_utils.build_model_from_file import build_model_from_file
+from funasr.build_utils.build_model_from_file import build_model_from_file
from funasr.models.e2e_asr_contextual_paraformer import NeatContextualParaformer
from funasr.models.e2e_asr_paraformer import BiCifParaformer, ContextualParaformer
from funasr.models.frontend.wav_frontend import WavFrontend, WavFrontendOnline
@@ -78,7 +76,6 @@
frontend_conf: dict = None,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -192,7 +189,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
@@ -248,7 +244,6 @@
text = None
results.append((text, token, token_int, hyp))
- assert check_return_type(results)
return results
@@ -288,7 +283,6 @@
decoding_ind: int = 0,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -413,7 +407,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
@@ -516,7 +509,6 @@
vad_offset=begin_time)
results.append((text, token, token_int, hyp, timestamp, enc_len_batch_total, lfr_factor))
- # assert check_return_type(results)
return results
def generate_hotwords_list(self, hotword_list_or_file):
@@ -656,7 +648,6 @@
hotword_list_or_file: str = None,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -776,7 +767,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
results = []
cache_en = cache["encoder"]
if speech.shape[1] < 16 * 60 and cache_en["is_final"]:
@@ -871,7 +861,6 @@
results.append(postprocessed_result)
- # assert check_return_type(results)
return results
@@ -912,7 +901,6 @@
frontend_conf: dict = None,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -1036,7 +1024,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
@@ -1104,7 +1091,6 @@
text = None
results.append((text, token, token_int, hyp))
- assert check_return_type(results)
return results
@@ -1143,7 +1129,6 @@
streaming: bool = False,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -1248,7 +1233,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
speech = torch.tensor(speech)
@@ -1298,7 +1282,6 @@
text = None
results.append((text, token, token_int, hyp))
- assert check_return_type(results)
return results
@@ -1355,7 +1338,6 @@
"""Construct a Speech2Text object."""
super().__init__()
- assert check_argument_types()
asr_model, asr_train_args = build_model_from_file(
asr_train_config, asr_model_file, cmvn_file, device
)
@@ -1534,7 +1516,6 @@
Returns:
nbest_hypothesis: N-best hypothesis.
"""
- assert check_argument_types()
if isinstance(speech, np.ndarray):
speech = torch.tensor(speech)
@@ -1566,7 +1547,6 @@
Returns:
nbest_hypothesis: N-best hypothesis.
"""
- assert check_argument_types()
if isinstance(speech, np.ndarray):
speech = torch.tensor(speech)
@@ -1608,35 +1588,8 @@
text = None
results.append((text, token, token_int, hyp))
- assert check_return_type(results)
return results
-
- @staticmethod
- def from_pretrained(
- model_tag: Optional[str] = None,
- **kwargs: Optional[Any],
- ) -> Speech2Text:
- """Build Speech2Text instance from the pretrained model.
- Args:
- model_tag: Model tag of the pretrained models.
- Return:
- : Speech2Text instance.
- """
- if model_tag is not None:
- try:
- from espnet_model_zoo.downloader import ModelDownloader
-
- except ImportError:
- logging.error(
- "`espnet_model_zoo` is not installed. "
- "Please install via `pip install -U espnet_model_zoo`."
- )
- raise
- d = ModelDownloader()
- kwargs.update(**d.download_and_unpack(model_tag))
-
- return Speech2TextTransducer(**kwargs)
class Speech2TextSAASR:
@@ -1675,7 +1628,6 @@
frontend_conf: dict = None,
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
scorers = {}
@@ -1793,7 +1745,6 @@
text, text_id, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
@@ -1886,5 +1837,4 @@
results.append((text, text_id, token, token_int, hyp))
- assert check_return_type(results)
return results
diff --git a/funasr/bin/asr_inference_launch.py b/funasr/bin/asr_inference_launch.py
index 5d1b804..37a5fe4 100644
--- a/funasr/bin/asr_inference_launch.py
+++ b/funasr/bin/asr_inference_launch.py
@@ -21,7 +21,6 @@
import torchaudio
import soundfile
import yaml
-from typeguard import check_argument_types
from funasr.bin.asr_infer import Speech2Text
from funasr.bin.asr_infer import Speech2TextMFCCA
@@ -80,7 +79,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
if batch_size > 1:
@@ -240,7 +238,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
@@ -481,7 +478,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
@@ -749,7 +745,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
if word_lm_train_config is not None:
raise NotImplementedError("Word LM is not implemented")
@@ -957,7 +952,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
if batch_size > 1:
@@ -1126,7 +1120,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
if batch_size > 1:
@@ -1314,7 +1307,6 @@
right_context: Number of frames in right context AFTER subsampling.
display_partial_hypotheses: Whether to display partial hypotheses.
"""
- assert check_argument_types()
if batch_size > 1:
raise NotImplementedError("batch decoding is not implemented")
@@ -1464,7 +1456,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
if batch_size > 1:
raise NotImplementedError("batch decoding is not implemented")
if word_lm_train_config is not None:
diff --git a/funasr/bin/diar_infer.py b/funasr/bin/diar_infer.py
index 7c41b60..3efa641 100755
--- a/funasr/bin/diar_infer.py
+++ b/funasr/bin/diar_infer.py
@@ -15,7 +15,6 @@
import torch
from scipy.ndimage import median_filter
from torch.nn import functional as F
-from typeguard import check_argument_types
from funasr.models.frontend.wav_frontend import WavFrontendMel23
from funasr.tasks.diar import DiarTask
@@ -45,7 +44,6 @@
device: str = "cpu",
dtype: str = "float32",
):
- assert check_argument_types()
# 1. Build Diarization model
diar_model, diar_train_args = build_model_from_file(
@@ -88,7 +86,6 @@
diarization results
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
speech = torch.tensor(speech)
@@ -106,36 +103,6 @@
results = self.diar_model.estimate_sequential(**batch)
return results
-
- @staticmethod
- def from_pretrained(
- model_tag: Optional[str] = None,
- **kwargs: Optional[Any],
- ):
- """Build Speech2Diarization instance from the pretrained model.
-
- Args:
- model_tag (Optional[str]): Model tag of the pretrained models.
- Currently, the tags of espnet_model_zoo are supported.
-
- Returns:
- Speech2Diarization: Speech2Diarization instance.
-
- """
- if model_tag is not None:
- try:
- from espnet_model_zoo.downloader import ModelDownloader
-
- except ImportError:
- logging.error(
- "`espnet_model_zoo` is not installed. "
- "Please install via `pip install -U espnet_model_zoo`."
- )
- raise
- d = ModelDownloader()
- kwargs.update(**d.download_and_unpack(model_tag))
-
- return Speech2DiarizationEEND(**kwargs)
class Speech2DiarizationSOND:
@@ -163,7 +130,6 @@
smooth_size: int = 83,
dur_threshold: float = 10,
):
- assert check_argument_types()
# TODO: 1. Build Diarization model
diar_model, diar_train_args = build_model_from_file(
@@ -283,7 +249,6 @@
diarization results for each speaker
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
speech = torch.tensor(speech)
@@ -305,33 +270,3 @@
results, pse_labels = self.post_processing(logits, profile.shape[1], output_format)
return results, pse_labels
-
- @staticmethod
- def from_pretrained(
- model_tag: Optional[str] = None,
- **kwargs: Optional[Any],
- ):
- """Build Speech2Xvector instance from the pretrained model.
-
- Args:
- model_tag (Optional[str]): Model tag of the pretrained models.
- Currently, the tags of espnet_model_zoo are supported.
-
- Returns:
- Speech2Xvector: Speech2Xvector instance.
-
- """
- if model_tag is not None:
- try:
- from espnet_model_zoo.downloader import ModelDownloader
-
- except ImportError:
- logging.error(
- "`espnet_model_zoo` is not installed. "
- "Please install via `pip install -U espnet_model_zoo`."
- )
- raise
- d = ModelDownloader()
- kwargs.update(**d.download_and_unpack(model_tag))
-
- return Speech2DiarizationSOND(**kwargs)
diff --git a/funasr/bin/diar_inference_launch.py b/funasr/bin/diar_inference_launch.py
index 820217b..03c9659 100755
--- a/funasr/bin/diar_inference_launch.py
+++ b/funasr/bin/diar_inference_launch.py
@@ -18,7 +18,6 @@
import soundfile
import torch
from scipy.signal import medfilt
-from typeguard import check_argument_types
from funasr.bin.diar_infer import Speech2DiarizationSOND, Speech2DiarizationEEND
from funasr.datasets.iterable_dataset import load_bytes
@@ -52,7 +51,6 @@
mode: str = "sond",
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
if batch_size > 1:
@@ -233,7 +231,6 @@
param_dict: Optional[dict] = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
if batch_size > 1:
diff --git a/funasr/bin/lm_inference_launch.py b/funasr/bin/lm_inference_launch.py
index c8482b8..236a923 100644
--- a/funasr/bin/lm_inference_launch.py
+++ b/funasr/bin/lm_inference_launch.py
@@ -15,7 +15,6 @@
import numpy as np
import torch
from torch.nn.parallel import data_parallel
-from typeguard import check_argument_types
from funasr.build_utils.build_model_from_file import build_model_from_file
from funasr.build_utils.build_streaming_iterator import build_streaming_iterator
@@ -50,7 +49,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
diff --git a/funasr/bin/punc_inference_launch.py b/funasr/bin/punc_inference_launch.py
index 8fc15f0..5d917f5 100755
--- a/funasr/bin/punc_inference_launch.py
+++ b/funasr/bin/punc_inference_launch.py
@@ -14,7 +14,6 @@
from typing import Union
import torch
-from typeguard import check_argument_types
from funasr.bin.punc_infer import Text2Punc, Text2PuncVADRealtime
from funasr.torch_utils.set_all_random_seed import set_all_random_seed
@@ -38,7 +37,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
logging.basicConfig(
level=log_level,
format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
@@ -118,7 +116,6 @@
param_dict: dict = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
diff --git a/funasr/bin/sv_infer.py b/funasr/bin/sv_infer.py
index 6e861da..346440a 100755
--- a/funasr/bin/sv_infer.py
+++ b/funasr/bin/sv_infer.py
@@ -12,8 +12,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.build_utils.build_model_from_file import build_model_from_file
from funasr.torch_utils.device_funcs import to_device
@@ -42,7 +40,6 @@
streaming: bool = False,
embedding_node: str = "resnet1_dense",
):
- assert check_argument_types()
# TODO: 1. Build SV model
sv_model, sv_train_args = build_model_from_file(
@@ -108,7 +105,6 @@
embedding, ref_embedding, similarity_score
"""
- assert check_argument_types()
self.sv_model.eval()
embedding = self.calculate_embedding(speech)
ref_emb, score = None, None
@@ -117,35 +113,4 @@
score = torch.cosine_similarity(embedding, ref_emb)
results = (embedding, ref_emb, score)
- assert check_return_type(results)
return results
-
- @staticmethod
- def from_pretrained(
- model_tag: Optional[str] = None,
- **kwargs: Optional[Any],
- ):
- """Build Speech2Xvector instance from the pretrained model.
-
- Args:
- model_tag (Optional[str]): Model tag of the pretrained models.
- Currently, the tags of espnet_model_zoo are supported.
-
- Returns:
- Speech2Xvector: Speech2Xvector instance.
-
- """
- if model_tag is not None:
- try:
- from espnet_model_zoo.downloader import ModelDownloader
-
- except ImportError:
- logging.error(
- "`espnet_model_zoo` is not installed. "
- "Please install via `pip install -U espnet_model_zoo`."
- )
- raise
- d = ModelDownloader()
- kwargs.update(**d.download_and_unpack(model_tag))
-
- return Speech2Xvector(**kwargs)
diff --git a/funasr/bin/sv_inference_launch.py b/funasr/bin/sv_inference_launch.py
index d165736..2f9e276 100755
--- a/funasr/bin/sv_inference_launch.py
+++ b/funasr/bin/sv_inference_launch.py
@@ -15,7 +15,6 @@
import numpy as np
import torch
from kaldiio import WriteHelper
-from typeguard import check_argument_types
from funasr.bin.sv_infer import Speech2Xvector
from funasr.build_utils.build_streaming_iterator import build_streaming_iterator
@@ -46,7 +45,6 @@
param_dict: Optional[dict] = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
@@ -79,10 +77,7 @@
embedding_node=embedding_node
)
logging.info("speech2xvector_kwargs: {}".format(speech2xvector_kwargs))
- speech2xvector = Speech2Xvector.from_pretrained(
- model_tag=model_tag,
- **speech2xvector_kwargs,
- )
+ speech2xvector = Speech2Xvector(**speech2xvector_kwargs)
speech2xvector.sv_model.eval()
def _forward(
diff --git a/funasr/bin/tokenize_text.py b/funasr/bin/tokenize_text.py
index dc565d0..6ec83a8 100755
--- a/funasr/bin/tokenize_text.py
+++ b/funasr/bin/tokenize_text.py
@@ -7,7 +7,6 @@
from typing import List
from typing import Optional
-from typeguard import check_argument_types
from funasr.utils.cli_utils import get_commandline_args
from funasr.text.build_tokenizer import build_tokenizer
@@ -81,7 +80,6 @@
cleaner: Optional[str],
g2p: Optional[str],
):
- assert check_argument_types()
logging.basicConfig(
level=log_level,
diff --git a/funasr/bin/tp_infer.py b/funasr/bin/tp_infer.py
index 213c018..ede579c 100644
--- a/funasr/bin/tp_infer.py
+++ b/funasr/bin/tp_infer.py
@@ -9,7 +9,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.build_utils.build_model_from_file import build_model_from_file
from funasr.models.frontend.wav_frontend import WavFrontend
from funasr.text.token_id_converter import TokenIDConverter
@@ -26,7 +25,6 @@
dtype: str = "float32",
**kwargs,
):
- assert check_argument_types()
# 1. Build ASR model
tp_model, tp_train_args = build_model_from_file(
timestamp_infer_config, timestamp_model_file, cmvn_file=None, device=device, task_name="asr", mode="tp"
@@ -64,7 +62,6 @@
speech_lengths: Union[torch.Tensor, np.ndarray] = None,
text_lengths: Union[torch.Tensor, np.ndarray] = None
):
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
diff --git a/funasr/bin/tp_inference_launch.py b/funasr/bin/tp_inference_launch.py
index 3f8df0c..6c10254 100644
--- a/funasr/bin/tp_inference_launch.py
+++ b/funasr/bin/tp_inference_launch.py
@@ -13,7 +13,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.bin.tp_infer import Speech2Timestamp
from funasr.build_utils.build_streaming_iterator import build_streaming_iterator
@@ -47,7 +46,6 @@
seg_dict_file: Optional[str] = None,
**kwargs,
):
- assert check_argument_types()
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
diff --git a/funasr/bin/vad_infer.py b/funasr/bin/vad_infer.py
index f888bb4..c60a8f1 100644
--- a/funasr/bin/vad_infer.py
+++ b/funasr/bin/vad_infer.py
@@ -13,7 +13,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.build_utils.build_model_from_file import build_model_from_file
from funasr.models.frontend.wav_frontend import WavFrontend, WavFrontendOnline
@@ -42,7 +41,6 @@
dtype: str = "float32",
**kwargs,
):
- assert check_argument_types()
# 1. Build vad model
vad_model, vad_infer_args = build_model_from_file(
@@ -76,7 +74,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
@@ -149,7 +146,6 @@
text, token, token_int, hyp
"""
- assert check_argument_types()
# Input as audio signal
if isinstance(speech, np.ndarray):
diff --git a/funasr/bin/vad_inference_launch.py b/funasr/bin/vad_inference_launch.py
index 829f157..47af011 100644
--- a/funasr/bin/vad_inference_launch.py
+++ b/funasr/bin/vad_inference_launch.py
@@ -18,7 +18,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.build_utils.build_streaming_iterator import build_streaming_iterator
from funasr.fileio.datadir_writer import DatadirWriter
from funasr.torch_utils.set_all_random_seed import set_all_random_seed
@@ -47,7 +46,6 @@
num_workers: int = 1,
**kwargs,
):
- assert check_argument_types()
if batch_size > 1:
raise NotImplementedError("batch decoding is not implemented")
@@ -148,7 +146,6 @@
num_workers: int = 1,
**kwargs,
):
- assert check_argument_types()
logging.basicConfig(
level=log_level,
diff --git a/funasr/build_utils/build_model_from_file.py b/funasr/build_utils/build_model_from_file.py
index 8fd4e46..26542cd 100644
--- a/funasr/build_utils/build_model_from_file.py
+++ b/funasr/build_utils/build_model_from_file.py
@@ -6,7 +6,6 @@
import torch
import yaml
-from typeguard import check_argument_types
from funasr.build_utils.build_model import build_model
from funasr.models.base_model import FunASRModel
@@ -30,7 +29,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
diff --git a/funasr/build_utils/build_streaming_iterator.py b/funasr/build_utils/build_streaming_iterator.py
index 1b16cf4..02fc263 100644
--- a/funasr/build_utils/build_streaming_iterator.py
+++ b/funasr/build_utils/build_streaming_iterator.py
@@ -1,6 +1,5 @@
import numpy as np
from torch.utils.data import DataLoader
-from typeguard import check_argument_types
from funasr.datasets.iterable_dataset import IterableESPnetDataset
from funasr.datasets.small_datasets.collate_fn import CommonCollateFn
@@ -23,7 +22,6 @@
train: bool = False,
) -> DataLoader:
"""Build DataLoader using iterable dataset"""
- assert check_argument_types()
# preprocess
if preprocess_fn is not None:
diff --git a/funasr/build_utils/build_sv_model.py b/funasr/build_utils/build_sv_model.py
index c0f1ae8..55df75a 100644
--- a/funasr/build_utils/build_sv_model.py
+++ b/funasr/build_utils/build_sv_model.py
@@ -1,7 +1,6 @@
import logging
import torch
-from typeguard import check_return_type
from funasr.layers.abs_normalize import AbsNormalize
from funasr.layers.global_mvn import GlobalMVN
@@ -254,5 +253,4 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
diff --git a/funasr/build_utils/build_trainer.py b/funasr/build_utils/build_trainer.py
index aff99b5..03aa780 100644
--- a/funasr/build_utils/build_trainer.py
+++ b/funasr/build_utils/build_trainer.py
@@ -25,7 +25,6 @@
import torch
import torch.nn
import torch.optim
-from typeguard import check_argument_types
from funasr.iterators.abs_iter_factory import AbsIterFactory
from funasr.main_funcs.average_nbest_models import average_nbest_models
@@ -118,7 +117,6 @@
def build_options(self, args: argparse.Namespace) -> TrainerOptions:
"""Build options consumed by train(), eval()"""
- assert check_argument_types()
return build_dataclass(TrainerOptions, args)
@classmethod
@@ -156,7 +154,6 @@
def run(self) -> None:
"""Perform training. This method performs the main process of training."""
- assert check_argument_types()
# NOTE(kamo): Don't check the type more strictly as far trainer_options
model = self.model
optimizers = self.optimizers
@@ -522,7 +519,6 @@
options: TrainerOptions,
distributed_option: DistributedOption,
) -> Tuple[bool, bool]:
- assert check_argument_types()
grad_noise = options.grad_noise
accum_grad = options.accum_grad
@@ -758,7 +754,6 @@
options: TrainerOptions,
distributed_option: DistributedOption,
) -> None:
- assert check_argument_types()
ngpu = options.ngpu
# no_forward_run = options.no_forward_run
distributed = distributed_option.distributed
diff --git a/funasr/datasets/collate_fn.py b/funasr/datasets/collate_fn.py
index d34d610..cbc1f0b 100644
--- a/funasr/datasets/collate_fn.py
+++ b/funasr/datasets/collate_fn.py
@@ -6,8 +6,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.modules.nets_utils import pad_list
@@ -22,7 +20,6 @@
not_sequence: Collection[str] = (),
max_sample_size=None
):
- assert check_argument_types()
self.float_pad_value = float_pad_value
self.int_pad_value = int_pad_value
self.not_sequence = set(not_sequence)
@@ -53,7 +50,6 @@
) -> Tuple[List[str], Dict[str, torch.Tensor]]:
"""Concatenate ndarray-list to an array and convert to torch.Tensor.
"""
- assert check_argument_types()
uttids = [u for u, _ in data]
data = [d for _, d in data]
@@ -79,7 +75,6 @@
output[key + "_lengths"] = lens
output = (uttids, output)
- assert check_return_type(output)
return output
def crop_to_max_size(feature, target_size):
@@ -99,7 +94,6 @@
not_sequence: Collection[str] = (),
) -> Tuple[List[str], Dict[str, torch.Tensor]]:
# mainly for pre-training
- assert check_argument_types()
uttids = [u for u, _ in data]
data = [d for _, d in data]
@@ -131,5 +125,4 @@
output[key + "_lengths"] = lens
output = (uttids, output)
- assert check_return_type(output)
return output
\ No newline at end of file
diff --git a/funasr/datasets/dataset.py b/funasr/datasets/dataset.py
index 979479c..407f6aa 100644
--- a/funasr/datasets/dataset.py
+++ b/funasr/datasets/dataset.py
@@ -23,8 +23,6 @@
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.fileio.npy_scp import NpyScpReader
from funasr.fileio.rand_gen_dataset import FloatRandomGenerateDataset
@@ -37,7 +35,6 @@
class AdapterForSoundScpReader(collections.abc.Mapping):
def __init__(self, loader, dtype=None):
- assert check_argument_types()
self.loader = loader
self.dtype = dtype
self.rate = None
@@ -284,7 +281,6 @@
max_cache_fd: int = 0,
dest_sample_rate: int = 16000,
):
- assert check_argument_types()
if len(path_name_type_list) == 0:
raise ValueError(
'1 or more elements are required for "path_name_type_list"'
@@ -379,7 +375,6 @@
return _mes
def __getitem__(self, uid: Union[str, int]) -> Tuple[str, Dict[str, np.ndarray]]:
- assert check_argument_types()
# Change integer-id to string-id
if isinstance(uid, int):
@@ -444,5 +439,4 @@
self.cache[uid] = data
retval = uid, data
- assert check_return_type(retval)
return retval
diff --git a/funasr/datasets/iterable_dataset.py b/funasr/datasets/iterable_dataset.py
index d240d93..6398e0c 100644
--- a/funasr/datasets/iterable_dataset.py
+++ b/funasr/datasets/iterable_dataset.py
@@ -16,7 +16,6 @@
import torchaudio
import soundfile
from torch.utils.data.dataset import IterableDataset
-from typeguard import check_argument_types
import os.path
from funasr.datasets.dataset import ESPnetDataset
@@ -121,7 +120,6 @@
int_dtype: str = "long",
key_file: str = None,
):
- assert check_argument_types()
if len(path_name_type_list) == 0:
raise ValueError(
'1 or more elements are required for "path_name_type_list"'
diff --git a/funasr/datasets/large_datasets/build_dataloader.py b/funasr/datasets/large_datasets/build_dataloader.py
index aa5d9be..7a1a906 100644
--- a/funasr/datasets/large_datasets/build_dataloader.py
+++ b/funasr/datasets/large_datasets/build_dataloader.py
@@ -6,7 +6,6 @@
import sentencepiece as spm
from torch.utils.data import DataLoader
-from typeguard import check_argument_types
from funasr.datasets.large_datasets.dataset import Dataset
from funasr.iterators.abs_iter_factory import AbsIterFactory
@@ -43,7 +42,6 @@
class SentencepiecesTokenizer(AbsTokenizer):
def __init__(self, model: Union[Path, str]):
- assert check_argument_types()
self.model = str(model)
self.sp = None
diff --git a/funasr/datasets/preprocessor.py b/funasr/datasets/preprocessor.py
index 758c750..cb4288c 100644
--- a/funasr/datasets/preprocessor.py
+++ b/funasr/datasets/preprocessor.py
@@ -11,8 +11,6 @@
import numpy as np
import scipy.signal
import soundfile
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.text.build_tokenizer import build_tokenizer
from funasr.text.cleaner import TextCleaner
@@ -268,7 +266,6 @@
def _speech_process(
self, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, Union[str, np.ndarray]]:
- assert check_argument_types()
if self.speech_name in data:
if self.train and (self.rirs is not None or self.noises is not None):
speech = data[self.speech_name]
@@ -355,7 +352,6 @@
speech = data[self.speech_name]
ma = np.max(np.abs(speech))
data[self.speech_name] = speech * self.speech_volume_normalize / ma
- assert check_return_type(data)
return data
def _text_process(
@@ -372,13 +368,11 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[self.text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
def __call__(
self, uid: str, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, np.ndarray]:
- assert check_argument_types()
data = self._speech_process(data)
data = self._text_process(data)
@@ -445,7 +439,6 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[self.text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
@@ -502,13 +495,11 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[text_n] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
def __call__(
self, uid: str, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, np.ndarray]:
- assert check_argument_types()
if self.speech_name in data:
# Nothing now: candidates:
@@ -612,7 +603,6 @@
tokens = self.tokenizer[i].text2tokens(text)
text_ints = self.token_id_converter[i].tokens2ids(tokens)
data[text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
class CodeMixTokenizerCommonPreprocessor(CommonPreprocessor):
@@ -690,7 +680,6 @@
def __call__(
self, uid: str, data: Dict[str, Union[list, str, np.ndarray]]
) -> Dict[str, Union[list, np.ndarray]]:
- assert check_argument_types()
# Split words.
if isinstance(data[self.text_name], str):
split_text = self.split_words(data[self.text_name])
diff --git a/funasr/datasets/small_datasets/collate_fn.py b/funasr/datasets/small_datasets/collate_fn.py
index 573f581..5fd4162 100644
--- a/funasr/datasets/small_datasets/collate_fn.py
+++ b/funasr/datasets/small_datasets/collate_fn.py
@@ -6,8 +6,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.modules.nets_utils import pad_list
@@ -22,7 +20,6 @@
not_sequence: Collection[str] = (),
max_sample_size=None
):
- assert check_argument_types()
self.float_pad_value = float_pad_value
self.int_pad_value = int_pad_value
self.not_sequence = set(not_sequence)
@@ -53,7 +50,6 @@
) -> Tuple[List[str], Dict[str, torch.Tensor]]:
"""Concatenate ndarray-list to an array and convert to torch.Tensor.
"""
- assert check_argument_types()
uttids = [u for u, _ in data]
data = [d for _, d in data]
@@ -79,7 +75,6 @@
output[key + "_lengths"] = lens
output = (uttids, output)
- assert check_return_type(output)
return output
def crop_to_max_size(feature, target_size):
diff --git a/funasr/datasets/small_datasets/dataset.py b/funasr/datasets/small_datasets/dataset.py
index 123f109..bee9f50 100644
--- a/funasr/datasets/small_datasets/dataset.py
+++ b/funasr/datasets/small_datasets/dataset.py
@@ -15,8 +15,6 @@
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.fileio.npy_scp import NpyScpReader
from funasr.fileio.sound_scp import SoundScpReader
@@ -24,7 +22,6 @@
class AdapterForSoundScpReader(collections.abc.Mapping):
def __init__(self, loader, dtype=None):
- assert check_argument_types()
self.loader = loader
self.dtype = dtype
self.rate = None
@@ -112,7 +109,6 @@
speed_perturb: Union[list, tuple] = None,
mode: str = "train",
):
- assert check_argument_types()
if len(path_name_type_list) == 0:
raise ValueError(
'1 or more elements are required for "path_name_type_list"'
@@ -207,7 +203,6 @@
return _mes
def __getitem__(self, uid: Union[str, int]) -> Tuple[str, Dict[str, np.ndarray]]:
- assert check_argument_types()
# Change integer-id to string-id
if isinstance(uid, int):
@@ -265,5 +260,4 @@
data[name] = value
retval = uid, data
- assert check_return_type(retval)
return retval
diff --git a/funasr/datasets/small_datasets/length_batch_sampler.py b/funasr/datasets/small_datasets/length_batch_sampler.py
index 8ee8bdc..28404e3 100644
--- a/funasr/datasets/small_datasets/length_batch_sampler.py
+++ b/funasr/datasets/small_datasets/length_batch_sampler.py
@@ -4,7 +4,6 @@
from typing import Tuple
from typing import Union
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
from funasr.samplers.abs_sampler import AbsSampler
@@ -21,7 +20,6 @@
drop_last: bool = False,
padding: bool = True,
):
- assert check_argument_types()
assert batch_bins > 0
if sort_batch != "ascending" and sort_batch != "descending":
raise ValueError(
diff --git a/funasr/datasets/small_datasets/preprocessor.py b/funasr/datasets/small_datasets/preprocessor.py
index d80f48a..0ebf325 100644
--- a/funasr/datasets/small_datasets/preprocessor.py
+++ b/funasr/datasets/small_datasets/preprocessor.py
@@ -10,8 +10,6 @@
import numpy as np
import scipy.signal
import soundfile
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.text.build_tokenizer import build_tokenizer
from funasr.text.cleaner import TextCleaner
@@ -260,7 +258,6 @@
def _speech_process(
self, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, Union[str, np.ndarray]]:
- assert check_argument_types()
if self.speech_name in data:
if self.train and (self.rirs is not None or self.noises is not None):
speech = data[self.speech_name]
@@ -347,7 +344,6 @@
speech = data[self.speech_name]
ma = np.max(np.abs(speech))
data[self.speech_name] = speech * self.speech_volume_normalize / ma
- assert check_return_type(data)
return data
def _text_process(
@@ -365,13 +361,11 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[self.text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
def __call__(
self, uid: str, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, np.ndarray]:
- assert check_argument_types()
data = self._speech_process(data)
data = self._text_process(data)
@@ -439,7 +433,6 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[self.text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
@@ -496,13 +489,11 @@
tokens = self.tokenizer.text2tokens(text)
text_ints = self.token_id_converter.tokens2ids(tokens)
data[text_n] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
def __call__(
self, uid: str, data: Dict[str, Union[str, np.ndarray]]
) -> Dict[str, np.ndarray]:
- assert check_argument_types()
if self.speech_name in data:
# Nothing now: candidates:
@@ -606,7 +597,6 @@
tokens = self.tokenizer[i].text2tokens(text)
text_ints = self.token_id_converter[i].tokens2ids(tokens)
data[text_name] = np.array(text_ints, dtype=np.int64)
- assert check_return_type(data)
return data
@@ -685,7 +675,6 @@
def __call__(
self, uid: str, data: Dict[str, Union[list, str, np.ndarray]]
) -> Dict[str, Union[list, np.ndarray]]:
- assert check_argument_types()
# Split words.
if isinstance(data[self.text_name], str):
split_text = self.split_words(data[self.text_name])
diff --git a/funasr/export/export_model.py b/funasr/export/export_model.py
index b141532..a68724a 100644
--- a/funasr/export/export_model.py
+++ b/funasr/export/export_model.py
@@ -1,7 +1,6 @@
import json
from typing import Union, Dict
from pathlib import Path
-from typeguard import check_argument_types
import os
import logging
@@ -26,7 +25,6 @@
calib_num: int = 200,
model_revision: str = None,
):
- assert check_argument_types()
self.set_all_random_seed(0)
self.cache_dir = cache_dir
diff --git a/funasr/fileio/datadir_writer.py b/funasr/fileio/datadir_writer.py
index 67ec61c..e555ebc 100644
--- a/funasr/fileio/datadir_writer.py
+++ b/funasr/fileio/datadir_writer.py
@@ -2,8 +2,6 @@
from typing import Union
import warnings
-from typeguard import check_argument_types
-from typeguard import check_return_type
class DatadirWriter:
@@ -20,7 +18,6 @@
"""
def __init__(self, p: Union[Path, str]):
- assert check_argument_types()
self.path = Path(p)
self.chilidren = {}
self.fd = None
@@ -31,7 +28,6 @@
return self
def __getitem__(self, key: str) -> "DatadirWriter":
- assert check_argument_types()
if self.fd is not None:
raise RuntimeError("This writer points out a file")
@@ -41,11 +37,9 @@
self.has_children = True
retval = self.chilidren[key]
- assert check_return_type(retval)
return retval
def __setitem__(self, key: str, value: str):
- assert check_argument_types()
if self.has_children:
raise RuntimeError("This writer points out a directory")
if key in self.keys:
diff --git a/funasr/fileio/npy_scp.py b/funasr/fileio/npy_scp.py
index 26666b6..2bd5b58 100644
--- a/funasr/fileio/npy_scp.py
+++ b/funasr/fileio/npy_scp.py
@@ -3,7 +3,6 @@
from typing import Union
import numpy as np
-from typeguard import check_argument_types
from funasr.fileio.read_text import read_2column_text
@@ -25,7 +24,6 @@
"""
def __init__(self, outdir: Union[Path, str], scpfile: Union[Path, str]):
- assert check_argument_types()
self.dir = Path(outdir)
self.dir.mkdir(parents=True, exist_ok=True)
scpfile = Path(scpfile)
@@ -73,7 +71,6 @@
"""
def __init__(self, fname: Union[Path, str]):
- assert check_argument_types()
self.fname = Path(fname)
self.data = read_2column_text(fname)
diff --git a/funasr/fileio/rand_gen_dataset.py b/funasr/fileio/rand_gen_dataset.py
index 2faef3a..699e67a 100644
--- a/funasr/fileio/rand_gen_dataset.py
+++ b/funasr/fileio/rand_gen_dataset.py
@@ -3,7 +3,6 @@
from typing import Union
import numpy as np
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
@@ -29,7 +28,6 @@
dtype: Union[str, np.dtype] = "float32",
loader_type: str = "csv_int",
):
- assert check_argument_types()
shape_file = Path(shape_file)
self.utt2shape = load_num_sequence_text(shape_file, loader_type)
self.dtype = np.dtype(dtype)
@@ -68,7 +66,6 @@
dtype: Union[str, np.dtype] = "int64",
loader_type: str = "csv_int",
):
- assert check_argument_types()
shape_file = Path(shape_file)
self.utt2shape = load_num_sequence_text(shape_file, loader_type)
self.dtype = np.dtype(dtype)
diff --git a/funasr/fileio/read_text.py b/funasr/fileio/read_text.py
index e26e7a1..f140c31 100644
--- a/funasr/fileio/read_text.py
+++ b/funasr/fileio/read_text.py
@@ -4,7 +4,6 @@
from typing import List
from typing import Union
-from typeguard import check_argument_types
def read_2column_text(path: Union[Path, str]) -> Dict[str, str]:
@@ -19,7 +18,6 @@
{'key1': '/some/path/a.wav', 'key2': '/some/path/b.wav'}
"""
- assert check_argument_types()
data = {}
with Path(path).open("r", encoding="utf-8") as f:
@@ -47,7 +45,6 @@
>>> d = load_num_sequence_text('text')
>>> np.testing.assert_array_equal(d["key1"], np.array([1, 2, 3]))
"""
- assert check_argument_types()
if loader_type == "text_int":
delimiter = " "
dtype = int
diff --git a/funasr/fileio/sound_scp.py b/funasr/fileio/sound_scp.py
index 9b25fe5..b912f1e 100644
--- a/funasr/fileio/sound_scp.py
+++ b/funasr/fileio/sound_scp.py
@@ -6,7 +6,6 @@
import numpy as np
import soundfile
import librosa
-from typeguard import check_argument_types
import torch
import torchaudio
@@ -106,7 +105,6 @@
dest_sample_rate: int = 16000,
speed_perturb: Union[list, tuple] = None,
):
- assert check_argument_types()
self.fname = fname
self.dtype = dtype
self.always_2d = always_2d
@@ -179,7 +177,6 @@
format="wav",
dtype=None,
):
- assert check_argument_types()
self.dir = Path(outdir)
self.dir.mkdir(parents=True, exist_ok=True)
scpfile = Path(scpfile)
diff --git a/funasr/iterators/chunk_iter_factory.py b/funasr/iterators/chunk_iter_factory.py
index cec6370..5a54632 100644
--- a/funasr/iterators/chunk_iter_factory.py
+++ b/funasr/iterators/chunk_iter_factory.py
@@ -9,7 +9,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.iterators.abs_iter_factory import AbsIterFactory
from funasr.iterators.sequence_iter_factory import SequenceIterFactory
@@ -51,7 +50,6 @@
collate_fn=None,
pin_memory: bool = False,
):
- assert check_argument_types()
assert all(len(x) == 1 for x in batches), "batch-size must be 1"
self.per_sample_iter_factory = SequenceIterFactory(
diff --git a/funasr/iterators/multiple_iter_factory.py b/funasr/iterators/multiple_iter_factory.py
index 088016c..3587a2a 100644
--- a/funasr/iterators/multiple_iter_factory.py
+++ b/funasr/iterators/multiple_iter_factory.py
@@ -4,7 +4,6 @@
from typing import Iterator
import numpy as np
-from typeguard import check_argument_types
from funasr.iterators.abs_iter_factory import AbsIterFactory
@@ -16,7 +15,6 @@
seed: int = 0,
shuffle: bool = False,
):
- assert check_argument_types()
self.build_funcs = list(build_funcs)
self.seed = seed
self.shuffle = shuffle
diff --git a/funasr/iterators/sequence_iter_factory.py b/funasr/iterators/sequence_iter_factory.py
index 39d0834..41de37c 100644
--- a/funasr/iterators/sequence_iter_factory.py
+++ b/funasr/iterators/sequence_iter_factory.py
@@ -4,7 +4,6 @@
import numpy as np
from torch.utils.data import DataLoader
-from typeguard import check_argument_types
from funasr.iterators.abs_iter_factory import AbsIterFactory
from funasr.samplers.abs_sampler import AbsSampler
@@ -46,7 +45,6 @@
collate_fn=None,
pin_memory: bool = False,
):
- assert check_argument_types()
if not isinstance(batches, AbsSampler):
self.sampler = RawSampler(batches)
diff --git a/funasr/layers/global_mvn.py b/funasr/layers/global_mvn.py
index 8e43582..b94e9ca 100644
--- a/funasr/layers/global_mvn.py
+++ b/funasr/layers/global_mvn.py
@@ -4,7 +4,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.layers.abs_normalize import AbsNormalize
@@ -28,7 +27,6 @@
norm_vars: bool = True,
eps: float = 1.0e-20,
):
- assert check_argument_types()
super().__init__()
self.norm_means = norm_means
self.norm_vars = norm_vars
diff --git a/funasr/layers/label_aggregation.py b/funasr/layers/label_aggregation.py
index 29a08a9..8366a79 100644
--- a/funasr/layers/label_aggregation.py
+++ b/funasr/layers/label_aggregation.py
@@ -1,5 +1,4 @@
import torch
-from typeguard import check_argument_types
from typing import Optional
from typing import Tuple
@@ -13,7 +12,6 @@
hop_length: int = 128,
center: bool = True,
):
- assert check_argument_types()
super().__init__()
self.win_length = win_length
diff --git a/funasr/layers/mask_along_axis.py b/funasr/layers/mask_along_axis.py
index e49e621..416c4ea 100644
--- a/funasr/layers/mask_along_axis.py
+++ b/funasr/layers/mask_along_axis.py
@@ -1,6 +1,5 @@
import math
import torch
-from typeguard import check_argument_types
from typing import Sequence
from typing import Union
@@ -147,7 +146,6 @@
dim: Union[int, str] = "time",
replace_with_zero: bool = True,
):
- assert check_argument_types()
if isinstance(mask_width_range, int):
mask_width_range = (0, mask_width_range)
if len(mask_width_range) != 2:
@@ -214,7 +212,6 @@
dim: Union[int, str] = "time",
replace_with_zero: bool = True,
):
- assert check_argument_types()
if isinstance(mask_width_ratio_range, float):
mask_width_ratio_range = (0.0, mask_width_ratio_range)
if len(mask_width_ratio_range) != 2:
@@ -283,7 +280,6 @@
replace_with_zero: bool = True,
lfr_rate: int = 1,
):
- assert check_argument_types()
if isinstance(mask_width_range, int):
mask_width_range = (0, mask_width_range)
if len(mask_width_range) != 2:
diff --git a/funasr/layers/sinc_conv.py b/funasr/layers/sinc_conv.py
index 33df97f..ab16a73 100644
--- a/funasr/layers/sinc_conv.py
+++ b/funasr/layers/sinc_conv.py
@@ -5,7 +5,6 @@
"""Sinc convolutions."""
import math
import torch
-from typeguard import check_argument_types
from typing import Union
@@ -71,7 +70,6 @@
window_func: Window function on the filter, one of ["hamming", "none"].
fs (str, int, float): Sample rate of the input data
"""
- assert check_argument_types()
super().__init__()
window_funcs = {
"none": self.none_window,
@@ -208,7 +206,6 @@
torch.Tensor: Filter start frequenc铆es.
torch.Tensor: Filter stop frequencies.
"""
- assert check_argument_types()
# min and max bandpass edge frequencies
min_frequency = torch.tensor(30.0)
max_frequency = torch.tensor(fs * 0.5)
@@ -257,7 +254,6 @@
torch.Tensor: Filter start frequenc铆es.
torch.Tensor: Filter stop frequenc铆es.
"""
- assert check_argument_types()
# min and max BARK center frequencies by approximation
min_center_frequency = torch.tensor(70.0)
max_center_frequency = torch.tensor(fs * 0.45)
diff --git a/funasr/layers/stft.py b/funasr/layers/stft.py
index 376b5a3..dfb6919 100644
--- a/funasr/layers/stft.py
+++ b/funasr/layers/stft.py
@@ -5,7 +5,6 @@
import torch
from torch_complex.tensor import ComplexTensor
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.layers.complex_utils import is_complex
@@ -30,7 +29,6 @@
normalized: bool = False,
onesided: bool = True,
):
- assert check_argument_types()
super().__init__()
self.n_fft = n_fft
if win_length is None:
diff --git a/funasr/layers/utterance_mvn.py b/funasr/layers/utterance_mvn.py
index 50f27cd..7722974 100644
--- a/funasr/layers/utterance_mvn.py
+++ b/funasr/layers/utterance_mvn.py
@@ -1,7 +1,6 @@
from typing import Tuple
import torch
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.layers.abs_normalize import AbsNormalize
@@ -14,7 +13,6 @@
norm_vars: bool = False,
eps: float = 1.0e-20,
):
- assert check_argument_types()
super().__init__()
self.norm_means = norm_means
self.norm_vars = norm_vars
diff --git a/funasr/main_funcs/average_nbest_models.py b/funasr/main_funcs/average_nbest_models.py
index d8df949..96e1384 100644
--- a/funasr/main_funcs/average_nbest_models.py
+++ b/funasr/main_funcs/average_nbest_models.py
@@ -8,7 +8,6 @@
from io import BytesIO
import torch
-from typeguard import check_argument_types
from typing import Collection
from funasr.train.reporter import Reporter
@@ -34,7 +33,6 @@
nbest: Number of best model files to be averaged
suffix: A suffix added to the averaged model file name
"""
- assert check_argument_types()
if isinstance(nbest, int):
nbests = [nbest]
else:
diff --git a/funasr/main_funcs/collect_stats.py b/funasr/main_funcs/collect_stats.py
index 584b85a..ee2182c 100644
--- a/funasr/main_funcs/collect_stats.py
+++ b/funasr/main_funcs/collect_stats.py
@@ -11,7 +11,6 @@
import torch
from torch.nn.parallel import data_parallel
from torch.utils.data import DataLoader
-from typeguard import check_argument_types
from funasr.fileio.datadir_writer import DatadirWriter
from funasr.fileio.npy_scp import NpyScpWriter
@@ -37,7 +36,6 @@
This method is used before executing train().
"""
- assert check_argument_types()
npy_scp_writers = {}
for itr, mode in zip([train_iter, valid_iter], ["train", "valid"]):
diff --git a/funasr/models/ctc.py b/funasr/models/ctc.py
index 64b8710..d3c10fa 100644
--- a/funasr/models/ctc.py
+++ b/funasr/models/ctc.py
@@ -2,7 +2,6 @@
import torch
import torch.nn.functional as F
-from typeguard import check_argument_types
class CTC(torch.nn.Module):
@@ -25,7 +24,6 @@
reduce: bool = True,
ignore_nan_grad: bool = True,
):
- assert check_argument_types()
super().__init__()
eprojs = encoder_output_size
self.dropout_rate = dropout_rate
@@ -41,11 +39,6 @@
if ignore_nan_grad:
logging.warning("ignore_nan_grad option is not supported for warp_ctc")
self.ctc_loss = warp_ctc.CTCLoss(size_average=True, reduce=reduce)
-
- elif self.ctc_type == "gtnctc":
- from espnet.nets.pytorch_backend.gtn_ctc import GTNCTCLossFunction
-
- self.ctc_loss = GTNCTCLossFunction.apply
else:
raise ValueError(
f'ctc_type must be "builtin" or "warpctc": {self.ctc_type}'
diff --git a/funasr/models/data2vec.py b/funasr/models/data2vec.py
index e5bd640..92c95cc 100644
--- a/funasr/models/data2vec.py
+++ b/funasr/models/data2vec.py
@@ -10,7 +10,6 @@
from typing import Tuple
import torch
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.models.encoder.abs_encoder import AbsEncoder
@@ -40,7 +39,6 @@
preencoder: Optional[AbsPreEncoder],
encoder: AbsEncoder,
):
- assert check_argument_types()
super().__init__()
diff --git a/funasr/models/decoder/contextual_decoder.py b/funasr/models/decoder/contextual_decoder.py
index 78105ab..0e69c44 100644
--- a/funasr/models/decoder/contextual_decoder.py
+++ b/funasr/models/decoder/contextual_decoder.py
@@ -7,7 +7,6 @@
from funasr.modules.streaming_utils import utils as myutils
from funasr.models.decoder.transformer_decoder import BaseTransformerDecoder
-from typeguard import check_argument_types
from funasr.modules.attention import MultiHeadedAttentionSANMDecoder, MultiHeadedAttentionCrossAtt
from funasr.modules.embedding import PositionalEncoding
@@ -126,7 +125,6 @@
kernel_size: int = 21,
sanm_shfit: int = 0,
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
diff --git a/funasr/models/decoder/rnn_decoder.py b/funasr/models/decoder/rnn_decoder.py
index 80709c9..cb119e1 100644
--- a/funasr/models/decoder/rnn_decoder.py
+++ b/funasr/models/decoder/rnn_decoder.py
@@ -3,7 +3,6 @@
import numpy as np
import torch
import torch.nn.functional as F
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.modules.nets_utils import to_device
@@ -97,7 +96,6 @@
att_conf: dict = get_default_kwargs(build_attention_list),
):
# FIXME(kamo): The parts of num_spk should be refactored more more more
- assert check_argument_types()
if rnn_type not in {"lstm", "gru"}:
raise ValueError(f"Not supported: rnn_type={rnn_type}")
diff --git a/funasr/models/decoder/rnnt_decoder.py b/funasr/models/decoder/rnnt_decoder.py
index a0fe9ea..0109cc5 100644
--- a/funasr/models/decoder/rnnt_decoder.py
+++ b/funasr/models/decoder/rnnt_decoder.py
@@ -3,7 +3,6 @@
from typing import List, Optional, Tuple
import torch
-from typeguard import check_argument_types
from funasr.modules.beam_search.beam_search_transducer import Hypothesis
from funasr.models.specaug.specaug import SpecAug
@@ -38,7 +37,6 @@
"""Construct a RNNDecoder object."""
super().__init__()
- assert check_argument_types()
if rnn_type not in ("lstm", "gru"):
raise ValueError(f"Not supported: rnn_type={rnn_type}")
diff --git a/funasr/models/decoder/sanm_decoder.py b/funasr/models/decoder/sanm_decoder.py
index ed920bf..d83f89f 100644
--- a/funasr/models/decoder/sanm_decoder.py
+++ b/funasr/models/decoder/sanm_decoder.py
@@ -7,7 +7,6 @@
from funasr.modules.streaming_utils import utils as myutils
from funasr.models.decoder.transformer_decoder import BaseTransformerDecoder
-from typeguard import check_argument_types
from funasr.modules.attention import MultiHeadedAttentionSANMDecoder, MultiHeadedAttentionCrossAtt
from funasr.modules.embedding import PositionalEncoding
@@ -181,7 +180,6 @@
tf2torch_tensor_name_prefix_tf: str = "seq2seq/decoder",
embed_tensor_name_prefix_tf: str = None,
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
@@ -838,7 +836,6 @@
tf2torch_tensor_name_prefix_torch: str = "decoder",
tf2torch_tensor_name_prefix_tf: str = "seq2seq/decoder",
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
diff --git a/funasr/models/decoder/transformer_decoder.py b/funasr/models/decoder/transformer_decoder.py
index 45fdda8..0a9c612 100644
--- a/funasr/models/decoder/transformer_decoder.py
+++ b/funasr/models/decoder/transformer_decoder.py
@@ -9,7 +9,6 @@
import torch
from torch import nn
-from typeguard import check_argument_types
from funasr.models.decoder.abs_decoder import AbsDecoder
from funasr.modules.attention import MultiHeadedAttention
@@ -184,7 +183,6 @@
pos_enc_class=PositionalEncoding,
normalize_before: bool = True,
):
- assert check_argument_types()
super().__init__()
attention_dim = encoder_output_size
@@ -373,7 +371,6 @@
normalize_before: bool = True,
concat_after: bool = False,
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
@@ -428,7 +425,6 @@
concat_after: bool = False,
embeds_id: int = -1,
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
@@ -540,7 +536,6 @@
conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11),
conv_usebias: int = False,
):
- assert check_argument_types()
if len(conv_kernel_length) != num_blocks:
raise ValueError(
"conv_kernel_length must have equal number of values to num_blocks: "
@@ -602,7 +597,6 @@
conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11),
conv_usebias: int = False,
):
- assert check_argument_types()
if len(conv_kernel_length) != num_blocks:
raise ValueError(
"conv_kernel_length must have equal number of values to num_blocks: "
@@ -664,7 +658,6 @@
conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11),
conv_usebias: int = False,
):
- assert check_argument_types()
if len(conv_kernel_length) != num_blocks:
raise ValueError(
"conv_kernel_length must have equal number of values to num_blocks: "
@@ -726,7 +719,6 @@
conv_kernel_length: Sequence[int] = (11, 11, 11, 11, 11, 11),
conv_usebias: int = False,
):
- assert check_argument_types()
if len(conv_kernel_length) != num_blocks:
raise ValueError(
"conv_kernel_length must have equal number of values to num_blocks: "
@@ -781,7 +773,6 @@
pos_enc_class=PositionalEncoding,
normalize_before: bool = True,
):
- assert check_argument_types()
super().__init__()
attention_dim = encoder_output_size
@@ -955,7 +946,6 @@
normalize_before: bool = True,
concat_after: bool = False,
):
- assert check_argument_types()
super().__init__(
vocab_size=vocab_size,
encoder_output_size=encoder_output_size,
diff --git a/funasr/models/e2e_asr.py b/funasr/models/e2e_asr.py
index e6e6a52..79c5387 100644
--- a/funasr/models/e2e_asr.py
+++ b/funasr/models/e2e_asr.py
@@ -11,7 +11,6 @@
from typing import Union
import torch
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.losses.label_smoothing_loss import (
@@ -65,7 +64,6 @@
preencoder: Optional[AbsPreEncoder] = None,
postencoder: Optional[AbsPostEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
diff --git a/funasr/models/e2e_asr_contextual_paraformer.py b/funasr/models/e2e_asr_contextual_paraformer.py
index cfb5008..4836663 100644
--- a/funasr/models/e2e_asr_contextual_paraformer.py
+++ b/funasr/models/e2e_asr_contextual_paraformer.py
@@ -9,7 +9,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.models.ctc import CTC
@@ -73,7 +72,6 @@
preencoder: Optional[AbsPreEncoder] = None,
postencoder: Optional[AbsPostEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
diff --git a/funasr/models/e2e_asr_mfcca.py b/funasr/models/e2e_asr_mfcca.py
index 3927e38..7dd3b8d 100644
--- a/funasr/models/e2e_asr_mfcca.py
+++ b/funasr/models/e2e_asr_mfcca.py
@@ -7,7 +7,6 @@
from typing import Union
import logging
import torch
-from typeguard import check_argument_types
from funasr.modules.e2e_asr_common import ErrorCalculator
from funasr.modules.nets_utils import th_accuracy
@@ -65,7 +64,6 @@
sym_blank: str = "<blank>",
preencoder: Optional[AbsPreEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert rnnt_decoder is None, "Not implemented"
diff --git a/funasr/models/e2e_asr_paraformer.py b/funasr/models/e2e_asr_paraformer.py
index 686038e..5a1a29b 100644
--- a/funasr/models/e2e_asr_paraformer.py
+++ b/funasr/models/e2e_asr_paraformer.py
@@ -10,7 +10,6 @@
import torch
import random
import numpy as np
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.losses.label_smoothing_loss import (
@@ -80,7 +79,6 @@
postencoder: Optional[AbsPostEncoder] = None,
use_1st_decoder_loss: bool = False,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
@@ -645,7 +643,6 @@
postencoder: Optional[AbsPostEncoder] = None,
use_1st_decoder_loss: bool = False,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
@@ -1255,7 +1252,6 @@
preencoder: Optional[AbsPreEncoder] = None,
postencoder: Optional[AbsPostEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
@@ -1528,7 +1524,6 @@
preencoder: Optional[AbsPreEncoder] = None,
postencoder: Optional[AbsPostEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
@@ -1806,7 +1801,6 @@
preencoder: Optional[AbsPreEncoder] = None,
postencoder: Optional[AbsPostEncoder] = None,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
diff --git a/funasr/models/e2e_asr_transducer.py b/funasr/models/e2e_asr_transducer.py
index 4e33bd6..80914b1 100644
--- a/funasr/models/e2e_asr_transducer.py
+++ b/funasr/models/e2e_asr_transducer.py
@@ -6,7 +6,6 @@
import torch
from packaging.version import parse as V
-from typeguard import check_argument_types
from funasr.losses.label_smoothing_loss import (
LabelSmoothingLoss, # noqa: H301
)
@@ -85,8 +84,6 @@
) -> None:
"""Construct an ESPnetASRTransducerModel object."""
super().__init__()
-
- assert check_argument_types()
# The following labels ID are reserved: 0 (blank) and vocab_size - 1 (sos/eos)
self.blank_id = 0
@@ -546,8 +543,6 @@
"""Construct an ESPnetASRTransducerModel object."""
super().__init__()
- assert check_argument_types()
-
# The following labels ID are reserved: 0 (blank) and vocab_size - 1 (sos/eos)
self.blank_id = 0
@@ -713,7 +708,7 @@
loss_lm = self._calc_lm_loss(decoder_out, target)
loss_trans = loss_trans_utt + loss_trans_chunk
- loss_ctc = loss_ctc + loss_ctc_chunk
+ loss_ctc = loss_ctc + loss_ctc_chunk
loss_ctc = loss_att + loss_att_chunk
loss = (
@@ -1018,4 +1013,4 @@
ignore_label=self.ignore_id,
)
- return loss_att, acc_att
+ return loss_att, acc_att
\ No newline at end of file
diff --git a/funasr/models/e2e_diar_eend_ola.py b/funasr/models/e2e_diar_eend_ola.py
index da7c674..ae3a436 100644
--- a/funasr/models/e2e_diar_eend_ola.py
+++ b/funasr/models/e2e_diar_eend_ola.py
@@ -9,7 +9,6 @@
import numpy as np
import torch
import torch.nn as nn
-from typeguard import check_argument_types
from funasr.models.frontend.wav_frontend import WavFrontendMel23
from funasr.modules.eend_ola.encoder import EENDOLATransformerEncoder
@@ -48,7 +47,6 @@
mapping_dict=None,
**kwargs,
):
- assert check_argument_types()
super().__init__()
self.frontend = frontend
diff --git a/funasr/models/e2e_diar_sond.py b/funasr/models/e2e_diar_sond.py
index 9c3fb92..bc93b9d 100644
--- a/funasr/models/e2e_diar_sond.py
+++ b/funasr/models/e2e_diar_sond.py
@@ -12,7 +12,6 @@
import numpy as np
import torch
from torch.nn import functional as F
-from typeguard import check_argument_types
from funasr.modules.nets_utils import to_device
from funasr.modules.nets_utils import make_pad_mask
@@ -66,7 +65,6 @@
inter_score_loss_weight: float = 0.0,
inputs_type: str = "raw",
):
- assert check_argument_types()
super().__init__()
diff --git a/funasr/models/e2e_sa_asr.py b/funasr/models/e2e_sa_asr.py
index e209d51..cf1587d 100644
--- a/funasr/models/e2e_sa_asr.py
+++ b/funasr/models/e2e_sa_asr.py
@@ -12,7 +12,6 @@
import torch
import torch.nn.functional as F
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.losses.label_smoothing_loss import (
@@ -67,7 +66,6 @@
sym_blank: str = "<blank>",
extract_feats_in_collect_stats: bool = True,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
diff --git a/funasr/models/e2e_sv.py b/funasr/models/e2e_sv.py
index bd5178e..8be63d4 100644
--- a/funasr/models/e2e_sv.py
+++ b/funasr/models/e2e_sv.py
@@ -12,7 +12,6 @@
from typing import Union
import torch
-from typeguard import check_argument_types
from funasr.layers.abs_normalize import AbsNormalize
from funasr.losses.label_smoothing_loss import (
@@ -56,7 +55,6 @@
pooling_layer: torch.nn.Module,
decoder: AbsDecoder,
):
- assert check_argument_types()
super().__init__()
# note that eos is the same as sos (equivalent ID)
diff --git a/funasr/models/e2e_tp.py b/funasr/models/e2e_tp.py
index 33948f9..567dc70 100644
--- a/funasr/models/e2e_tp.py
+++ b/funasr/models/e2e_tp.py
@@ -9,7 +9,6 @@
import torch
import numpy as np
-from typeguard import check_argument_types
from funasr.models.encoder.abs_encoder import AbsEncoder
from funasr.models.frontend.abs_frontend import AbsFrontend
@@ -42,7 +41,6 @@
predictor_bias: int = 0,
token_list=None,
):
- assert check_argument_types()
super().__init__()
# note that eos is the same as sos (equivalent ID)
diff --git a/funasr/models/e2e_uni_asr.py b/funasr/models/e2e_uni_asr.py
index 9ec3a39..8bc3b42 100644
--- a/funasr/models/e2e_uni_asr.py
+++ b/funasr/models/e2e_uni_asr.py
@@ -8,7 +8,6 @@
from typing import Union
import torch
-from typeguard import check_argument_types
from funasr.models.e2e_asr_common import ErrorCalculator
from funasr.modules.nets_utils import th_accuracy
@@ -82,7 +81,6 @@
postencoder: Optional[AbsPostEncoder] = None,
encoder1_encoder2_joint_training: bool = True,
):
- assert check_argument_types()
assert 0.0 <= ctc_weight <= 1.0, ctc_weight
assert 0.0 <= interctc_weight < 1.0, interctc_weight
diff --git a/funasr/models/encoder/conformer_encoder.py b/funasr/models/encoder/conformer_encoder.py
index 994607f..e5fac62 100644
--- a/funasr/models/encoder/conformer_encoder.py
+++ b/funasr/models/encoder/conformer_encoder.py
@@ -12,7 +12,6 @@
import torch
from torch import nn
-from typeguard import check_argument_types
from funasr.models.ctc import CTC
from funasr.modules.attention import (
@@ -533,7 +532,6 @@
interctc_use_conditioning: bool = False,
stochastic_depth_rate: Union[float, List[float]] = 0.0,
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
@@ -943,7 +941,6 @@
"""Construct an Encoder object."""
super().__init__()
- assert check_argument_types()
self.embed = StreamingConvInput(
input_size,
diff --git a/funasr/models/encoder/data2vec_encoder.py b/funasr/models/encoder/data2vec_encoder.py
index 64c2144..8885f02 100644
--- a/funasr/models/encoder/data2vec_encoder.py
+++ b/funasr/models/encoder/data2vec_encoder.py
@@ -10,7 +10,6 @@
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
-from typeguard import check_argument_types
from funasr.models.encoder.abs_encoder import AbsEncoder
from funasr.modules.data2vec.data_utils import compute_mask_indices
@@ -97,7 +96,6 @@
# FP16 optimization
required_seq_len_multiple: int = 2,
):
- assert check_argument_types()
super().__init__()
# ConvFeatureExtractionModel
diff --git a/funasr/models/encoder/mfcca_encoder.py b/funasr/models/encoder/mfcca_encoder.py
index 95ccf07..87bb19d 100644
--- a/funasr/models/encoder/mfcca_encoder.py
+++ b/funasr/models/encoder/mfcca_encoder.py
@@ -5,7 +5,6 @@
import torch
from torch import nn
-from typeguard import check_argument_types
from funasr.models.encoder.encoder_layer_mfcca import EncoderLayer
from funasr.modules.nets_utils import get_activation
@@ -161,7 +160,6 @@
cnn_module_kernel: int = 31,
padding_idx: int = -1,
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
diff --git a/funasr/models/encoder/opennmt_encoders/conv_encoder.py b/funasr/models/encoder/opennmt_encoders/conv_encoder.py
index eec854f..9ab5e6b 100644
--- a/funasr/models/encoder/opennmt_encoders/conv_encoder.py
+++ b/funasr/models/encoder/opennmt_encoders/conv_encoder.py
@@ -7,7 +7,6 @@
import torch
import torch.nn as nn
from torch.nn import functional as F
-from typeguard import check_argument_types
import numpy as np
from funasr.modules.nets_utils import make_pad_mask
from funasr.modules.layer_norm import LayerNorm
@@ -90,7 +89,6 @@
tf2torch_tensor_name_prefix_torch: str = "speaker_encoder",
tf2torch_tensor_name_prefix_tf: str = "EAND/speaker_encoder",
):
- assert check_argument_types()
super().__init__()
self._output_size = num_units
diff --git a/funasr/models/encoder/opennmt_encoders/fsmn_encoder.py b/funasr/models/encoder/opennmt_encoders/fsmn_encoder.py
index e41b2aa..5f62e67 100644
--- a/funasr/models/encoder/opennmt_encoders/fsmn_encoder.py
+++ b/funasr/models/encoder/opennmt_encoders/fsmn_encoder.py
@@ -7,7 +7,6 @@
import torch
import torch.nn as nn
from torch.nn import functional as F
-from typeguard import check_argument_types
import numpy as np
from funasr.modules.nets_utils import make_pad_mask
from funasr.modules.layer_norm import LayerNorm
diff --git a/funasr/models/encoder/opennmt_encoders/self_attention_encoder.py b/funasr/models/encoder/opennmt_encoders/self_attention_encoder.py
index db30f08..7c83cbd 100644
--- a/funasr/models/encoder/opennmt_encoders/self_attention_encoder.py
+++ b/funasr/models/encoder/opennmt_encoders/self_attention_encoder.py
@@ -7,7 +7,6 @@
import torch
import torch.nn as nn
from funasr.modules.streaming_utils.chunk_utilis import overlap_chunk
-from typeguard import check_argument_types
import numpy as np
from funasr.modules.nets_utils import make_pad_mask
from funasr.modules.attention import MultiHeadSelfAttention, MultiHeadedAttentionSANM
@@ -144,7 +143,6 @@
tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder",
out_units=None,
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
diff --git a/funasr/models/encoder/rnn_encoder.py b/funasr/models/encoder/rnn_encoder.py
index 59730da..434af09 100644
--- a/funasr/models/encoder/rnn_encoder.py
+++ b/funasr/models/encoder/rnn_encoder.py
@@ -5,7 +5,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.modules.rnn.encoders import RNN
@@ -37,7 +36,6 @@
dropout: float = 0.0,
subsample: Optional[Sequence[int]] = (2, 2, 1, 1),
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
self.rnn_type = rnn_type
diff --git a/funasr/models/encoder/sanm_encoder.py b/funasr/models/encoder/sanm_encoder.py
index 46eabd1..45163df 100644
--- a/funasr/models/encoder/sanm_encoder.py
+++ b/funasr/models/encoder/sanm_encoder.py
@@ -8,7 +8,6 @@
import torch.nn as nn
import torch.nn.functional as F
from funasr.modules.streaming_utils.chunk_utilis import overlap_chunk
-from typeguard import check_argument_types
import numpy as np
from funasr.torch_utils.device_funcs import to_device
from funasr.modules.nets_utils import make_pad_mask
@@ -151,7 +150,6 @@
tf2torch_tensor_name_prefix_torch: str = "encoder",
tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder",
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
@@ -601,7 +599,6 @@
tf2torch_tensor_name_prefix_torch: str = "encoder",
tf2torch_tensor_name_prefix_tf: str = "seq2seq/encoder",
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
@@ -1060,7 +1057,6 @@
sanm_shfit : int = 0,
selfattention_layer_type: str = "sanm",
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
diff --git a/funasr/models/encoder/transformer_encoder.py b/funasr/models/encoder/transformer_encoder.py
index ff9c3db..4f2bef5 100644
--- a/funasr/models/encoder/transformer_encoder.py
+++ b/funasr/models/encoder/transformer_encoder.py
@@ -9,7 +9,6 @@
import torch
from torch import nn
-from typeguard import check_argument_types
import logging
from funasr.models.ctc import CTC
@@ -189,7 +188,6 @@
interctc_layer_idx: List[int] = [],
interctc_use_conditioning: bool = False,
):
- assert check_argument_types()
super().__init__()
self._output_size = output_size
diff --git a/funasr/models/frontend/default.py b/funasr/models/frontend/default.py
index abbcd1b..b41af80 100644
--- a/funasr/models/frontend/default.py
+++ b/funasr/models/frontend/default.py
@@ -7,7 +7,6 @@
import numpy as np
import torch
from torch_complex.tensor import ComplexTensor
-from typeguard import check_argument_types
from funasr.layers.log_mel import LogMel
from funasr.layers.stft import Stft
@@ -40,7 +39,6 @@
apply_stft: bool = True,
use_channel: int = None,
):
- assert check_argument_types()
super().__init__()
if isinstance(fs, str):
fs = humanfriendly.parse_size(fs)
@@ -167,7 +165,6 @@
cmvn_file: str = None,
mc: bool = True
):
- assert check_argument_types()
super().__init__()
if isinstance(fs, str):
fs = humanfriendly.parse_size(fs)
diff --git a/funasr/models/frontend/fused.py b/funasr/models/frontend/fused.py
index 857486d..ff95871 100644
--- a/funasr/models/frontend/fused.py
+++ b/funasr/models/frontend/fused.py
@@ -3,7 +3,6 @@
from funasr.models.frontend.s3prl import S3prlFrontend
import numpy as np
import torch
-from typeguard import check_argument_types
from typing import Tuple
@@ -12,7 +11,6 @@
self, frontends=None, align_method="linear_projection", proj_dim=100, fs=16000
):
- assert check_argument_types()
super().__init__()
self.align_method = (
align_method # fusing method : linear_projection only for now
diff --git a/funasr/models/frontend/s3prl.py b/funasr/models/frontend/s3prl.py
index b03d2c9..fdeb1c5 100644
--- a/funasr/models/frontend/s3prl.py
+++ b/funasr/models/frontend/s3prl.py
@@ -8,7 +8,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
@@ -37,7 +36,6 @@
download_dir: str = None,
multilayer_feature: bool = False,
):
- assert check_argument_types()
super().__init__()
if isinstance(fs, str):
fs = humanfriendly.parse_size(fs)
diff --git a/funasr/models/frontend/wav_frontend.py b/funasr/models/frontend/wav_frontend.py
index f16bdd9..acab13b 100644
--- a/funasr/models/frontend/wav_frontend.py
+++ b/funasr/models/frontend/wav_frontend.py
@@ -6,7 +6,6 @@
import torch
import torchaudio.compliance.kaldi as kaldi
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
@@ -95,7 +94,6 @@
snip_edges: bool = True,
upsacle_samples: bool = True,
):
- assert check_argument_types()
super().__init__()
self.fs = fs
self.window = window
@@ -227,7 +225,6 @@
snip_edges: bool = True,
upsacle_samples: bool = True,
):
- assert check_argument_types()
super().__init__()
self.fs = fs
self.window = window
@@ -466,7 +463,6 @@
lfr_m: int = 1,
lfr_n: int = 1,
):
- assert check_argument_types()
super().__init__()
self.fs = fs
self.frame_length = frame_length
diff --git a/funasr/models/frontend/windowing.py b/funasr/models/frontend/windowing.py
index a526758..94c9d27 100644
--- a/funasr/models/frontend/windowing.py
+++ b/funasr/models/frontend/windowing.py
@@ -6,7 +6,6 @@
from funasr.models.frontend.abs_frontend import AbsFrontend
import torch
-from typeguard import check_argument_types
from typing import Tuple
@@ -38,7 +37,6 @@
padding: Padding (placeholder, currently not implemented).
fs: Sampling rate (placeholder for compatibility, not used).
"""
- assert check_argument_types()
super().__init__()
self.fs = fs
self.win_length = win_length
diff --git a/funasr/models/postencoder/hugging_face_transformers_postencoder.py b/funasr/models/postencoder/hugging_face_transformers_postencoder.py
index 1aad15d..c59e2b7 100644
--- a/funasr/models/postencoder/hugging_face_transformers_postencoder.py
+++ b/funasr/models/postencoder/hugging_face_transformers_postencoder.py
@@ -6,7 +6,6 @@
from funasr.modules.nets_utils import make_pad_mask
from funasr.models.postencoder.abs_postencoder import AbsPostEncoder
-from typeguard import check_argument_types
from typing import Tuple
import copy
@@ -30,7 +29,6 @@
model_name_or_path: str,
):
"""Initialize the module."""
- assert check_argument_types()
super().__init__()
if not is_transformers_available:
diff --git a/funasr/models/preencoder/linear.py b/funasr/models/preencoder/linear.py
index c69b6ce..25f6720 100644
--- a/funasr/models/preencoder/linear.py
+++ b/funasr/models/preencoder/linear.py
@@ -5,7 +5,6 @@
"""Linear Projection."""
from funasr.models.preencoder.abs_preencoder import AbsPreEncoder
-from typeguard import check_argument_types
from typing import Tuple
import torch
@@ -20,7 +19,6 @@
output_size: int,
):
"""Initialize the module."""
- assert check_argument_types()
super().__init__()
self.output_dim = output_size
diff --git a/funasr/models/preencoder/sinc.py b/funasr/models/preencoder/sinc.py
index fe6d2af..3baa4a8 100644
--- a/funasr/models/preencoder/sinc.py
+++ b/funasr/models/preencoder/sinc.py
@@ -10,7 +10,6 @@
from funasr.layers.sinc_conv import SincConv
import humanfriendly
import torch
-from typeguard import check_argument_types
from typing import Optional
from typing import Tuple
from typing import Union
@@ -60,7 +59,6 @@
windowing_type: Choice of windowing function.
scale_type: Choice of filter-bank initialization scale.
"""
- assert check_argument_types()
super().__init__()
if isinstance(fs, str):
fs = humanfriendly.parse_size(fs)
@@ -268,7 +266,6 @@
dropout_probability: Dropout probability.
shape (tuple, list): Shape of input tensors.
"""
- assert check_argument_types()
super().__init__()
if shape is None:
shape = (0, 2, 1)
diff --git a/funasr/models/seq_rnn_lm.py b/funasr/models/seq_rnn_lm.py
index f7ddcae..bef4974 100644
--- a/funasr/models/seq_rnn_lm.py
+++ b/funasr/models/seq_rnn_lm.py
@@ -4,7 +4,6 @@
import torch
import torch.nn as nn
-from typeguard import check_argument_types
from funasr.train.abs_model import AbsLM
@@ -27,7 +26,6 @@
rnn_type: str = "lstm",
ignore_id: int = 0,
):
- assert check_argument_types()
super().__init__()
ninp = unit
diff --git a/funasr/modules/eend_ola/utils/report.py b/funasr/modules/eend_ola/utils/report.py
index bfccedf..f4a044b 100644
--- a/funasr/modules/eend_ola/utils/report.py
+++ b/funasr/modules/eend_ola/utils/report.py
@@ -2,7 +2,7 @@
import numpy as np
import time
import torch
-from eend.utils.power import create_powerlabel
+from funasr.modules.eend_ola.utils.power import create_powerlabel
from itertools import combinations
metrics = [
diff --git a/funasr/optimizers/sgd.py b/funasr/optimizers/sgd.py
index 3f0d3d1..fb7a3df 100644
--- a/funasr/optimizers/sgd.py
+++ b/funasr/optimizers/sgd.py
@@ -1,5 +1,4 @@
import torch
-from typeguard import check_argument_types
class SGD(torch.optim.SGD):
@@ -21,7 +20,6 @@
weight_decay: float = 0.0,
nesterov: bool = False,
):
- assert check_argument_types()
super().__init__(
params,
lr=lr,
diff --git a/funasr/runtime/docs/SDK_advanced_guide_cn.md b/funasr/runtime/docs/SDK_advanced_guide_cn.md
new file mode 100644
index 0000000..46e8ba9
--- /dev/null
+++ b/funasr/runtime/docs/SDK_advanced_guide_cn.md
@@ -0,0 +1,256 @@
+# FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟寮�鍙戞寚鍗�
+
+FunASR鎻愪緵鍙竴閿湰鍦版垨鑰呬簯绔湇鍔″櫒閮ㄧ讲鐨勪腑鏂囩绾挎枃浠惰浆鍐欐湇鍔★紝鍐呮牳涓篎unASR宸插紑婧恟untime-SDK銆侳unASR-runtime缁撳悎浜嗚揪鎽╅櫌璇煶瀹為獙瀹ゅ湪Modelscope绀惧尯寮�婧愮殑璇煶绔偣妫�娴�(VAD)銆丳araformer-large璇煶璇嗗埆(ASR)銆佹爣鐐规娴�(PUNC) 绛夌浉鍏宠兘鍔涳紝鍙互鍑嗙‘銆侀珮鏁堢殑瀵归煶棰戣繘琛岄珮骞跺彂杞啓銆�
+
+鏈枃妗d负FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟寮�鍙戞寚鍗椼�傚鏋滄偍鎯冲揩閫熶綋楠岀绾挎枃浠惰浆鍐欐湇鍔★紝璇峰弬鑰僃unASR绂荤嚎鏂囦欢杞啓鏈嶅姟涓�閿儴缃茬ず渚嬶紙[鐐瑰嚮姝ゅ](./SDK_tutorial.md)锛夈��
+
+## Docker瀹夎
+
+涓嬭堪姝ラ涓烘墜鍔ㄥ畨瑁卍ocker鍙奷ocker闀滃儚鐨勬楠わ紝濡傛偍docker闀滃儚宸插惎鍔紝鍙互蹇界暐鏈楠わ細
+
+### docker鐜瀹夎
+```shell
+# Ubuntu锛�
+curl -fsSL https://test.docker.com -o test-docker.sh
+sudo sh test-docker.sh
+# Debian锛�
+curl -fsSL https://get.docker.com -o get-docker.sh
+sudo sh get-docker.sh
+# CentOS锛�
+curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
+# MacOS锛�
+brew install --cask --appdir=/Applications docker
+```
+
+瀹夎璇﹁锛歨ttps://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html
+
+### docker鍚姩
+
+```shell
+sudo systemctl start docker
+```
+
+### 闀滃儚鎷夊彇鍙婂惎鍔�
+
+閫氳繃涓嬭堪鍛戒护鎷夊彇骞跺惎鍔‵unASR runtime-SDK鐨刣ocker闀滃儚锛�
+
+```shell
+sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.0.1
+
+sudo docker run -p 10095:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.0.1
+```
+
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+-p <瀹夸富鏈虹鍙�>:<鏄犲皠鍒癲ocker绔彛>
+濡傜ず渚嬶紝瀹夸富鏈�(ecs)绔彛10095鏄犲皠鍒癲ocker绔彛10095涓娿�傚墠鎻愭槸纭繚ecs瀹夊叏瑙勫垯鎵撳紑浜�10095绔彛銆�
+-v <瀹夸富鏈鸿矾寰�>:<鎸傝浇鑷砫ocker璺緞>
+濡傜ず渚嬶紝瀹夸富鏈鸿矾寰�/root鎸傝浇鑷砫ocker璺緞/workspace/models
+```
+
+
+## 鏈嶅姟绔惎鍔�
+
+docker鍚姩涔嬪悗锛屽惎鍔� funasr-wss-server鏈嶅姟绋嬪簭锛�
+
+funasr-wss-server鏀寔浠嶮odelscope涓嬭浇妯″瀷锛岄渶瑕佽缃悓鏃惰缃ā鍨嬩笅杞藉湴鍧�锛�--download-model-dir锛夊強model ID锛�--model-dir銆�--vad-dir銆�--punc-dir锛�,绀轰緥濡備笅锛�
+```shell
+cd /workspace/FunASR/funasr/runtime/websocket/build/bin
+./funasr-wss-server \
+ --download-model-dir /workspace/models \
+ --model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \
+ --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \
+ --punc-dir damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \
+ --decoder-thread-num 32 \
+ --io-thread-num 8 \
+ --port 10095 \
+ --certfile ../../../ssl_key/server.crt \
+ --keyfile ../../../ssl_key/server.key
+ ```
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--download-model-dir #妯″瀷涓嬭浇鍦板潃锛岄�氳繃璁剧疆model ID浠嶮odelscope涓嬭浇妯″瀷
+--model-dir # modelscope model ID
+--quantize # True涓洪噺鍖朅SR妯″瀷锛孎alse涓洪潪閲忓寲ASR妯″瀷锛岄粯璁ゆ槸True
+--vad-dir # modelscope model ID
+--vad-quant # True涓洪噺鍖朧AD妯″瀷锛孎alse涓洪潪閲忓寲VAD妯″瀷锛岄粯璁ゆ槸True
+--punc-dir # modelscope model ID
+--punc-quant # True涓洪噺鍖朠UNC妯″瀷锛孎alse涓洪潪閲忓寲PUNC妯″瀷锛岄粯璁ゆ槸True
+--port # 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095
+--decoder-thread-num # 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8
+--io-thread-num # 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1
+--certfile <string> # ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt
+--keyfile <string> # ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key
+```
+
+funasr-wss-server鍚屾椂涔熸敮鎸佷粠鏈湴璺緞鍔犺浇妯″瀷锛堟湰鍦版ā鍨嬭祫婧愬噯澶囪瑙乕妯″瀷璧勬簮鍑嗗](#anchor-1)锛夛紝闇�瑕佽缃ā鍨嬫湰鍦拌矾寰勶紙--download-model-dir锛夌ず渚嬪涓嬶細
+```shell
+cd /workspace/FunASR/funasr/runtime/websocket/build/bin
+
+./funasr-wss-server \
+ --model-dir /workspace/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx \
+ --vad-dir /workspace/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx \
+ --punc-dir /workspace/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \
+ --decoder-thread-num 32 \
+ --io-thread-num 8 \
+ --port 10095 \
+ --certfile ../../../ssl_key/server.crt \
+ --keyfile ../../../ssl_key/server.key
+ ```
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--model-dir # ASR妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/asr
+--quantize # True涓洪噺鍖朅SR妯″瀷锛孎alse涓洪潪閲忓寲ASR妯″瀷锛岄粯璁ゆ槸True
+--vad-dir # VAD妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/vad
+--vad-quant # True涓洪噺鍖朧AD妯″瀷锛孎alse涓洪潪閲忓寲VAD妯″瀷锛岄粯璁ゆ槸True
+--punc-dir # PUNC妯″瀷璺緞锛岄粯璁や负锛�/workspace/models/punc
+--punc-quant # True涓洪噺鍖朠UNC妯″瀷锛孎alse涓洪潪閲忓寲PUNC妯″瀷锛岄粯璁ゆ槸True
+--port # 鏈嶅姟绔洃鍚殑绔彛鍙凤紝榛樿涓� 10095
+--decoder-thread-num # 鏈嶅姟绔惎鍔ㄧ殑鎺ㄧ悊绾跨▼鏁帮紝榛樿涓� 8
+--io-thread-num # 鏈嶅姟绔惎鍔ㄧ殑IO绾跨▼鏁帮紝榛樿涓� 1
+--certfile <string> # ssl鐨勮瘉涔︽枃浠讹紝榛樿涓猴細../../../ssl_key/server.crt
+--keyfile <string> # ssl鐨勫瘑閽ユ枃浠讹紝榛樿涓猴細../../../ssl_key/server.key
+```
+
+## <a id="anchor-1">妯″瀷璧勬簮鍑嗗</a>
+
+濡傛灉鎮ㄩ�夋嫨閫氳繃funasr-wss-server浠嶮odelscope涓嬭浇妯″瀷锛屽彲浠ヨ烦杩囨湰姝ラ銆�
+
+FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟涓殑vad銆乤sr鍜宲unc妯″瀷璧勬簮鍧囨潵鑷狹odelscope锛屾ā鍨嬪湴鍧�璇﹁涓嬭〃锛�
+
+| 妯″瀷 | Modelscope閾炬帴 |
+|------|------------------------------------------------------------------------------------------------------------------|
+| VAD | https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary |
+| ASR | https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary |
+| PUNC | https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/summary |
+
+绂荤嚎鏂囦欢杞啓鏈嶅姟涓儴缃茬殑鏄噺鍖栧悗鐨凮NNX妯″瀷锛屼笅闈粙缁嶄笅濡備綍瀵煎嚭ONNX妯″瀷鍙婂叾閲忓寲锛氭偍鍙互閫夋嫨浠嶮odelscope瀵煎嚭ONNX妯″瀷銆佷粠鏈湴鏂囦欢瀵煎嚭ONNX妯″瀷鎴栬�呬粠finetune鍚庣殑璧勬簮瀵煎嚭妯″瀷锛�
+
+### 浠嶮odelscope瀵煎嚭ONNX妯″瀷
+
+浠嶮odelscope缃戠珯涓嬭浇瀵瑰簲model name鐨勬ā鍨嬶紝鐒跺悗瀵煎嚭閲忓寲鍚庣殑ONNX妯″瀷锛�
+
+```shell
+python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
+```
+
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--model-name Modelscope涓婄殑妯″瀷鍚嶇О锛屼緥濡俤amo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
+--export-dir ONNX妯″瀷瀵煎嚭鍦板潃
+--type 妯″瀷绫诲瀷锛岀洰鍓嶆敮鎸� ONNX銆乼orch
+--quantize int8妯″瀷閲忓寲
+```
+
+### 浠庢湰鍦版枃浠跺鍑篛NNX妯″瀷
+
+璁剧疆model name涓烘ā鍨嬫湰鍦拌矾寰勶紝瀵煎嚭閲忓寲鍚庣殑ONNX妯″瀷锛�
+
+```shell
+python -m funasr.export.export_model --model-name /workspace/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
+```
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--model-name 妯″瀷鏈湴璺緞锛屼緥濡�/workspace/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
+--export-dir ONNX妯″瀷瀵煎嚭鍦板潃
+--type 妯″瀷绫诲瀷锛岀洰鍓嶆敮鎸� ONNX銆乼orch
+--quantize int8妯″瀷閲忓寲
+```
+
+### 浠巉inetune鍚庣殑璧勬簮瀵煎嚭妯″瀷
+
+鍋囧鎮ㄦ兂閮ㄧ讲finetune鍚庣殑妯″瀷锛屽彲浠ュ弬鑰冨涓嬫楠わ細
+
+灏嗘偍finetune鍚庨渶瑕侀儴缃茬殑妯″瀷锛堜緥濡�10epoch.pb锛夛紝閲嶅懡鍚嶄负model.pb锛屽苟灏嗗師modelscope涓ā鍨媘odel.pb鏇挎崲鎺夛紝鍋囧鏇挎崲鍚庣殑妯″瀷璺緞涓�/path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch锛岄�氳繃涓嬭堪鍛戒护鎶奻inetune鍚庣殑妯″瀷杞垚onnx妯″瀷锛�
+
+```shell
+python -m funasr.export.export_model --model-name /path/to/finetune/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True
+```
+
+## 瀹㈡埛绔惎鍔�
+
+鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR绂荤嚎鏂囦欢杞啓鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°�傜洰鍓岶unASR-bin鏀寔澶氱鏂瑰紡鍚姩瀹㈡埛绔紝濡備笅鏄熀浜巔ython-client銆乧++-client鐨勫懡浠よ瀹炰緥鍙婅嚜瀹氫箟瀹㈡埛绔疻ebsocket閫氫俊鍗忚锛�
+
+### python-client
+```shell
+python wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "./data/wav.scp" --send_without_sleep --output_dir "./results"
+```
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--host # 鏈嶅姟绔痠p鍦板潃锛屾湰鏈烘祴璇曞彲璁剧疆涓� 127.0.0.1
+--port # 鏈嶅姟绔洃鍚鍙e彿
+--audio_in # 闊抽杈撳叆锛岃緭鍏ュ彲浠ユ槸锛歸av璺緞 鎴栬�� wav.scp璺緞锛坘aldi鏍煎紡鐨剋av list锛寃av_id \t wav_path锛�
+--output_dir # 璇嗗埆缁撴灉杈撳嚭璺緞
+--ssl # 鏄惁浣跨敤SSL鍔犲瘑锛岄粯璁や娇鐢�
+--mode # offline妯″紡
+```
+
+### c++-client锛�
+```shell
+. /funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path test.wav --thread-num 1 --is-ssl 1
+```
+鍛戒护鍙傛暟浠嬬粛锛�
+```text
+--server-ip # 鏈嶅姟绔痠p鍦板潃锛屾湰鏈烘祴璇曞彲璁剧疆涓� 127.0.0.1
+--port # 鏈嶅姟绔洃鍚鍙e彿
+--wav-path # 闊抽杈撳叆锛岃緭鍏ュ彲浠ユ槸锛歸av璺緞 鎴栬�� wav.scp璺緞锛坘aldi鏍煎紡鐨剋av list锛寃av_id \t wav_path锛�
+--thread-num # 瀹㈡埛绔嚎绋嬫暟
+--is-ssl # 鏄惁浣跨敤SSL鍔犲瘑锛岄粯璁や娇鐢�
+```
+
+### 鑷畾涔夊鎴风锛�
+
+濡傛灉鎮ㄦ兂瀹氫箟鑷繁鐨刢lient锛寃ebsocket閫氫俊鍗忚涓猴細
+
+```text
+# 棣栨閫氫俊
+{"mode": "offline", "wav_name": wav_name, "is_speaking": True}
+# 鍙戦�亀av鏁版嵁
+bytes鏁版嵁
+# 鍙戦�佺粨鏉熸爣蹇�
+{"is_speaking": False}
+```
+
+## 濡備綍瀹氬埗鏈嶅姟閮ㄧ讲
+
+FunASR-runtime鐨勪唬鐮佸凡寮�婧愶紝濡傛灉鏈嶅姟绔拰瀹㈡埛绔笉鑳藉緢濂界殑婊¤冻鎮ㄧ殑闇�姹傦紝鎮ㄥ彲浠ユ牴鎹嚜宸辩殑闇�姹傝繘琛岃繘涓�姝ョ殑寮�鍙戯細
+### c++ 瀹㈡埛绔細
+
+https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/websocket
+
+### python 瀹㈡埛绔細
+
+https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket
+### c++ 鏈嶅姟绔細
+
+#### VAD
+```c++
+// VAD妯″瀷鐨勪娇鐢ㄥ垎涓篎smnVadInit鍜孎smnVadInfer涓や釜姝ラ锛�
+FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num);
+// 鍏朵腑锛歮odel_path 鍖呭惈"model-dir"銆�"quantize"锛宼hread_num涓簅nnx绾跨▼鏁帮紱
+FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), NULL, 16000);
+// 鍏朵腑锛歷ad_hanlde涓篎unOfflineInit杩斿洖鍊硷紝wav_file涓洪煶棰戣矾寰勶紝sampling_rate涓洪噰鏍风巼(榛樿16k)
+```
+
+浣跨敤绀轰緥璇﹁锛歨ttps://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/onnxruntime/bin/funasr-onnx-offline-vad.cpp
+
+#### ASR
+```text
+// ASR妯″瀷鐨勪娇鐢ㄥ垎涓篎unOfflineInit鍜孎unOfflineInfer涓や釜姝ラ锛�
+FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num);
+// 鍏朵腑锛歮odel_path 鍖呭惈"model-dir"銆�"quantize"锛宼hread_num涓簅nnx绾跨▼鏁帮紱
+FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, NULL, 16000);
+// 鍏朵腑锛歛sr_hanlde涓篎unOfflineInit杩斿洖鍊硷紝wav_file涓洪煶棰戣矾寰勶紝sampling_rate涓洪噰鏍风巼(榛樿16k)
+```
+
+浣跨敤绀轰緥璇﹁锛歨ttps://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
+
+#### PUNC
+```text
+// PUNC妯″瀷鐨勪娇鐢ㄥ垎涓篊TTransformerInit鍜孋TTransformerInfer涓や釜姝ラ锛�
+FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num);
+// 鍏朵腑锛歮odel_path 鍖呭惈"model-dir"銆�"quantize"锛宼hread_num涓簅nnx绾跨▼鏁帮紱
+FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, NULL);
+// 鍏朵腑锛歱unc_hanlde涓篊TTransformerInit杩斿洖鍊硷紝txt_str涓烘枃鏈�
+```
+浣跨敤绀轰緥璇﹁锛歨ttps://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/onnxruntime/bin/funasr-onnx-offline-punc.cpp
diff --git a/funasr/runtime/docs/SDK_tutorial_cn.md b/funasr/runtime/docs/SDK_tutorial_cn.md
new file mode 100644
index 0000000..f174edb
--- /dev/null
+++ b/funasr/runtime/docs/SDK_tutorial_cn.md
@@ -0,0 +1,328 @@
+# FunASR绂荤嚎鏂囦欢杞啓鏈嶅姟渚挎嵎閮ㄧ讲鏁欑▼
+
+FunASR鎻愪緵鍙究鎹锋湰鍦版垨鑰呬簯绔湇鍔″櫒閮ㄧ讲鐨勭绾挎枃浠惰浆鍐欐湇鍔★紝鍐呮牳涓篎unASR宸插紑婧恟untime-SDK銆傞泦鎴愪簡杈炬懇闄㈣闊冲疄楠屽鍦∕odelscope绀惧尯寮�婧愮殑璇煶绔偣妫�娴�(VAD)銆丳araformer-large璇煶璇嗗埆(ASR)銆佹爣鐐规仮澶�(PUNC) 绛夌浉鍏宠兘鍔涳紝鍙互鍑嗙‘銆侀珮鏁堢殑瀵归煶棰戣繘琛岄珮骞跺彂杞啓銆�
+
+## 鐜瀹夎涓庡惎鍔ㄦ湇鍔�
+
+鐜鍑嗗涓庨厤缃紙[鐐瑰嚮姝ゅ](./aliyun_server_tutorial.md)锛�
+### 鑾峰緱鑴氭湰宸ュ叿骞朵竴閿儴缃�
+
+閫氳繃浠ヤ笅鍛戒护杩愯涓�閿儴缃叉湇鍔★紝鎸夌収鎻愮ず閫愭瀹屾垚FunASR runtime-SDK鏈嶅姟鐨勯儴缃插拰杩愯銆傜洰鍓嶆殏鏃朵粎鏀寔Linux鐜锛屽叾浠栫幆澧冨弬鑰冩枃妗楂橀樁寮�鍙戞寚鍗梋()銆�
+鍙楅檺浜庣綉缁滐紝funasr-runtime-deploy.sh涓�閿儴缃插伐鍏风殑涓嬭浇鍙兘涓嶉『鍒╋紝閬囧埌鏁扮杩樻湭涓嬭浇杩涘叆涓�閿儴缃插伐鍏风殑鎯呭喌锛岃Ctrl + C 缁堟鍚庡啀娆¤繍琛屼互涓嬪懡浠ゃ��
+
+```shell
+curl -O https://raw.githubusercontent.com/alibaba-damo-academy/FunASR-APP/main/TransAudio/funasr-runtime-deploy.sh ; sudo bash funasr-runtime-deploy.sh install
+```
+
+#### 鍚姩杩囩▼閰嶇疆璇﹁В
+
+##### 閫夋嫨FunASR Docker闀滃儚
+鎺ㄨ崘閫夋嫨latest浣跨敤鎴戜滑鐨勬渶鏂伴暅鍍忥紝涔熷彲閫夋嫨鍘嗗彶鐗堟湰銆�
+```text
+[1/10]
+ Please choose the Docker image.
+ 1) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest
+ 2) registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.0.1
+ Enter your choice: 1
+ You have chosen the Docker image: registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest
+```
+
+##### 閫夋嫨ASR/VAD/PUNC妯″瀷
+
+浣犲彲浠ラ�夋嫨ModelScope涓殑妯″瀷锛屼篃鍙互閫�<model_name>鑷濉叆ModelScope涓殑妯″瀷鍚嶏紝灏嗕細鍦―ocker杩愯鏃惰嚜鍔ㄤ笅杞姐�傚悓鏃朵篃鍙互閫夋嫨<model_path>濉叆瀹夸富鏈轰腑鐨勬湰鍦版ā鍨嬭矾寰勩��
+
+```text
+[2/10]
+ Please input [y/n] to confirm whether to automatically download model_id in ModelScope or use a local model.
+ [y] With the model in ModelScope, the model will be automatically downloaded to Docker(/workspace/models).
+ [n] Use the models on the localhost, the directory where the model is located will be mapped to Docker.
+ Setting confirmation[Y/n]:
+ You have chosen to use the model in ModelScope, please set the model ID in the next steps, and the model will be automatically downloaded during the run.
+
+ [2.1/10]
+ Please select ASR model_id in ModelScope from the list below.
+ 1) damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+ 2) model_name
+ 3) model_path
+ Enter your choice: 1
+ The model ID is damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+ The model dir in Docker is /workspace/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+
+ [2.2/10]
+ Please select VAD model_id in ModelScope from the list below.
+ 1) damo/speech_fsmn_vad_zh-cn-16k-common-onnx
+ 2) model_name
+ 3) model_path
+ Enter your choice: 1
+ The model ID is damo/speech_fsmn_vad_zh-cn-16k-common-onnx
+ The model dir in Docker is /workspace/models/speech_fsmn_vad_zh-cn-16k-common-onnx
+
+ [2.3/10]
+ Please select PUNC model_id in ModelScope from the list below.
+ 1) damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
+ 2) model_name
+ 3) model_path
+ Enter your choice: 1
+ The model ID is damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
+ The model dir in Docker is /workspace/models/punc_ct-transformer_zh-cn-common-vocab272727-onnx
+```
+
+##### 杈撳叆瀹夸富鏈轰腑FunASR鏈嶅姟鍙墽琛岀▼搴忚矾寰�
+
+杈撳叆FunASR鏈嶅姟鍙墽琛岀▼搴忕殑瀹夸富鏈鸿矾寰勶紝Docker杩愯鏃跺皢鑷姩鎸傝浇鍒癉ocker涓繍琛屻�傞粯璁や笉杈撳叆鐨勬儏鍐典笅灏嗘寚瀹欴ocker涓粯璁ょ殑/workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server銆�
+
+```text
+[3/10]
+ Please enter the path to the excutor of the FunASR service on the localhost.
+ If not set, the default /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server in Docker is used.
+ Setting the path to the excutor of the FunASR service on the localhost:
+ Corresponding, the path of FunASR in Docker is /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server
+```
+
+##### 璁剧疆瀹夸富鏈烘彁渚涚粰FunASR鐨勭鍙�
+璁剧疆鎻愪緵缁橠ocker鐨勫涓绘満绔彛锛岄粯璁や负10095銆傝淇濊瘉姝ょ鍙e彲鐢ㄣ��
+```text
+[4/10]
+ Please input the opened port in the host used for FunASR server.
+ Default: 10095
+ Setting the opened host port [1-65535]:
+ The port of the host is 10095
+```
+
+##### 璁剧疆Docker涓彁渚涚粰FunASR鐨勭鍙�
+璁剧疆Docker涓璅unASR鏈嶅姟浣跨敤鐨勭鍙o紝榛樿涓�10095锛屾绔彛灏嗕簬step1.4涓缃殑瀹夸富鏈虹鍙h繘琛屾槧灏勩��
+```text
+5/10]
+ Please input port for docker mapped.
+ Default: 10095, the opened port of current host is 10095
+ Setting the port in Docker for FunASR server [1-65535]:
+ The port in Docker for FunASR server is 10095
+```
+
+##### 璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟
+璁剧疆FunASR鏈嶅姟鐨勬帹鐞嗙嚎绋嬫暟锛岄粯璁や负瀹夸富鏈烘牳鏁帮紝鍚屾椂鑷姩璁剧疆鏈嶅姟鐨処O绾跨▼鏁帮紝涓烘帹鐞嗙嚎绋嬫暟鐨勫洓鍒嗕箣涓�銆�
+```text
+[6/10]
+ Please input thread number for FunASR decoder.
+ Default: 1
+ Setting the number of decoder thread:
+
+ The number of decoder threads is 1
+ The number of IO threads is 1
+```
+
+##### 鎵�鏈夎缃弬鏁板睍绀哄強纭
+
+灞曠ず鍓嶉潰6姝ヨ缃殑鍙傛暟锛岀‘璁ゅ垯灏嗘墍鏈夊弬鏁板瓨鍌ㄥ埌/var/funasr/config锛屽苟寮�濮嬪惎鍔―ocker锛屽惁鍒欐彁绀虹敤鎴疯繘琛岄噸鏂拌缃��
+
+```text
+[7/10]
+ Show parameters of FunASR server setting and confirm to run ...
+
+ The current Docker image is : registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest
+ The model will be automatically downloaded to the directory : /workspace/models
+ The ASR model_id used : damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+ The ASR model directory corresponds to the directory in Docker : /workspace/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+ The VAD model_id used : damo/speech_fsmn_vad_zh-cn-16k-common-onnx
+ The VAD model directory corresponds to the directory in Docker : /workspace/models/speech_fsmn_vad_zh-cn-16k-common-onnx
+ The PUNC model_id used : damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx
+ The PUNC model directory corresponds to the directory in Docker: /workspace/models/punc_ct-transformer_zh-cn-common-vocab272727-onnx
+
+ The path in the docker of the FunASR service executor : /workspace/FunASR/funasr/runtime/websocket/build/bin/funasr-wss-server
+ Set the host port used for use by the FunASR service : 10095
+ Set the docker port used by the FunASR service : 10095
+ Set the number of threads used for decoding the FunASR service : 1
+ Set the number of threads used for IO the FunASR service : 1
+
+ Please input [y/n] to confirm the parameters.
+ [y] Verify that these parameters are correct and that the service will run.
+ [n] The parameters set are incorrect, it will be rolled out, please rerun.
+ read confirmation[y/n]:
+
+ Will run FunASR server later ...
+ Parameters are stored in the file /var/funasr/config
+```
+
+##### 妫�鏌ocker鏈嶅姟
+
+妫�鏌ュ綋鍓嶅涓绘満鏄惁瀹夎浜咲ocker鏈嶅姟锛岃嫢鏈畨瑁咃紝鍒欏畨瑁匘ocker骞跺惎鍔ㄣ��
+
+```text
+[8/10]
+ Start install docker for ubuntu
+ Get docker installer: curl -fsSL https://test.docker.com -o test-docker.sh
+ Get docker run: sudo sh test-docker.sh
+# Executing docker install script, commit: c2de0811708b6d9015ed1a2c80f02c9b70c8ce7b
++ sh -c apt-get update -qq >/dev/null
++ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
++ sh -c install -m 0755 -d /etc/apt/keyrings
++ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
++ sh -c chmod a+r /etc/apt/keyrings/docker.gpg
++ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal test" > /etc/apt/sources.list.d/docker.list
++ sh -c apt-get update -qq >/dev/null
++ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
++ sh -c docker version
+Client: Docker Engine - Community
+ Version: 24.0.2
+
+ ...
+ ...
+
+ Docker install success, start docker server.
+```
+
+##### 涓嬭浇FunASR Docker闀滃儚
+
+涓嬭浇骞舵洿鏂皊tep1.1涓�夋嫨鐨凢unASR Docker闀滃儚銆�
+
+```text
+[9/10]
+ Pull docker image(registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-latest)...
+funasr-runtime-cpu-0.0.1: Pulling from funasr_repo/funasr
+7608715873ec: Pull complete
+3e1014c56f38: Pull complete
+
+ ...
+ ...
+```
+
+##### 鍚姩FunASR Docker
+
+鍚姩FunASR Docker锛岀瓑寰卻tep1.2閫夋嫨鐨勬ā鍨嬩笅杞藉畬鎴愬苟鍚姩FunASR鏈嶅姟銆�
+
+```text
+[10/10]
+ Construct command and run docker ...
+943d8f02b4e5011b71953a0f6c1c1b9bc5aff63e5a96e7406c83e80943b23474
+
+ Loading models:
+ [ASR ][Done ][==================================================][100%][1.10MB/s][v1.2.1]
+ [VAD ][Done ][==================================================][100%][7.26MB/s][v1.2.0]
+ [PUNC][Done ][==================================================][100%][ 474kB/s][v1.1.7]
+ The service has been started.
+ If you want to see an example of how to use the client, you can run sudo bash funasr-runtime-deploy.sh -c .
+```
+
+#### 鍚姩宸茬粡閮ㄧ讲杩囩殑FunASR鏈嶅姟
+涓�閿儴缃插悗鑻ュ嚭鐜伴噸鍚數鑴戠瓑鍏抽棴Docker鐨勫姩浣滐紝鍙�氳繃濡備笅鍛戒护鐩存帴鍚姩FunASR鏈嶅姟锛屽惎鍔ㄩ厤缃负涓婃涓�閿儴缃茬殑璁剧疆銆�
+
+```shell
+sudo bash funasr-runtime-deploy.sh start
+```
+
+#### 鍏抽棴FunASR鏈嶅姟
+
+```shell
+sudo bash funasr-runtime-deploy.sh stop
+```
+
+#### 閲嶅惎FunASR鏈嶅姟
+
+鏍规嵁涓婃涓�閿儴缃茬殑璁剧疆閲嶅惎鍚姩FunASR鏈嶅姟銆�
+```shell
+sudo bash funasr-runtime-deploy.sh restart
+```
+
+#### 鏇挎崲妯″瀷骞堕噸鍚疐unASR鏈嶅姟
+
+鏇挎崲姝e湪浣跨敤鐨勬ā鍨嬶紝骞堕噸鏂板惎鍔‵unASR鏈嶅姟銆傛ā鍨嬮渶涓篗odelScope涓殑ASR/VAD/PUNC妯″瀷銆�
+
+```shell
+sudo bash scripts/funasr-runtime-deploy.sh update model <model ID in ModelScope>
+
+e.g
+sudo bash scripts/funasr-runtime-deploy.sh update model damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
+```
+
+### 娴嬭瘯涓庝娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔�
+
+鍦ㄦ湇鍔″櫒涓婂畬鎴怓unASR鏈嶅姟閮ㄧ讲浠ュ悗锛屽彲浠ラ�氳繃濡備笅鐨勬楠ゆ潵娴嬭瘯鍜屼娇鐢ㄧ绾挎枃浠惰浆鍐欐湇鍔°�傜洰鍓嶅垎鍒敮鎸丳ython銆丆++銆丣ava鐗堟湰client鐨勭殑鍛戒护琛岃繍琛岋紝浠ュ強鍙湪娴忚鍣ㄥ彲鐩存帴浣撻獙鐨刪tml缃戦〉鐗堟湰锛屾洿澶氳瑷�client鏀寔鍙傝�冩枃妗c�怓unASR楂橀樁寮�鍙戞寚鍗椼�戙��
+funasr-runtime-deploy.sh杩愯缁撴潫鍚庯紝鍙�氳繃鍛戒护浠ヤ氦浜掔殑褰㈠紡鑷姩涓嬭浇娴嬭瘯鏍蜂緥samples鍒板綋鍓嶇洰褰曠殑funasr_samples涓紝骞惰缃弬鏁拌繍琛岋細
+
+```shell
+sudo bash funasr-runtime-deploy.sh client
+```
+
+鍙�夋嫨鎻愪緵鐨凱ython鍜孡inux C++鑼冧緥绋嬪簭锛屼互Python鑼冧緥涓轰緥锛�
+
+```text
+Will download sample tools for the client to show how speech recognition works.
+ Please select the client you want to run.
+ 1) Python
+ 2) Linux_Cpp
+ Enter your choice: 1
+
+ Please enter the IP of server, default(127.0.0.1):
+ Please enter the port of server, default(10095):
+ Please enter the audio path, default(/root/funasr_samples/audio/asr_example.wav):
+
+ Run pip3 install click>=8.0.4
+Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
+Requirement already satisfied: click>=8.0.4 in /usr/local/lib/python3.8/dist-packages (8.1.3)
+
+ Run pip3 install -r /root/funasr_samples/python/requirements_client.txt
+Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
+Requirement already satisfied: websockets in /usr/local/lib/python3.8/dist-packages (from -r /root/funasr_samples/python/requirements_client.txt (line 1)) (11.0.3)
+
+ Run python3 /root/funasr_samples/python/wss_client_asr.py --host 127.0.0.1 --port 10095 --mode offline --audio_in /root/funasr_samples/audio/asr_example.wav --send_without_sleep --output_dir ./funasr_samples/python
+
+ ...
+ ...
+
+ pid0_0: 娆㈣繋澶у鏉ヤ綋楠岃揪鎽╅櫌鎺ㄥ嚭鐨勮闊宠瘑鍒ā鍨嬨��
+Exception: sent 1000 (OK); then received 1000 (OK)
+end
+
+ If failed, you can try (python3 /root/funasr_samples/python/wss_client_asr.py --host 127.0.0.1 --port 10095 --mode offline --audio_in /root/funasr_samples/audio/asr_example.wav --send_without_sleep --output_dir ./funasr_samples/python) in your Shell.
+
+```
+
+#### python-client
+鑻ユ兂鐩存帴杩愯client杩涜娴嬭瘯锛屽彲鍙傝�冨涓嬬畝鏄撹鏄庯紝浠ython鐗堟湰涓轰緥锛�
+
+```shell
+python3 wss_client_asr.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" --send_without_sleep --output_dir "./results"
+```
+
+鍛戒护鍙傛暟璇存槑锛�
+```text
+--host 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p
+--port 10095 閮ㄧ讲绔彛鍙�
+--mode offline琛ㄧず绂荤嚎鏂囦欢杞啓
+--audio_in 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰勶紝鏂囦欢鍒楄〃wav.scp
+--output_dir 璇嗗埆缁撴灉淇濆瓨璺緞
+```
+
+#### cpp-client
+
+```shell
+export LD_LIBRARY_PATH=/root/funasr_samples/cpp/libs:$LD_LIBRARY_PATH
+/root/funasr_samples/cpp/funasr-wss-client --server-ip 127.0.0.1 --port 10095 --wav-path /root/funasr_samples/audio/asr_example.wav
+```
+
+鍛戒护鍙傛暟璇存槑锛�
+
+```text
+--server-ip 涓篎unASR runtime-SDK鏈嶅姟閮ㄧ讲鏈哄櫒ip锛岄粯璁や负鏈満ip锛�127.0.0.1锛夛紝濡傛灉client涓庢湇鍔′笉鍦ㄥ悓涓�鍙版湇鍔″櫒锛岄渶瑕佹敼涓洪儴缃叉満鍣╥p
+--port 10095 閮ㄧ讲绔彛鍙�
+--wav-path 闇�瑕佽繘琛岃浆鍐欑殑闊抽鏂囦欢锛屾敮鎸佹枃浠惰矾寰�
+```
+
+### 瑙嗛demo
+
+[鐐瑰嚮姝ゅ]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/runtime/aliyun_server_tutorial.md b/funasr/runtime/docs/aliyun_server_tutorial.md
similarity index 75%
rename from docs/runtime/aliyun_server_tutorial.md
rename to funasr/runtime/docs/aliyun_server_tutorial.md
index 0019a13..9689fdf 100644
--- a/docs/runtime/aliyun_server_tutorial.md
+++ b/funasr/runtime/docs/aliyun_server_tutorial.md
@@ -1,10 +1,12 @@
# 浜戞湇鍔″櫒鐢宠鏁欑▼
+
鎴戜滑浠ラ樋閲屼簯锛圼鐐规閾炬帴](https://www.aliyun.com/)锛変负渚嬶紝婕旂ず濡備綍鐢宠浜戞湇鍔″櫒
## 鏈嶅姟鍣ㄩ厤缃�
+
鐢ㄦ埛鍙互鏍规嵁鑷繁鐨勪笟鍔¢渶姹傦紝閫夋嫨鍚堥�傜殑鏈嶅姟鍣ㄩ厤缃紝鎺ㄨ崘閰嶇疆涓猴細
- 閰嶇疆涓�锛堥珮閰嶏級锛歑86鏋舵瀯锛�32/64鏍�8369CPU锛屽唴瀛�8G浠ヤ笂锛�
-- 閰嶇疆浜岋細X86鏋舵瀯锛�32/64鏍�8132CPU锛屽唴瀛�8G浠ヤ笂锛�
+- 閰嶇疆浜岋細X86鏋舵瀯锛�32/64鏍�8163CPU锛屽唴瀛�8G浠ヤ笂锛�
璇︾粏鎬ц兘娴嬭瘯鎶ュ憡锛歔鐐规閾炬帴](../../funasr/runtime/python/benchmark_onnx_cpp.md)
@@ -13,59 +15,59 @@
### 鐧婚檰涓汉璐﹀彿
鎵撳紑闃块噷浜戝畼缃慬鐐规閾炬帴](https://www.aliyun.com/)锛屾敞鍐屽苟鐧婚檰涓汉璐﹀彿锛屽涓嬪浘鏍囧彿1鎵�绀�
-<img src="images/aliyun1.png" width="500"/>
+<img src="images/aliyun1.png" width="900"/>
### 鍏嶈垂璇曠敤
鐐瑰嚮濡備笂鍥炬墍浠ユ爣鍙�2锛屽嚭鐜板涓嬬晫闈�
-<img src="images/aliyun2.png" width="500"/>
+<img src="images/aliyun2.png" width="900"/>
鍐嶇偣鍑绘爣鍙�3锛屽嚭鐜板涓嬬晫闈�
-<img src="images/aliyun3.png" width="500"/>
+<img src="images/aliyun3.png" width="900"/>
### 鐢宠ECS瀹炰緥
涓汉璐﹀彿鍙互鍏嶈垂璇曠敤1鏍�2GB鍐呭瓨锛屾瘡鏈�750灏忔椂锛屼紒涓氳璇佸悗锛屽彲浠ュ厤璐硅瘯鐢�2鏍�8GB鍐呭瓨 3涓湀锛屾牴鎹处鍙锋儏鍐碉紝鐐瑰嚮涓婂浘涓爣鍙�4锛屽嚭鐜板涓嬬晫闈細
-<img src="images/aliyun4.png" width="500"/>
+<img src="images/aliyun4.png" width="900"/>
渚濇鎸夌収涓婂浘鏍囧彿5銆�6銆�7閫夋嫨鍚庯紝鐐瑰嚮绔嬪嵆璇曠敤锛屽嚭鐜板涓嬬晫闈�
-<img src="images/aliyun5.png" width="500"/>
+<img src="images/aliyun5.png" width="900"/>
### 寮�鏀炬湇鍔$鍙�
鐐瑰嚮瀹夊叏缁勶紙鏍囧彿9锛夛紝鍑虹幇濡備笅鐣岄潰
-<img src="images/aliyun6.png" width="500"/>
+<img src="images/aliyun6.png" width="900"/>
鍐嶇偣鍑绘爣鍙�10锛屽嚭鐜板涓嬬晫闈�
-<img src="images/aliyun7.png" width="500"/>
+<img src="images/aliyun7.png" width="900"/>
鐐瑰嚮鎵嬪姩娣诲姞锛堟爣鍙�11锛夛紝鍒嗗埆鎸夌収鏍囧彿12銆�13濉叆鍐呭锛屽悗鐐瑰嚮淇濆瓨锛堟爣鍙�14锛夛紝鍐嶇偣鍑诲疄渚嬶紙鏍囧彿15锛夛紝鍑虹幇濡備笅鐣岄潰
-<img src="images/aliyun8.png" width="500"/>
+<img src="images/aliyun8.png" width="900"/>
### 鍚姩ECS绀轰緥
鐐瑰嚮绀轰緥鍚嶇О锛堟爣鍙�16锛夛紝鍑虹幇濡備笅椤甸潰
-<img src="images/aliyun9.png" width="500"/>
+<img src="images/aliyun9.png" width="900"/>
鐐瑰嚮杩滅▼鍚姩锛堟爣鍙�17锛夛紝鍑虹幇椤甸潰鍚庯紝鐐瑰嚮绔嬪嵆鐧婚檰锛屽嚭鐜板涓嬬晫闈�
-<img src="images/aliyun10.png" width="500"/>
+<img src="images/aliyun10.png" width="900"/>
棣栨鐧婚檰闇�瑕佺偣鍑婚噸缃瘑鐮侊紙涓婂浘涓豢鑹茬澶达級锛岃缃ソ瀵嗙爜鍚庯紝杈撳叆瀵嗙爜锛堟爣鍙�18锛夛紝鐐瑰嚮纭锛堟爣鍙�19锛�
-<img src="images/aliyun11.png" width="500"/>
+<img src="images/aliyun11.png" width="900"/>
棣栨鐧婚檰浼氶亣鍒颁笂鍥炬墍绀洪棶棰橈紝鐐瑰嚮鏍囧彿20锛屾牴鎹枃妗f搷浣滃悗锛岄噸鏂扮櫥闄嗭紝鐧婚檰鎴愬姛鍚庡嚭鐜板涓嬮〉闈�
-<img src="images/aliyun12.png" width="500"/>
+<img src="images/aliyun12.png" width="900"/>
涓婂浘琛ㄧず宸茬粡鎴愬姛鐢宠浜嗕簯鏈嶅姟鍣紝鍚庣画鍙互鏍规嵁FunASR runtime-SDK閮ㄧ讲鏂囨。杩涜涓�閿儴缃诧紙[鐐瑰嚮姝ゅ]()锛�
diff --git a/docs/runtime/images/aliyun1.png b/funasr/runtime/docs/images/aliyun1.png
similarity index 100%
rename from docs/runtime/images/aliyun1.png
rename to funasr/runtime/docs/images/aliyun1.png
Binary files differ
diff --git a/docs/runtime/images/aliyun10.png b/funasr/runtime/docs/images/aliyun10.png
similarity index 100%
rename from docs/runtime/images/aliyun10.png
rename to funasr/runtime/docs/images/aliyun10.png
Binary files differ
diff --git a/docs/runtime/images/aliyun11.png b/funasr/runtime/docs/images/aliyun11.png
similarity index 100%
rename from docs/runtime/images/aliyun11.png
rename to funasr/runtime/docs/images/aliyun11.png
Binary files differ
diff --git a/docs/runtime/images/aliyun12.png b/funasr/runtime/docs/images/aliyun12.png
similarity index 100%
rename from docs/runtime/images/aliyun12.png
rename to funasr/runtime/docs/images/aliyun12.png
Binary files differ
diff --git a/docs/runtime/images/aliyun2.png b/funasr/runtime/docs/images/aliyun2.png
similarity index 100%
rename from docs/runtime/images/aliyun2.png
rename to funasr/runtime/docs/images/aliyun2.png
Binary files differ
diff --git a/docs/runtime/images/aliyun3.png b/funasr/runtime/docs/images/aliyun3.png
similarity index 100%
rename from docs/runtime/images/aliyun3.png
rename to funasr/runtime/docs/images/aliyun3.png
Binary files differ
diff --git a/docs/runtime/images/aliyun4.png b/funasr/runtime/docs/images/aliyun4.png
similarity index 100%
rename from docs/runtime/images/aliyun4.png
rename to funasr/runtime/docs/images/aliyun4.png
Binary files differ
diff --git a/docs/runtime/images/aliyun5.png b/funasr/runtime/docs/images/aliyun5.png
similarity index 100%
rename from docs/runtime/images/aliyun5.png
rename to funasr/runtime/docs/images/aliyun5.png
Binary files differ
diff --git a/docs/runtime/images/aliyun6.png b/funasr/runtime/docs/images/aliyun6.png
similarity index 100%
rename from docs/runtime/images/aliyun6.png
rename to funasr/runtime/docs/images/aliyun6.png
Binary files differ
diff --git a/docs/runtime/images/aliyun7.png b/funasr/runtime/docs/images/aliyun7.png
similarity index 100%
rename from docs/runtime/images/aliyun7.png
rename to funasr/runtime/docs/images/aliyun7.png
Binary files differ
diff --git a/docs/runtime/images/aliyun8.png b/funasr/runtime/docs/images/aliyun8.png
similarity index 100%
rename from docs/runtime/images/aliyun8.png
rename to funasr/runtime/docs/images/aliyun8.png
Binary files differ
diff --git a/docs/runtime/images/aliyun9.png b/funasr/runtime/docs/images/aliyun9.png
similarity index 100%
rename from docs/runtime/images/aliyun9.png
rename to funasr/runtime/docs/images/aliyun9.png
Binary files differ
diff --git a/funasr/runtime/python/libtorch/funasr_torch/utils/frontend.py b/funasr/runtime/python/libtorch/funasr_torch/utils/frontend.py
index 11a8644..fe39955 100644
--- a/funasr/runtime/python/libtorch/funasr_torch/utils/frontend.py
+++ b/funasr/runtime/python/libtorch/funasr_torch/utils/frontend.py
@@ -3,7 +3,6 @@
from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union
import numpy as np
-from typeguard import check_argument_types
import kaldi_native_fbank as knf
root_dir = Path(__file__).resolve().parent
@@ -28,7 +27,6 @@
dither: float = 1.0,
**kwargs,
) -> None:
- check_argument_types()
opts = knf.FbankOptions()
opts.frame_opts.samp_freq = fs
diff --git a/funasr/runtime/python/libtorch/funasr_torch/utils/utils.py b/funasr/runtime/python/libtorch/funasr_torch/utils/utils.py
index 86e78bc..913ddc1 100644
--- a/funasr/runtime/python/libtorch/funasr_torch/utils/utils.py
+++ b/funasr/runtime/python/libtorch/funasr_torch/utils/utils.py
@@ -9,7 +9,6 @@
import numpy as np
import yaml
-from typeguard import check_argument_types
import warnings
@@ -21,7 +20,6 @@
class TokenIDConverter():
def __init__(self, token_list: Union[List, str],
):
- check_argument_types()
self.token_list = token_list
self.unk_symbol = token_list[-1]
@@ -51,7 +49,6 @@
space_symbol: str = "<space>",
remove_non_linguistic_symbols: bool = False,
):
- check_argument_types()
self.space_symbol = space_symbol
self.non_linguistic_symbols = self.load_symbols(symbol_value)
diff --git a/funasr/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py b/funasr/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py
index 5478236..ded04b6 100644
--- a/funasr/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py
+++ b/funasr/runtime/python/onnxruntime/funasr_onnx/utils/frontend.py
@@ -4,7 +4,6 @@
import copy
import numpy as np
-from typeguard import check_argument_types
import kaldi_native_fbank as knf
root_dir = Path(__file__).resolve().parent
@@ -29,7 +28,6 @@
dither: float = 1.0,
**kwargs,
) -> None:
- check_argument_types()
opts = knf.FbankOptions()
opts.frame_opts.samp_freq = fs
diff --git a/funasr/runtime/python/onnxruntime/funasr_onnx/utils/utils.py b/funasr/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
index dcee425..9284943 100644
--- a/funasr/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
+++ b/funasr/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
@@ -10,7 +10,6 @@
import yaml
from onnxruntime import (GraphOptimizationLevel, InferenceSession,
SessionOptions, get_available_providers, get_device)
-from typeguard import check_argument_types
import warnings
@@ -22,7 +21,6 @@
class TokenIDConverter():
def __init__(self, token_list: Union[List, str],
):
- check_argument_types()
self.token_list = token_list
self.unk_symbol = token_list[-1]
@@ -52,7 +50,6 @@
space_symbol: str = "<space>",
remove_non_linguistic_symbols: bool = False,
):
- check_argument_types()
self.space_symbol = space_symbol
self.non_linguistic_symbols = self.load_symbols(symbol_value)
diff --git a/funasr/runtime/readme.md b/funasr/runtime/readme.md
new file mode 100644
index 0000000..41f53b2
--- /dev/null
+++ b/funasr/runtime/readme.md
@@ -0,0 +1,30 @@
+# FunASR runtime-SDK
+涓枃鏂囨。锛圼鐐瑰嚮姝ゅ](./readme_cn.md)锛�
+
+FunASR is a speech recognition framework developed by the Speech Lab of DAMO Academy, which integrates industrial-level models in the fields of speech endpoint detection, speech recognition, punctuation segmentation, and more.
+It has attracted many developers to participate in experiencing and developing. To solve the last mile of industrial landing and integrate models into business, we have developed the FunASR runtime-SDK. The SDK supports several service deployments, including:
+
+- File transcription service, Mandarin, CPU version, done
+- File transcription service, Mandarin, GPU version, in progress
+- File transcription service, Mandarin, in progress
+- Streaming speech recognition service, is in progress
+- and more.
+
+
+## File Transcription Service, Mandarin (CPU)
+
+Currently, the FunASR runtime-SDK-0.0.1 version supports the deployment of file transcription service, Mandarin (CPU version), with a complete speech recognition chain that can transcribe tens of hours of audio into punctuated text, and supports recognition for more than a hundred concurrent streams.
+
+To meet the needs of different users, we have prepared different tutorials with text and images for both novice and advanced developers.
+
+### Technical Principles
+
+The technical principles and documentation behind FunASR explain the underlying technology, recognition accuracy, computational efficiency, and core advantages of the framework, including convenience, high precision, high efficiency, and support for long audio chains. For detailed information, please refer to the documentation available by [docs]().
+
+### Deployment Tutorial
+
+The documentation mainly targets novice users who have no need for modifications or customization. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed tutorials, please refer to [docs]().
+
+### Advanced Development Guide
+
+The documentation mainly targets advanced developers who require modifications and customization of the service. It supports downloading model deployments from modelscope and also supports deploying models that users have fine-tuned. For detailed information, please refer to the documentation available by [docs]()
\ No newline at end of file
diff --git a/funasr/runtime/readme_cn.md b/funasr/runtime/readme_cn.md
new file mode 100644
index 0000000..ce1a680
--- /dev/null
+++ b/funasr/runtime/readme_cn.md
@@ -0,0 +1,31 @@
+# FunASR runtime-SDK
+
+English Version锛圼docs](./readme.md)锛�
+
+FunASR鏄敱杈炬懇闄㈣闊冲疄楠屽寮�婧愮殑涓�娆捐闊宠瘑鍒熀纭�妗嗘灦锛岄泦鎴愪簡璇煶绔偣妫�娴嬨�佽闊宠瘑鍒�佹爣鐐规柇鍙ョ瓑棰嗗煙鐨勫伐涓氱骇鍒ā鍨嬶紝鍚稿紩浜嗕紬澶氬紑鍙戣�呭弬涓庝綋楠屽拰寮�鍙戙�備负浜嗚В鍐冲伐涓氳惤鍦扮殑鏈�鍚庝竴鍏噷锛屽皢妯″瀷闆嗘垚鍒颁笟鍔′腑鍘伙紝鎴戜滑寮�鍙戜簡FunASR runtime-SDK銆�
+SDK 鏀寔浠ヤ笅鍑犵鏈嶅姟閮ㄧ讲锛�
+
+- 涓枃绂荤嚎鏂囦欢杞啓鏈嶅姟锛圕PU鐗堟湰锛夛紝宸插畬鎴�
+- 涓枃绂荤嚎鏂囦欢杞啓鏈嶅姟锛圙PU鐗堟湰锛夛紝杩涜涓�
+- 鑻辨枃绂荤嚎杞啓鏈嶅姟锛岃繘琛屼腑
+- 娴佸紡璇煶璇嗗埆鏈嶅姟锛岃繘琛屼腑
+- 銆傘�傘��
+
+
+## 涓枃绂荤嚎鏂囦欢杞啓鏈嶅姟閮ㄧ讲锛圕PU鐗堟湰锛�
+
+鐩墠FunASR runtime-SDK-0.0.1鐗堟湰宸叉敮鎸佷腑鏂囪闊崇绾挎枃浠舵湇鍔¢儴缃诧紙CPU鐗堟湰锛夛紝鎷ユ湁瀹屾暣鐨勮闊宠瘑鍒摼璺紝鍙互灏嗗嚑鍗佷釜灏忔椂鐨勯煶棰戣瘑鍒垚甯︽爣鐐圭殑鏂囧瓧锛岃�屼笖鏀寔涓婄櫨璺苟鍙戝悓鏃惰繘琛岃瘑鍒��
+
+涓轰簡鏀寔涓嶅悓鐢ㄦ埛鐨勯渶姹傦紝鎴戜滑鍒嗗埆閽堝灏忕櫧涓庨珮闃跺紑鍙戣�咃紝鍑嗗浜嗕笉鍚岀殑鍥炬枃鏁欑▼锛�
+
+### 鎶�鏈師鐞嗘彮绉�
+
+鏂囨。浠嬬粛浜嗚儗鍚庢妧鏈師鐞嗭紝璇嗗埆鍑嗙‘鐜囷紝璁$畻鏁堢巼绛夛紝浠ュ強鏍稿績浼樺娍浠嬬粛锛氫究鎹枫�侀珮绮惧害銆侀珮鏁堢巼銆侀暱闊抽閾捐矾锛岃缁嗘枃妗e弬鑰冿紙[鐐瑰嚮姝ゅ]()锛�
+
+### 渚挎嵎閮ㄧ讲鏁欑▼
+
+鏂囨。涓昏閽堝灏忕櫧鐢ㄦ埛锛屾棤淇敼瀹氬埗闇�姹傦紝鏀寔浠巑odelscope涓笅杞芥ā鍨嬮儴缃诧紝涔熸敮鎸佺敤鎴穎inetune鍚庣殑妯″瀷閮ㄧ讲锛岃缁嗘暀绋嬪弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_tutorial_cn.md)锛�
+
+### 楂橀樁寮�鍙戞寚鍗�
+
+鏂囨。涓昏閽堝楂橀樁寮�鍙戣�咃紝闇�瑕佸鏈嶅姟杩涜淇敼涓庡畾鍒讹紝鏀寔浠巑odelscope涓笅杞芥ā鍨嬮儴缃诧紝涔熸敮鎸佺敤鎴穎inetune鍚庣殑妯″瀷閮ㄧ讲锛岃缁嗘枃妗e弬鑰冿紙[鐐瑰嚮姝ゅ](./docs/SDK_advanced_guide_cn.md)锛�
diff --git a/funasr/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py b/funasr/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py
index 2f84bb8..c556daf 100644
--- a/funasr/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py
+++ b/funasr/runtime/triton_gpu/model_repo_paraformer_large_offline/feature_extractor/1/model.py
@@ -109,7 +109,6 @@
lfr_n: int = 6,
dither: float = 1.0
) -> None:
- # check_argument_types()
self.fs = fs
self.window = window
diff --git a/funasr/samplers/build_batch_sampler.py b/funasr/samplers/build_batch_sampler.py
index 074b446..9266fea 100644
--- a/funasr/samplers/build_batch_sampler.py
+++ b/funasr/samplers/build_batch_sampler.py
@@ -4,8 +4,6 @@
from typing import Tuple
from typing import Union
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.samplers.abs_sampler import AbsSampler
from funasr.samplers.folded_batch_sampler import FoldedBatchSampler
@@ -104,7 +102,6 @@
padding: Whether sequences are input as a padded tensor or not.
used for "numel" mode
"""
- assert check_argument_types()
if len(shape_files) == 0:
raise ValueError("No shape file are given")
@@ -164,5 +161,4 @@
else:
raise ValueError(f"Not supported: {type}")
- assert check_return_type(retval)
return retval
diff --git a/funasr/samplers/folded_batch_sampler.py b/funasr/samplers/folded_batch_sampler.py
index 48e9604..f48d744 100644
--- a/funasr/samplers/folded_batch_sampler.py
+++ b/funasr/samplers/folded_batch_sampler.py
@@ -4,7 +4,6 @@
from typing import Tuple
from typing import Union
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
from funasr.fileio.read_text import read_2column_text
@@ -23,7 +22,6 @@
drop_last: bool = False,
utt2category_file: str = None,
):
- assert check_argument_types()
assert batch_size > 0
if sort_batch != "ascending" and sort_batch != "descending":
raise ValueError(
diff --git a/funasr/samplers/length_batch_sampler.py b/funasr/samplers/length_batch_sampler.py
index 8ee8bdc..28404e3 100644
--- a/funasr/samplers/length_batch_sampler.py
+++ b/funasr/samplers/length_batch_sampler.py
@@ -4,7 +4,6 @@
from typing import Tuple
from typing import Union
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
from funasr.samplers.abs_sampler import AbsSampler
@@ -21,7 +20,6 @@
drop_last: bool = False,
padding: bool = True,
):
- assert check_argument_types()
assert batch_bins > 0
if sort_batch != "ascending" and sort_batch != "descending":
raise ValueError(
diff --git a/funasr/samplers/num_elements_batch_sampler.py b/funasr/samplers/num_elements_batch_sampler.py
index 0ffad92..ebed0e4 100644
--- a/funasr/samplers/num_elements_batch_sampler.py
+++ b/funasr/samplers/num_elements_batch_sampler.py
@@ -4,7 +4,6 @@
from typing import Union
import numpy as np
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
from funasr.samplers.abs_sampler import AbsSampler
@@ -21,7 +20,6 @@
drop_last: bool = False,
padding: bool = True,
):
- assert check_argument_types()
assert batch_bins > 0
if sort_batch != "ascending" and sort_batch != "descending":
raise ValueError(
diff --git a/funasr/samplers/sorted_batch_sampler.py b/funasr/samplers/sorted_batch_sampler.py
index d6c3b41..b31e93e 100644
--- a/funasr/samplers/sorted_batch_sampler.py
+++ b/funasr/samplers/sorted_batch_sampler.py
@@ -2,7 +2,6 @@
from typing import Iterator
from typing import Tuple
-from typeguard import check_argument_types
from funasr.fileio.read_text import load_num_sequence_text
from funasr.samplers.abs_sampler import AbsSampler
@@ -26,7 +25,6 @@
sort_batch: str = "ascending",
drop_last: bool = False,
):
- assert check_argument_types()
assert batch_size > 0
self.batch_size = batch_size
self.shape_file = shape_file
diff --git a/funasr/samplers/unsorted_batch_sampler.py b/funasr/samplers/unsorted_batch_sampler.py
index 349e526..e5ed05b 100644
--- a/funasr/samplers/unsorted_batch_sampler.py
+++ b/funasr/samplers/unsorted_batch_sampler.py
@@ -2,7 +2,6 @@
from typing import Iterator
from typing import Tuple
-from typeguard import check_argument_types
from funasr.fileio.read_text import read_2column_text
from funasr.samplers.abs_sampler import AbsSampler
@@ -28,7 +27,6 @@
drop_last: bool = False,
utt2category_file: str = None,
):
- assert check_argument_types()
assert batch_size > 0
self.batch_size = batch_size
self.key_file = key_file
diff --git a/funasr/schedulers/noam_lr.py b/funasr/schedulers/noam_lr.py
index 80df019..e08fb63 100644
--- a/funasr/schedulers/noam_lr.py
+++ b/funasr/schedulers/noam_lr.py
@@ -4,7 +4,6 @@
import torch
from torch.optim.lr_scheduler import _LRScheduler
-from typeguard import check_argument_types
from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler
@@ -31,7 +30,6 @@
warmup_steps: Union[int, float] = 25000,
last_epoch: int = -1,
):
- assert check_argument_types()
self.model_size = model_size
self.warmup_steps = warmup_steps
diff --git a/funasr/schedulers/tri_stage_scheduler.py b/funasr/schedulers/tri_stage_scheduler.py
index 8dc71b4..c442260 100644
--- a/funasr/schedulers/tri_stage_scheduler.py
+++ b/funasr/schedulers/tri_stage_scheduler.py
@@ -8,7 +8,6 @@
import torch
from torch.optim.lr_scheduler import _LRScheduler
-from typeguard import check_argument_types
from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler
@@ -22,7 +21,6 @@
init_lr_scale: float = 0.01,
final_lr_scale: float = 0.01,
):
- assert check_argument_types()
self.optimizer = optimizer
self.last_epoch = last_epoch
self.phase_ratio = phase_ratio
diff --git a/funasr/schedulers/warmup_lr.py b/funasr/schedulers/warmup_lr.py
index dbf3aca..95ebaca 100644
--- a/funasr/schedulers/warmup_lr.py
+++ b/funasr/schedulers/warmup_lr.py
@@ -3,7 +3,6 @@
import torch
from torch.optim.lr_scheduler import _LRScheduler
-from typeguard import check_argument_types
from funasr.schedulers.abs_scheduler import AbsBatchStepScheduler
@@ -30,7 +29,6 @@
warmup_steps: Union[int, float] = 25000,
last_epoch: int = -1,
):
- assert check_argument_types()
self.warmup_steps = warmup_steps
# __init__() must be invoked before setting field
diff --git a/funasr/tasks/abs_task.py b/funasr/tasks/abs_task.py
index 0fb77a9..91d33c5 100644
--- a/funasr/tasks/abs_task.py
+++ b/funasr/tasks/abs_task.py
@@ -32,8 +32,6 @@
import yaml
from funasr.models.base_model import FunASRModel
from torch.utils.data import DataLoader
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr import __version__
from funasr.datasets.dataset import AbsDataset
@@ -269,7 +267,6 @@
@classmethod
def get_parser(cls) -> config_argparse.ArgumentParser:
- assert check_argument_types()
class ArgumentDefaultsRawTextHelpFormatter(
argparse.RawTextHelpFormatter,
@@ -959,7 +956,6 @@
cls.trainer.add_arguments(parser)
cls.add_task_arguments(parser)
- assert check_return_type(parser)
return parser
@classmethod
@@ -1007,7 +1003,6 @@
return _cls
# This method is used only for --print_config
- assert check_argument_types()
parser = cls.get_parser()
args, _ = parser.parse_known_args()
config = vars(args)
@@ -1047,7 +1042,6 @@
@classmethod
def check_required_command_args(cls, args: argparse.Namespace):
- assert check_argument_types()
if hasattr(args, "required"):
for k in vars(args):
if "-" in k:
@@ -1077,7 +1071,6 @@
inference: bool = False,
) -> None:
"""Check if the dataset satisfy the requirement of current Task"""
- assert check_argument_types()
mes = (
f"If you intend to use an additional input, modify "
f'"{cls.__name__}.required_data_names()" or '
@@ -1104,14 +1097,12 @@
@classmethod
def print_config(cls, file=sys.stdout) -> None:
- assert check_argument_types()
# Shows the config: e.g. python train.py asr --print_config
config = cls.get_default_config()
file.write(yaml_no_alias_safe_dump(config, indent=4, sort_keys=False))
@classmethod
def main(cls, args: argparse.Namespace = None, cmd: Sequence[str] = None):
- assert check_argument_types()
print(get_commandline_args(), file=sys.stderr)
if args is None:
parser = cls.get_parser()
@@ -1148,7 +1139,6 @@
@classmethod
def main_worker(cls, args: argparse.Namespace):
- assert check_argument_types()
# 0. Init distributed process
distributed_option = build_dataclass(DistributedOption, args)
@@ -1556,7 +1546,6 @@
- 4 epoch with "--num_iters_per_epoch" == 4
"""
- assert check_argument_types()
iter_options = cls.build_iter_options(args, distributed_option, mode)
# Overwrite iter_options if any kwargs is given
@@ -1589,7 +1578,6 @@
def build_sequence_iter_factory(
cls, args: argparse.Namespace, iter_options: IteratorOptions, mode: str
) -> AbsIterFactory:
- assert check_argument_types()
if hasattr(args, "frontend_conf"):
if args.frontend_conf is not None and "fs" in args.frontend_conf:
@@ -1683,7 +1671,6 @@
iter_options: IteratorOptions,
mode: str,
) -> AbsIterFactory:
- assert check_argument_types()
dataset = ESPnetDataset(
iter_options.data_path_and_name_and_type,
@@ -1788,7 +1775,6 @@
def build_multiple_iter_factory(
cls, args: argparse.Namespace, distributed_option: DistributedOption, mode: str
):
- assert check_argument_types()
iter_options = cls.build_iter_options(args, distributed_option, mode)
assert len(iter_options.data_path_and_name_and_type) > 0, len(
iter_options.data_path_and_name_and_type
@@ -1885,7 +1871,6 @@
inference: bool = False,
) -> DataLoader:
"""Build DataLoader using iterable dataset"""
- assert check_argument_types()
# For backward compatibility for pytorch DataLoader
if collate_fn is not None:
kwargs = dict(collate_fn=collate_fn)
@@ -1935,7 +1920,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
diff --git a/funasr/tasks/asr.py b/funasr/tasks/asr.py
index 7338513..4b94aeb 100644
--- a/funasr/tasks/asr.py
+++ b/funasr/tasks/asr.py
@@ -13,8 +13,6 @@
import numpy as np
import torch
import yaml
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -491,7 +489,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -499,7 +496,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -529,7 +525,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -548,12 +543,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -658,7 +651,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
@@ -701,7 +693,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -838,7 +829,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
# ~~~~~~~~~ The methods below are mainly used for inference ~~~~~~~~~
@@ -860,7 +850,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
@@ -975,7 +964,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -1085,7 +1073,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
# ~~~~~~~~~ The methods below are mainly used for inference ~~~~~~~~~
@@ -1107,7 +1094,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
@@ -1210,7 +1196,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -1308,7 +1293,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
@@ -1333,7 +1317,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -1388,7 +1371,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
@classmethod
@@ -1425,7 +1407,6 @@
Return:
model: ASR Transducer model.
"""
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
@@ -1524,7 +1505,6 @@
"Initialization part will be reworked in a short future.",
)
- #assert check_return_type(model)
return model
@@ -1559,7 +1539,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -1645,5 +1624,4 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
diff --git a/funasr/tasks/data2vec.py b/funasr/tasks/data2vec.py
index 9a64e1f..b11d7de 100644
--- a/funasr/tasks/data2vec.py
+++ b/funasr/tasks/data2vec.py
@@ -8,8 +8,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -256,14 +254,12 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
return CommonCollateFn(clipping=True)
@classmethod
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -289,7 +285,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -305,12 +300,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
# 1. frontend
if args.input_size is None:
@@ -372,5 +365,4 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
diff --git a/funasr/tasks/diar.py b/funasr/tasks/diar.py
index 2625fec..a486a46 100644
--- a/funasr/tasks/diar.py
+++ b/funasr/tasks/diar.py
@@ -21,8 +21,6 @@
import numpy as np
import torch
import yaml
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -344,7 +342,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -352,7 +349,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -382,7 +378,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -401,12 +396,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -505,7 +498,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
# ~~~~~~~~~ The methods below are mainly used for inference ~~~~~~~~~
@@ -528,7 +520,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
@@ -764,7 +755,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -772,7 +762,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
# if args.use_preprocessor:
# retval = CommonPreprocessor(
# train=train,
@@ -802,7 +791,6 @@
# )
# else:
# retval = None
- # assert check_return_type(retval)
return None
@classmethod
@@ -821,12 +809,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
# 1. frontend
if args.input_size is None or args.frontend == "wav_frontend_mel23":
@@ -865,7 +851,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
# ~~~~~~~~~ The methods below are mainly used for inference ~~~~~~~~~
@@ -888,7 +873,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
diff --git a/funasr/tasks/lm.py b/funasr/tasks/lm.py
index 44fdf8e..c0259a8 100644
--- a/funasr/tasks/lm.py
+++ b/funasr/tasks/lm.py
@@ -9,8 +9,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -52,7 +50,6 @@
@classmethod
def add_task_arguments(cls, parser: argparse.ArgumentParser):
# NOTE(kamo): Use '_' instead of '-' to avoid confusion
- assert check_argument_types()
group = parser.add_argument_group(description="Task related")
# NOTE(kamo): add_arguments(..., required=True) can't be used
@@ -130,7 +127,6 @@
for class_choices in cls.class_choices_list:
class_choices.add_arguments(group)
- assert check_return_type(parser)
return parser
@classmethod
@@ -140,14 +136,12 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
return CommonCollateFn(int_pad_value=0)
@classmethod
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -160,7 +154,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -179,7 +172,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace) -> LanguageModel:
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
diff --git a/funasr/tasks/punctuation.py b/funasr/tasks/punctuation.py
index a63bbe4..de5c897 100644
--- a/funasr/tasks/punctuation.py
+++ b/funasr/tasks/punctuation.py
@@ -9,8 +9,6 @@
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import PuncTrainTokenizerCommonPreprocessor
@@ -47,7 +45,6 @@
@classmethod
def add_task_arguments(cls, parser: argparse.ArgumentParser):
# NOTE(kamo): Use '_' instead of '-' to avoid confusion
- assert check_argument_types()
group = parser.add_argument_group(description="Task related")
# NOTE(kamo): add_arguments(..., required=True) can't be used
@@ -126,7 +123,6 @@
# e.g. --encoder and --encoder_conf
class_choices.add_arguments(group)
- assert check_return_type(parser)
return parser
@classmethod
@@ -136,14 +132,12 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
return CommonCollateFn(int_pad_value=0)
@classmethod
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
token_types = [args.token_type, args.token_type]
token_lists = [args.token_list, args.punc_list]
bpemodels = [args.bpemodel, args.bpemodel]
@@ -161,7 +155,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -182,7 +175,6 @@
@classmethod
def build_model(cls, args: argparse.Namespace) -> PunctuationModel:
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -223,5 +215,4 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
diff --git a/funasr/tasks/sa_asr.py b/funasr/tasks/sa_asr.py
index 9579483..e7ee5a3 100644
--- a/funasr/tasks/sa_asr.py
+++ b/funasr/tasks/sa_asr.py
@@ -13,8 +13,6 @@
import numpy as np
import torch
import yaml
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -445,7 +443,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -453,7 +450,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -483,7 +479,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -502,12 +497,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -619,5 +612,4 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
\ No newline at end of file
diff --git a/funasr/tasks/sv.py b/funasr/tasks/sv.py
index e4815da..e698522 100644
--- a/funasr/tasks/sv.py
+++ b/funasr/tasks/sv.py
@@ -17,8 +17,6 @@
import numpy as np
import torch
import yaml
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.datasets.preprocessor import CommonPreprocessor
@@ -273,7 +271,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -281,7 +278,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
if args.use_preprocessor:
retval = CommonPreprocessor(
train=train,
@@ -309,7 +305,6 @@
)
else:
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -330,12 +325,10 @@
retval = ()
if inference:
retval = ("ref_speech",)
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace) -> ESPnetSVModel:
- assert check_argument_types()
if isinstance(args.token_list, str):
with open(args.token_list, encoding="utf-8") as f:
token_list = [line.rstrip() for line in f]
@@ -449,7 +442,6 @@
if args.init is not None:
initialize(model, args.init)
- assert check_return_type(model)
return model
# ~~~~~~~~~ The methods below are mainly used for inference ~~~~~~~~~
@@ -472,7 +464,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
diff --git a/funasr/tasks/vad.py b/funasr/tasks/vad.py
index ec95596..822be22 100644
--- a/funasr/tasks/vad.py
+++ b/funasr/tasks/vad.py
@@ -13,8 +13,6 @@
import numpy as np
import torch
import yaml
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.datasets.collate_fn import CommonCollateFn
from funasr.layers.abs_normalize import AbsNormalize
@@ -192,7 +190,6 @@
[Collection[Tuple[str, Dict[str, np.ndarray]]]],
Tuple[List[str], Dict[str, torch.Tensor]],
]:
- assert check_argument_types()
# NOTE(kamo): int value = 0 is reserved by CTC-blank symbol
return CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
@@ -200,7 +197,6 @@
def build_preprocess_fn(
cls, args: argparse.Namespace, train: bool
) -> Optional[Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]]:
- assert check_argument_types()
# if args.use_preprocessor:
# retval = CommonPreprocessor(
# train=train,
@@ -223,7 +219,6 @@
# else:
# retval = None
retval = None
- assert check_return_type(retval)
return retval
@classmethod
@@ -242,12 +237,10 @@
cls, train: bool = True, inference: bool = False
) -> Tuple[str, ...]:
retval = ()
- assert check_return_type(retval)
return retval
@classmethod
def build_model(cls, args: argparse.Namespace):
- assert check_argument_types()
# 4. Encoder
encoder_class = encoder_choices.get_class(args.encoder)
encoder = encoder_class(**args.encoder_conf)
@@ -297,7 +290,6 @@
device: Device type, "cpu", "cuda", or "cuda:N".
"""
- assert check_argument_types()
if config_file is None:
assert model_file is not None, (
"The argument 'model_file' must be provided "
diff --git a/funasr/text/build_tokenizer.py b/funasr/text/build_tokenizer.py
index 8e29d3e..c60a335 100644
--- a/funasr/text/build_tokenizer.py
+++ b/funasr/text/build_tokenizer.py
@@ -2,7 +2,6 @@
from typing import Iterable
from typing import Union
-from typeguard import check_argument_types
from funasr.text.abs_tokenizer import AbsTokenizer
from funasr.text.char_tokenizer import CharTokenizer
@@ -21,7 +20,6 @@
g2p_type: str = None,
) -> AbsTokenizer:
"""A helper function to instantiate Tokenizer"""
- assert check_argument_types()
if token_type == "bpe":
if bpemodel is None:
raise ValueError('bpemodel is required if token_type = "bpe"')
diff --git a/funasr/text/char_tokenizer.py b/funasr/text/char_tokenizer.py
index 00ae427..8d1daf4 100644
--- a/funasr/text/char_tokenizer.py
+++ b/funasr/text/char_tokenizer.py
@@ -4,7 +4,6 @@
from typing import Union
import warnings
-from typeguard import check_argument_types
from funasr.text.abs_tokenizer import AbsTokenizer
@@ -16,7 +15,6 @@
space_symbol: str = "<space>",
remove_non_linguistic_symbols: bool = False,
):
- assert check_argument_types()
self.space_symbol = space_symbol
if non_linguistic_symbols is None:
self.non_linguistic_symbols = set()
diff --git a/funasr/text/cleaner.py b/funasr/text/cleaner.py
index be26940..6322672 100644
--- a/funasr/text/cleaner.py
+++ b/funasr/text/cleaner.py
@@ -2,7 +2,6 @@
from jaconv import jaconv
import tacotron_cleaner.cleaners
-from typeguard import check_argument_types
try:
from vietnamese_cleaner import vietnamese_cleaners
@@ -21,7 +20,6 @@
"""
def __init__(self, cleaner_types: Collection[str] = None):
- assert check_argument_types()
if cleaner_types is None:
self.cleaner_types = []
diff --git a/funasr/text/phoneme_tokenizer.py b/funasr/text/phoneme_tokenizer.py
index d424b40..ad3d81c 100644
--- a/funasr/text/phoneme_tokenizer.py
+++ b/funasr/text/phoneme_tokenizer.py
@@ -9,7 +9,6 @@
# import g2p_en
import jamo
-from typeguard import check_argument_types
from funasr.text.abs_tokenizer import AbsTokenizer
@@ -365,7 +364,6 @@
space_symbol: str = "<space>",
remove_non_linguistic_symbols: bool = False,
):
- assert check_argument_types()
if g2p_type is None:
self.g2p = split_by_space
elif g2p_type == "g2p_en":
diff --git a/funasr/text/sentencepiece_tokenizer.py b/funasr/text/sentencepiece_tokenizer.py
index e4cc152..e393cee 100644
--- a/funasr/text/sentencepiece_tokenizer.py
+++ b/funasr/text/sentencepiece_tokenizer.py
@@ -4,14 +4,12 @@
from typing import Union
import sentencepiece as spm
-from typeguard import check_argument_types
from funasr.text.abs_tokenizer import AbsTokenizer
class SentencepiecesTokenizer(AbsTokenizer):
def __init__(self, model: Union[Path, str]):
- assert check_argument_types()
self.model = str(model)
# NOTE(kamo):
# Don't build SentencePieceProcessor in __init__()
diff --git a/funasr/text/token_id_converter.py b/funasr/text/token_id_converter.py
index c9a6b28..1888d75 100644
--- a/funasr/text/token_id_converter.py
+++ b/funasr/text/token_id_converter.py
@@ -5,7 +5,6 @@
from typing import Union
import numpy as np
-from typeguard import check_argument_types
class TokenIDConverter:
@@ -14,7 +13,6 @@
token_list: Union[Path, str, Iterable[str]],
unk_symbol: str = "<unk>",
):
- assert check_argument_types()
if isinstance(token_list, (Path, str)):
token_list = Path(token_list)
diff --git a/funasr/text/word_tokenizer.py b/funasr/text/word_tokenizer.py
index 842734e..f4d33d5 100644
--- a/funasr/text/word_tokenizer.py
+++ b/funasr/text/word_tokenizer.py
@@ -4,7 +4,6 @@
from typing import Union
import warnings
-from typeguard import check_argument_types
from funasr.text.abs_tokenizer import AbsTokenizer
@@ -16,7 +15,6 @@
non_linguistic_symbols: Union[Path, str, Iterable[str]] = None,
remove_non_linguistic_symbols: bool = False,
):
- assert check_argument_types()
self.delimiter = delimiter
if not remove_non_linguistic_symbols and non_linguistic_symbols is not None:
diff --git a/funasr/torch_utils/forward_adaptor.py b/funasr/torch_utils/forward_adaptor.py
index 114af78..eb6da2b 100644
--- a/funasr/torch_utils/forward_adaptor.py
+++ b/funasr/torch_utils/forward_adaptor.py
@@ -1,5 +1,4 @@
import torch
-from typeguard import check_argument_types
class ForwardAdaptor(torch.nn.Module):
@@ -21,7 +20,6 @@
"""
def __init__(self, module: torch.nn.Module, name: str):
- assert check_argument_types()
super().__init__()
self.module = module
self.name = name
diff --git a/funasr/torch_utils/initialize.py b/funasr/torch_utils/initialize.py
index 2c0e7a4..e4ec534 100644
--- a/funasr/torch_utils/initialize.py
+++ b/funasr/torch_utils/initialize.py
@@ -4,7 +4,6 @@
import math
import torch
-from typeguard import check_argument_types
def initialize(model: torch.nn.Module, init: str):
@@ -19,7 +18,6 @@
model: Target.
init: Method of initialization.
"""
- assert check_argument_types()
if init == "chainer":
# 1. lecun_normal_init_parameters
diff --git a/funasr/train/abs_model.py b/funasr/train/abs_model.py
index 8d684be..9687376 100644
--- a/funasr/train/abs_model.py
+++ b/funasr/train/abs_model.py
@@ -8,7 +8,6 @@
import torch
import torch.nn.functional as F
-from typeguard import check_argument_types
from funasr.modules.nets_utils import make_pad_mask
from funasr.torch_utils.device_funcs import force_gatherable
@@ -34,7 +33,6 @@
class LanguageModel(FunASRModel):
def __init__(self, lm: AbsLM, vocab_size: int, ignore_id: int = 0):
- assert check_argument_types()
super().__init__()
self.lm = lm
self.sos = 1
@@ -154,7 +152,6 @@
class PunctuationModel(FunASRModel):
def __init__(self, punc_model: torch.nn.Module, vocab_size: int, ignore_id: int = 0, punc_weight: list = None):
- assert check_argument_types()
super().__init__()
self.punc_model = punc_model
self.punc_weight = torch.Tensor(punc_weight)
diff --git a/funasr/train/class_choices.py b/funasr/train/class_choices.py
index 658d291..1ffb97a 100644
--- a/funasr/train/class_choices.py
+++ b/funasr/train/class_choices.py
@@ -2,8 +2,6 @@
from typing import Optional
from typing import Tuple
-from typeguard import check_argument_types
-from typeguard import check_return_type
from funasr.utils.nested_dict_action import NestedDictAction
from funasr.utils.types import str_or_none
@@ -40,7 +38,6 @@
default: str = None,
optional: bool = False,
):
- assert check_argument_types()
self.name = name
self.base_type = type_check
self.classes = {k.lower(): v for k, v in classes.items()}
@@ -64,12 +61,10 @@
return retval
def get_class(self, name: Optional[str]) -> Optional[type]:
- assert check_argument_types()
if name is None or (self.optional and name.lower() == ("none", "null", "nil")):
retval = None
elif name.lower() in self.classes:
class_obj = self.classes[name]
- assert check_return_type(class_obj)
retval = class_obj
else:
raise ValueError(
diff --git a/funasr/train/reporter.py b/funasr/train/reporter.py
index 2921fef..cfe31f5 100644
--- a/funasr/train/reporter.py
+++ b/funasr/train/reporter.py
@@ -18,8 +18,6 @@
import humanfriendly
import numpy as np
import torch
-from typeguard import check_argument_types
-from typeguard import check_return_type
Num = Union[float, int, complex, torch.Tensor, np.ndarray]
@@ -27,7 +25,6 @@
def to_reported_value(v: Num, weight: Num = None) -> "ReportedValue":
- assert check_argument_types()
if isinstance(v, (torch.Tensor, np.ndarray)):
if np.prod(v.shape) != 1:
raise ValueError(f"v must be 0 or 1 dimension: {len(v.shape)}")
@@ -42,12 +39,10 @@
retval = WeightedAverage(v, weight)
else:
retval = Average(v)
- assert check_return_type(retval)
return retval
def aggregate(values: Sequence["ReportedValue"]) -> Num:
- assert check_argument_types()
for v in values:
if not isinstance(v, type(values[0])):
@@ -86,7 +81,6 @@
else:
raise NotImplementedError(f"type={type(values[0])}")
- assert check_return_type(retval)
return retval
@@ -122,7 +116,6 @@
"""
def __init__(self, key: str, epoch: int, total_count: int):
- assert check_argument_types()
self.key = key
self.epoch = epoch
self.start_time = time.perf_counter()
@@ -160,7 +153,6 @@
stats: Dict[str, Optional[Union[Num, Dict[str, Num]]]],
weight: Num = None,
) -> None:
- assert check_argument_types()
if self._finished:
raise RuntimeError("Already finished")
if len(self._seen_keys_in_the_step) == 0:
@@ -293,7 +285,6 @@
"""
def __init__(self, epoch: int = 0):
- assert check_argument_types()
if epoch < 0:
raise ValueError(f"epoch must be 0 or more: {epoch}")
self.epoch = epoch
diff --git a/funasr/train/trainer.py b/funasr/train/trainer.py
index f066909..a25f39a 100644
--- a/funasr/train/trainer.py
+++ b/funasr/train/trainer.py
@@ -26,7 +26,6 @@
import torch
import torch.nn
import torch.optim
-from typeguard import check_argument_types
from funasr.iterators.abs_iter_factory import AbsIterFactory
from funasr.main_funcs.average_nbest_models import average_nbest_models
@@ -127,7 +126,6 @@
@classmethod
def build_options(cls, args: argparse.Namespace) -> TrainerOptions:
"""Build options consumed by train(), eval()"""
- assert check_argument_types()
return build_dataclass(TrainerOptions, args)
@classmethod
@@ -188,7 +186,6 @@
distributed_option: DistributedOption,
) -> None:
"""Perform training. This method performs the main process of training."""
- assert check_argument_types()
# NOTE(kamo): Don't check the type more strictly as far trainer_options
assert is_dataclass(trainer_options), type(trainer_options)
assert len(optimizers) == len(schedulers), (len(optimizers), len(schedulers))
@@ -551,7 +548,6 @@
options: TrainerOptions,
distributed_option: DistributedOption,
) -> Tuple[bool, bool]:
- assert check_argument_types()
grad_noise = options.grad_noise
accum_grad = options.accum_grad
@@ -845,7 +841,6 @@
options: TrainerOptions,
distributed_option: DistributedOption,
) -> None:
- assert check_argument_types()
ngpu = options.ngpu
no_forward_run = options.no_forward_run
distributed = distributed_option.distributed
diff --git a/funasr/utils/griffin_lim.py b/funasr/utils/griffin_lim.py
index c1536d5..9e98ab8 100644
--- a/funasr/utils/griffin_lim.py
+++ b/funasr/utils/griffin_lim.py
@@ -9,7 +9,6 @@
from distutils.version import LooseVersion
from functools import partial
-from typeguard import check_argument_types
from typing import Optional
import librosa
@@ -138,7 +137,6 @@
griffin_lim_iters: The number of iterations.
"""
- assert check_argument_types()
self.fs = fs
self.logmel2linear = (
partial(
diff --git a/setup.py b/setup.py
index f13a2c2..30e1f1a 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,6 @@
import os
-from distutils.version import LooseVersion
from setuptools import find_packages
from setuptools import setup
@@ -12,73 +11,45 @@
requirements = {
"install": [
"setuptools>=38.5.1",
- # "configargparse>=1.2.1",
- "typeguard==2.13.3",
+ "typeguard>=3.0.1",
"humanfriendly",
"scipy>=1.4.1",
- # "filelock",
"librosa",
- "jamo==0.4.1", # For kss
+ "jamo", # For kss
"PyYAML>=5.1.2",
- "soundfile>=0.11.0",
+ "soundfile>=0.10.2",
"h5py>=2.10.0",
"kaldiio>=2.17.0",
"torch_complex",
"nltk>=3.4.5",
# ASR
"sentencepiece",
- # "ctc-segmentation<1.8,>=1.6.6",
# TTS
- # "pyworld>=0.2.10",
- "pypinyin<=0.44.0",
+ "pypinyin>=0.44.0",
"espnet_tts_frontend",
# ENH
- # "ci_sdr",
"pytorch_wpe",
"editdistance>=0.5.2",
- "tensorboard==1.15",
+ "tensorboard",
"g2p",
# PAI
"oss2",
- # "kaldi-native-fbank",
- # timestamp
"edit-distance",
- # textgrid
"textgrid",
- "protobuf==3.20.0",
+ "protobuf",
],
# train: The modules invoked when training only.
"train": [
- # "pillow>=6.1.0",
- "editdistance==0.5.2",
+ "editdistance",
"wandb",
- ],
- # recipe: The modules actually are not invoked in the main module of funasr,
- # but are invoked for the python scripts in each recipe
- "recipe": [
- "espnet_model_zoo",
- # "gdown",
- # "resampy",
- # "pysptk>=0.1.17",
- # "morfessor", # for zeroth-korean
- # "youtube_dl", # for laborotv
- # "nnmnkwii",
- # "museval>=0.2.1",
- # "pystoi>=0.2.2",
- # "mir-eval>=0.6",
- # "fastdtw",
- # "nara_wpe>=0.0.5",
- # "sacrebleu>=1.5.1",
],
# all: The modules should be optionally installled due to some reason.
# Please consider moving them to "install" occasionally
- # NOTE(kamo): The modules in "train" and "recipe" are appended into "all"
"all": [
# NOTE(kamo): Append modules requiring specific pytorch version or torch>1.3.0
"torch_optimizer",
"fairscale",
"transformers",
- # "gtn==0.0.0",
],
"setup": [
"numpy",
@@ -98,17 +69,18 @@
"black",
],
"doc": [
- "Jinja2<3.1",
- "Sphinx==2.1.2",
+ "Jinja2",
+ "Sphinx",
"sphinx-rtd-theme>=0.2.4",
"sphinx-argparse>=0.2.5",
- "commonmark==0.8.1",
+ "commonmark",
"recommonmark>=0.4.0",
"nbsphinx>=0.4.2",
"sphinx-markdown-tables>=0.0.12",
+ "configargparse>=1.2.1"
],
}
-requirements["all"].extend(requirements["train"] + requirements["recipe"])
+requirements["all"].extend(requirements["train"])
requirements["test"].extend(requirements["train"])
install_requires = requirements["install"]
@@ -151,4 +123,4 @@
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development :: Libraries :: Python Modules",
],
-)
+)
\ No newline at end of file
--
Gitblit v1.9.1