Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
update repo
嘉渊90d8e42e9e4a
diff --git a/egs/aishell2/conformer/run.sh b/egs/aishell2/conformer/run.shindex 65fd6661d..c3b4065bd 100755--- a/egs/aishell2/conformer/run.sh+++ b/egs/aishell2/conformer/run.sh@@ -21,16 +21,16 @@ type=soundscp=wav.scpspeed_perturb="0.9 1.0 1.1"dataset_type=large-stage=3-stop_stage=4+stage=0+stop_stage=5# feature configurationfeats_dim=80nj=64# data-tr_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-2/iOS/data-dev_tst_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-DEV-TEST-SET+tr_dir=+dev_tst_dir=# exp tagtag="exp1"@@ -107,10 +107,16 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; thenmkdir -p ${feats_dir}/asr_stats_fbank_zh_char/${valid_set}fi-# Training Stage+# LM Training Stageworld_size=$gpu_num # run on one machineif [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then- echo "stage 3: Training"+ echo "stage 3: LM Training"+fi++# ASR Training Stage+world_size=$gpu_num # run on one machine+if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then+ echo "stage 4: ASR Training"mkdir -p ${exp_dir}/exp/${model_dir}mkdir -p ${exp_dir}/exp/${model_dir}/logINIT_FILE=${exp_dir}/exp/${model_dir}/ddp_init@@ -151,8 +157,8 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; thenfi# Testing Stage-if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then- echo "stage 4: Inference"+if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then+ echo "stage 5: Inference"for dset in ${test_sets}; doasr_exp=${exp_dir}/exp/${model_dir}inference_tag="$(basename "${inference_config}" .yaml)"diff --git a/egs/aishell2/data2vec_pretrain/run.sh b/egs/aishell2/data2vec_pretrain/run.shindex 2753f0076..d80fa6028 100755--- a/egs/aishell2/data2vec_pretrain/run.sh+++ b/egs/aishell2/data2vec_pretrain/run.sh@@ -24,8 +24,8 @@ feats_dim=80nj=64# data-tr_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-2/iOS/data-dev_tst_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-DEV-TEST-SET+tr_dir=+dev_tst_dir=# exp tagtag="exp1"diff --git a/egs/aishell2/paraformer/run.sh b/egs/aishell2/paraformer/run.shindex 5236af555..a8cde5565 100755--- a/egs/aishell2/paraformer/run.sh+++ b/egs/aishell2/paraformer/run.sh@@ -21,16 +21,16 @@ type=soundscp=wav.scpspeed_perturb="0.9 1.0 1.1"dataset_type=large-stage=3-stop_stage=4+stage=0+stop_stage=5# feature configurationfeats_dim=80nj=64# data-tr_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-2/iOS/data-dev_tst_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-DEV-TEST-SET+tr_dir=+dev_tst_dir=# exp tagtag="exp1"@@ -105,10 +105,16 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; thenecho "<unk>" >> ${token_list}fi-# Training Stage+# LM Training Stageworld_size=$gpu_num # run on one machineif [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then- echo "stage 3: Training"+ echo "stage 3: LM Training"+fi++# ASR Training Stage+world_size=$gpu_num # run on one machine+if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then+ echo "stage 4: ASR Training"mkdir -p ${exp_dir}/exp/${model_dir}mkdir -p ${exp_dir}/exp/${model_dir}/logINIT_FILE=${exp_dir}/exp/${model_dir}/ddp_init@@ -149,8 +155,8 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; thenfi# Testing Stage-if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then- echo "stage 4: Inference"+if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then+ echo "stage 5: Inference"for dset in ${test_sets}; doasr_exp=${exp_dir}/exp/${model_dir}inference_tag="$(basename "${inference_config}" .yaml)"diff --git a/egs/aishell2/paraformerbert/run.sh b/egs/aishell2/paraformerbert/run.shindex 26c8063ad..44aa3571e 100755--- a/egs/aishell2/paraformerbert/run.sh+++ b/egs/aishell2/paraformerbert/run.sh@@ -21,8 +21,8 @@ type=soundscp=wav.scpspeed_perturb="0.9 1.0 1.1"dataset_type=large-stage=3-stop_stage=4+stage=0+stop_stage=5skip_extract_embed=falsebert_model_name="bert-base-chinese"@@ -32,8 +32,8 @@ feats_dim=80nj=64# data-tr_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-2/iOS/data-dev_tst_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-DEV-TEST-SET+tr_dir=+dev_tst_dir=# exp tagtag="exp1"@@ -108,10 +108,16 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; thenecho "<unk>" >> ${token_list}fi-# Training Stage+# LM Training Stageworld_size=$gpu_num # run on one machineif [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then- echo "stage 3: Training"+ echo "stage 3: LM Training"+fi++# ASR Training Stage+world_size=$gpu_num # run on one machine+if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then+ echo "stage 4: ASR Training"if ! "${skip_extract_embed}"; thenecho "extract embeddings..."local/extract_embeds.sh \@@ -160,8 +166,8 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; thenfi# Testing Stage-if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then- echo "stage 4: Inference"+if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then+ echo "stage 5: Inference"for dset in ${test_sets}; doasr_exp=${exp_dir}/exp/${model_dir}inference_tag="$(basename "${inference_config}" .yaml)"diff --git a/egs/aishell2/transformer/run.sh b/egs/aishell2/transformer/run.shindex d8b16aa83..b66c63df0 100755--- a/egs/aishell2/transformer/run.sh+++ b/egs/aishell2/transformer/run.sh@@ -21,16 +21,16 @@ type=soundscp=wav.scpspeed_perturb="0.9 1.0 1.1"dataset_type=large-stage=3-stop_stage=4+stage=0+stop_stage=5# feature configurationfeats_dim=80nj=64# data-tr_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-2/iOS/data-dev_tst_dir=/nfs/wangjiaming.wjm/asr_data/aishell2/AISHELL-DEV-TEST-SET+tr_dir=+dev_tst_dir=# exp tagtag="exp1"@@ -105,10 +105,16 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; thenecho "<unk>" >> ${token_list}fi-# Training Stage+# LM Training Stageworld_size=$gpu_num # run on one machineif [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then- echo "stage 3: Training"+ echo "stage 3: LM Training"+fi++# ASR Training Stage+world_size=$gpu_num # run on one machine+if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then+ echo "stage 4: ASR Training"mkdir -p ${exp_dir}/exp/${model_dir}mkdir -p ${exp_dir}/exp/${model_dir}/logINIT_FILE=${exp_dir}/exp/${model_dir}/ddp_init@@ -149,8 +155,8 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; thenfi# Testing Stage-if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then- echo "stage 4: Inference"+if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then+ echo "stage 5 Inference"for dset in ${test_sets}; doasr_exp=${exp_dir}/exp/${model_dir}inference_tag="$(basename "${inference_config}" .yaml)"diff --git a/funasr/models/e2e_asr_transducer.py b/funasr/models/e2e_asr_transducer.pyindex a5aaa6c52..0ae814628 100644--- a/funasr/models/e2e_asr_transducer.py+++ b/funasr/models/e2e_asr_transducer.py@@ -17,7 +17,7 @@ from funasr.models.joint_net.joint_network import JointNetworkfrom funasr.modules.nets_utils import get_transducer_task_iofrom funasr.layers.abs_normalize import AbsNormalizefrom funasr.torch_utils.device_funcs import force_gatherable-from funasr.train.abs_espnet_model import AbsESPnetModel+from funasr.models.base_model import FunASRModelif V(torch.__version__) >= V("1.6.0"):from torch.cuda.amp import autocast@@ -28,7 +28,7 @@ else:yield-class TransducerModel(AbsESPnetModel):+class TransducerModel(FunASRModel):"""ESPnet2ASRTransducerModel module definition.Args:diff --git a/funasr/models/e2e_sa_asr.py b/funasr/models/e2e_sa_asr.pyindex f694cc2df..830460721 100644--- a/funasr/models/e2e_sa_asr.py+++ b/funasr/models/e2e_sa_asr.py@@ -29,7 +29,7 @@ from funasr.modules.add_sos_eos import add_sos_eosfrom funasr.modules.e2e_asr_common import ErrorCalculatorfrom funasr.modules.nets_utils import th_accuracyfrom funasr.torch_utils.device_funcs import force_gatherable-from funasr.train.abs_espnet_model import AbsESPnetModel+from funasr.models.base_model import FunASRModelif LooseVersion(torch.__version__) >= LooseVersion("1.6.0"):from torch.cuda.amp import autocast@@ -40,7 +40,7 @@ else:yield-class ESPnetASRModel(AbsESPnetModel):+class ESPnetASRModel(FunASRModel):"""CTC-attention hybrid Encoder-Decoder model"""def __init__(diff --git a/funasr/tasks/sa_asr.py b/funasr/tasks/sa_asr.pyindex 7cfcbd0ea..4769758b3 100644--- a/funasr/tasks/sa_asr.py+++ b/funasr/tasks/sa_asr.py@@ -70,11 +70,11 @@ from funasr.models.preencoder.sinc import LightweightSincConvsfrom funasr.models.specaug.abs_specaug import AbsSpecAugfrom funasr.models.specaug.specaug import SpecAugfrom funasr.models.specaug.specaug import SpecAugLFR+from funasr.models.base_model import FunASRModelfrom funasr.modules.subsampling import Conv1dSubsamplingfrom funasr.tasks.abs_task import AbsTaskfrom funasr.text.phoneme_tokenizer import g2p_choicesfrom funasr.torch_utils.initialize import initialize-from funasr.train.abs_espnet_model import AbsESPnetModelfrom funasr.train.class_choices import ClassChoicesfrom funasr.train.trainer import Trainerfrom funasr.utils.get_default_kwargs import get_default_kwargs@@ -129,7 +129,7 @@ model_choices = ClassChoices(mfcca=MFCCA,timestamp_prediction=TimestampPredictor,),- type_check=AbsESPnetModel,+ type_check=FunASRModel,default="asr",)preencoder_choices = ClassChoices(