From 35549049c907f1c0a1feb1f5b060cd98ab261f0b Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Mon, 14 Nov 2022 11:26:58 +0800 Subject: [PATCH] fix u2 bins (#2643) --- speechx/examples/u2pp_ol/wenetspeech/README.md | 5 ++--- speechx/examples/u2pp_ol/wenetspeech/local/decode.sh | 2 +- speechx/examples/u2pp_ol/wenetspeech/local/nnet.sh | 8 +++++--- speechx/examples/u2pp_ol/wenetspeech/run.sh | 2 -- speechx/speechx/frontend/audio/data_cache.h | 2 -- speechx/speechx/nnet/decodable.cc | 1 + 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/speechx/examples/u2pp_ol/wenetspeech/README.md b/speechx/examples/u2pp_ol/wenetspeech/README.md index 9a8f8af5..b90b8e20 100644 --- a/speechx/examples/u2pp_ol/wenetspeech/README.md +++ b/speechx/examples/u2pp_ol/wenetspeech/README.md @@ -2,10 +2,10 @@ ## Testing with Aishell Test Data -## Download wav and model +### Download wav and model ``` -run.sh --stop_stage 0 +./run.sh --stop_stage 0 ``` ### compute feature @@ -22,7 +22,6 @@ run.sh --stop_stage 0 ### decoding using wav - ``` ./run.sh --stage 3 --stop_stage 3 ``` diff --git a/speechx/examples/u2pp_ol/wenetspeech/local/decode.sh b/speechx/examples/u2pp_ol/wenetspeech/local/decode.sh index e9c81009..068f34a0 100755 --- a/speechx/examples/u2pp_ol/wenetspeech/local/decode.sh +++ b/speechx/examples/u2pp_ol/wenetspeech/local/decode.sh @@ -10,7 +10,7 @@ mkdir -p $exp ckpt_dir=./data/model model_dir=$ckpt_dir/asr1_chunk_conformer_u2pp_wenetspeech_static_1.3.0.model/ -utils/run.pl JOB=1:$nj $data/split${nj}/JOB/decoder.fbank.wolm.log \ +utils/run.pl JOB=1:$nj $data/split${nj}/JOB/decoder.log \ ctc_prefix_beam_search_decoder_main \ --model_path=$model_dir/export.jit \ --vocab_path=$model_dir/unit.txt \ diff --git a/speechx/examples/u2pp_ol/wenetspeech/local/nnet.sh b/speechx/examples/u2pp_ol/wenetspeech/local/nnet.sh index 5455b5c9..f947e6b1 100755 --- a/speechx/examples/u2pp_ol/wenetspeech/local/nnet.sh +++ b/speechx/examples/u2pp_ol/wenetspeech/local/nnet.sh @@ -1,18 +1,21 @@ #!/bin/bash -set -x set -e . path.sh +nj=20 data=data exp=exp + mkdir -p $exp ckpt_dir=./data/model model_dir=$ckpt_dir/asr1_chunk_conformer_u2pp_wenetspeech_static_1.3.0.model/ +utils/run.pl JOB=1:$nj $data/split${nj}/JOB/nnet.log \ u2_nnet_main \ --model_path=$model_dir/export.jit \ - --feature_rspecifier=ark,t:$exp/fbank.ark \ + --vocab_path=$model_dir/unit.txt \ + --feature_rspecifier=ark,t:${data}/split${nj}/JOB/fbank.ark \ --nnet_decoder_chunk=16 \ --receptive_field_length=7 \ --subsampling_rate=4 \ @@ -20,4 +23,3 @@ u2_nnet_main \ --nnet_encoder_outs_wspecifier=ark,t:$exp/encoder_outs.ark \ --nnet_prob_wspecifier=ark,t:$exp/logprobs.ark echo "u2 nnet decode." - diff --git a/speechx/examples/u2pp_ol/wenetspeech/run.sh b/speechx/examples/u2pp_ol/wenetspeech/run.sh index 2bc855de..870c5dee 100755 --- a/speechx/examples/u2pp_ol/wenetspeech/run.sh +++ b/speechx/examples/u2pp_ol/wenetspeech/run.sh @@ -24,8 +24,6 @@ fi ckpt_dir=$data/model -model_dir=$ckpt_dir/asr1_chunk_conformer_u2pp_wenetspeech_static_1.3.0.model/ - if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ];then # download u2pp model diff --git a/speechx/speechx/frontend/audio/data_cache.h b/speechx/speechx/frontend/audio/data_cache.h index f538df1d..5fe5e4fe 100644 --- a/speechx/speechx/frontend/audio/data_cache.h +++ b/speechx/speechx/frontend/audio/data_cache.h @@ -32,7 +32,6 @@ class DataCache : public FrontendInterface { // accept waves/feats void Accept(const kaldi::VectorBase& inputs) override { data_ = inputs; - SetDim(data_.Dim()); } bool Read(kaldi::Vector* feats) override { @@ -41,7 +40,6 @@ class DataCache : public FrontendInterface { } (*feats) = data_; data_.Resize(0); - SetDim(data_.Dim()); return true; } diff --git a/speechx/speechx/nnet/decodable.cc b/speechx/speechx/nnet/decodable.cc index 7f685908..5fe2b984 100644 --- a/speechx/speechx/nnet/decodable.cc +++ b/speechx/speechx/nnet/decodable.cc @@ -71,6 +71,7 @@ bool Decodable::AdvanceChunk() { VLOG(3) << "decodable exit;"; return false; } + CHECK_GE(frontend_->Dim(), 0); VLOG(1) << "AdvanceChunk feat cost: " << timer.Elapsed() << " sec."; VLOG(2) << "Forward in " << features.Dim() / frontend_->Dim() << " feats.";