From 6b654b51cf80f7930424d90d92ca56af7eeac735 Mon Sep 17 00:00:00 2001 From: Yang Zhou Date: Wed, 16 Mar 2022 11:22:08 +0800 Subject: [PATCH] add path.sh --- speechx/examples/decoder/run.sh | 4 +++- speechx/examples/feat/run.sh | 5 +++-- speechx/examples/nnet/run.sh | 4 +++- speechx/examples/path.sh | 11 +++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 speechx/examples/path.sh diff --git a/speechx/examples/decoder/run.sh b/speechx/examples/decoder/run.sh index 84f82a5e..ffb05b77 100644 --- a/speechx/examples/decoder/run.sh +++ b/speechx/examples/decoder/run.sh @@ -9,6 +9,8 @@ if [ ! -d ../../build/examples ]; then cd - fi +. ../path.sh + # 2. download model if [ ! -d ../paddle_asr_model ]; then wget https://paddlespeech.bj.bcebos.com/s2t/paddle_asr_online/paddle_asr_model.tar.gz @@ -23,7 +25,7 @@ feat_wspecifier=./feats.ark cmvn=./cmvn.ark # 3. run feat -../../build/examples/feat/linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark:$feat_wspecifier --cmvn_write_path=$cmvn +linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark:$feat_wspecifier --cmvn_write_path=$cmvn # 4. run decoder ../../build/examples/decoder/offline_decoder_main --feature_respecifier=ark:$feat_wspecifier --model_path=$model_dir/avg_1.jit.pdmodel --param_path=$model_dir/avg_1.jit.pdparams --dict_file=$model_dir/vocab.txt --lm_path=$model_dir/avg_1.jit.klm diff --git a/speechx/examples/feat/run.sh b/speechx/examples/feat/run.sh index e56cd355..276fefa3 100644 --- a/speechx/examples/feat/run.sh +++ b/speechx/examples/feat/run.sh @@ -9,6 +9,8 @@ if [ ! -d ../../build/examples ]; then cd - fi +. ../path.sh + # 2. download model if [ ! -d ../paddle_asr_model ]; then wget https://paddlespeech.bj.bcebos.com/s2t/paddle_asr_online/paddle_asr_model.tar.gz @@ -18,10 +20,9 @@ if [ ! -d ../paddle_asr_model ]; then echo "utt1 " $PWD/../paddle_asr_model/BAC009S0764W0290.wav > ../paddle_asr_model/wav.scp fi - echo "utt1 " $PWD/../paddle_asr_model/BAC009S0764W0290.wav > ../paddle_asr_model/wav.scp model_dir=../paddle_asr_model feat_wspecifier=./feats.ark cmvn=./cmvn.ark # 3. run feat -../../build/examples/feat/linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark:$feat_wspecifier --cmvn_write_path=$cmvn +linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark,t:$feat_wspecifier --cmvn_write_path=$cmvn diff --git a/speechx/examples/nnet/run.sh b/speechx/examples/nnet/run.sh index 8e5df227..a2ef0beb 100644 --- a/speechx/examples/nnet/run.sh +++ b/speechx/examples/nnet/run.sh @@ -9,6 +9,8 @@ if [ ! -d ../../build/examples ]; then cd - fi +. ../path.sh + # 2. download model if [ ! -d ../paddle_asr_model ]; then wget https://paddlespeech.bj.bcebos.com/s2t/paddle_asr_online/paddle_asr_model.tar.gz @@ -22,5 +24,5 @@ model_dir=../paddle_asr_model # 4. run decoder -../../build/examples/nnet/pp-model-test --model_path=$model_dir/avg_1.jit.pdmodel --param_path=$model_dir/avg_1.jit.pdparams +pp-model-test --model_path=$model_dir/avg_1.jit.pdmodel --param_path=$model_dir/avg_1.jit.pdparams diff --git a/speechx/examples/path.sh b/speechx/examples/path.sh new file mode 100644 index 00000000..c29bc5af --- /dev/null +++ b/speechx/examples/path.sh @@ -0,0 +1,11 @@ +# This contains the locations of binarys build required for running the examples. + +SPEECHX_ROOT=$PWD/../.. +SPEECHX_EXAMPLES=$SPEECHX_ROOT/build/examples +SPEECHX_BIN=$SPEECHX_EXAMPLES/nnet:$SPEECHX_EXAMPLES/decoder:$SPEECHX_EXAMPLES/feat + +[ -d $SPEECHX_EXAMPLES ] || { echo "Error: 'build/examples' directory not found. please ensure that the project build successfully"; } + +export LC_AL=C + +export PATH=$PATH:$SPEECHX_BIN