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
嘉渊900c628049e9
diff --git a/egs/aishell/data2vec_transformer_finetune/run.sh b/egs/aishell/data2vec_transformer_finetune/run.shindex 1583b9ee8..7bbcf9046 100755--- a/egs/aishell/data2vec_transformer_finetune/run.sh+++ b/egs/aishell/data2vec_transformer_finetune/run.sh@@ -53,7 +53,7 @@ asr_config=conf/train_asr_transformer_12e_6d_3072_768.yamlmodel_dir="baseline_$(basename "${asr_config}" .yaml)_${lang}_${token_type}_${tag}"inference_config=conf/decode_asr_transformer.yaml-inference_asr_model=valid.acc.ave_10best.pb+inference_asr_model=valid.cer_ctc.ave_10best.pb# you can set gpu num for decoding heregpuid_list=$CUDA_VISIBLE_DEVICES # set gpus for decoding, the same as training stage by default@@ -189,7 +189,7 @@ if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then--asr_train_config "${asr_exp}"/config.yaml \--asr_model_file "${asr_exp}"/"${inference_asr_model}" \--output_dir "${_logdir}"/output.JOB \- --mode paraformer \+ --mode asr \${_opts}for f in token token_int score text; dodiff --git a/egs/aishell/paraformerbert/local/aishell_data_prep.sh b/egs/aishell/paraformerbert/local/aishell_data_prep.shindex b6ea36b72..83f489b3c 100755--- a/egs/aishell/paraformerbert/local/aishell_data_prep.sh+++ b/egs/aishell/paraformerbert/local/aishell_data_prep.sh@@ -5,19 +5,20 @@#. ./path.sh || exit 1;-if [ $# != 2 ]; then- echo "Usage: $0 <audio-path> <text-path>"- echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript"+if [ $# != 3 ]; then+ echo "Usage: $0 <audio-path> <text-path> <output-path>"+ echo " $0 /export/a05/xna/data/data_aishell/wav /export/a05/xna/data/data_aishell/transcript data"exit 1;fiaishell_audio_dir=$1aishell_text=$2/aishell_transcript_v0.8.txt+output_dir=$3-train_dir=data/local/train-dev_dir=data/local/dev-test_dir=data/local/test-tmp_dir=data/local/tmp+train_dir=$output_dir/data/local/train+dev_dir=$output_dir/data/local/dev+test_dir=$output_dir/data/local/test+tmp_dir=$output_dir/data/local/tmpmkdir -p $train_dirmkdir -p $dev_dir@@ -53,12 +54,12 @@ for dir in $train_dir $dev_dir $test_dir; dosort -u $dir/transcripts.txt > $dir/textdone-mkdir -p data/train data/dev data/test+mkdir -p $output_dir/data/train $output_dir/data/dev $output_dir/data/testfor f in wav.scp text; do- cp $train_dir/$f data/train/$f || exit 1;- cp $dev_dir/$f data/dev/$f || exit 1;- cp $test_dir/$f data/test/$f || exit 1;+ cp $train_dir/$f $output_dir/data/train/$f || exit 1;+ cp $dev_dir/$f $output_dir/data/dev/$f || exit 1;+ cp $test_dir/$f $output_dir/data/test/$f || exit 1;doneecho "$0: AISHELL data preparation succeeded"diff --git a/egs/aishell/paraformerbert/local/download_and_untar.sh b/egs/aishell/paraformerbert/local/download_and_untar.shnew file mode 100755index 000000000..d98255915--- /dev/null+++ b/egs/aishell/paraformerbert/local/download_and_untar.sh@@ -0,0 +1,105 @@+#!/usr/bin/env bash++# Copyright 2014 Johns Hopkins University (author: Daniel Povey)+# 2017 Xingyu Na+# Apache 2.0++remove_archive=false++if [ "$1" == --remove-archive ]; then+ remove_archive=true+ shift+fi++if [ $# -ne 3 ]; then+ echo "Usage: $0 [--remove-archive] <data-base> <url-base> <corpus-part>"+ echo "e.g.: $0 /export/a05/xna/data www.openslr.org/resources/33 data_aishell"+ echo "With --remove-archive it will remove the archive after successfully un-tarring it."+ echo "<corpus-part> can be one of: data_aishell, resource_aishell."+fi++data=$1+url=$2+part=$3++if [ ! -d "$data" ]; then+ echo "$0: no such directory $data"+ exit 1;+fi++part_ok=false+list="data_aishell resource_aishell"+for x in $list; do+ if [ "$part" == $x ]; then part_ok=true; fi+done+if ! $part_ok; then+ echo "$0: expected <corpus-part> to be one of $list, but got '$part'"+ exit 1;+fi++if [ -z "$url" ]; then+ echo "$0: empty URL base."+ exit 1;+fi++if [ -f $data/$part/.complete ]; then+ echo "$0: data part $part was already successfully extracted, nothing to do."+ exit 0;+fi++# sizes of the archive files in bytes.+sizes="15582913665 1246920"++if [ -f $data/$part.tgz ]; then+ size=$(/bin/ls -l $data/$part.tgz | awk '{print $5}')+ size_ok=false+ for s in $sizes; do if [ $s == $size ]; then size_ok=true; fi; done+ if ! $size_ok; then+ echo "$0: removing existing file $data/$part.tgz because its size in bytes $size"+ echo "does not equal the size of one of the archives."+ rm $data/$part.tgz+ else+ echo "$data/$part.tgz exists and appears to be complete."+ fi+fi++if [ ! -f $data/$part.tgz ]; then+ if ! command -v wget >/dev/null; then+ echo "$0: wget is not installed."+ exit 1;+ fi+ full_url=$url/$part.tgz+ echo "$0: downloading data from $full_url. This may take some time, please be patient."++ cd $data || exit 1+ if ! wget --no-check-certificate $full_url; then+ echo "$0: error executing wget $full_url"+ exit 1;+ fi+fi++cd $data || exit 1++if ! tar -xvzf $part.tgz; then+ echo "$0: error un-tarring archive $data/$part.tgz"+ exit 1;+fi++touch $data/$part/.complete++if [ $part == "data_aishell" ]; then+ cd $data/$part/wav || exit 1+ for wav in ./*.tar.gz; do+ echo "Extracting wav from $wav"+ tar -zxf $wav && rm $wav+ done+fi++echo "$0: Successfully downloaded and un-tarred $data/$part.tgz"++if $remove_archive; then+ echo "$0: removing $data/$part.tgz file since --remove-archive option was supplied."+ rm $data/$part.tgz+fi++exit 0;diff --git a/egs/aishell/paraformerbert/run.sh b/egs/aishell/paraformerbert/run.shindex 2487eacd8..bcbe1eb60 100755--- a/egs/aishell/paraformerbert/run.sh+++ b/egs/aishell/paraformerbert/run.sh@@ -8,7 +8,7 @@ gpu_num=2count=1gpu_inference=true # Whether to perform gpu decoding, set false for cpu decoding# for gpu decoding, inference_nj=ngpu*njob; for cpu decoding, inference_nj=njob-njob=5+njob=1train_cmd=utils/run.plinfer_cmd=utils/run.pl