add valgrind

pull/1570/head
Yang Zhou 2 years ago
parent 6b654b51cf
commit 300caf188b

@ -0,0 +1,3 @@
# TODO
* DecibelNormalizer: there is a little bit difference between offline and online db norm. The computation of online db norm read feature chunk by chunk, which causes the feature size is different with offline db norm. In normalizer.cc:73, the samples.size() is different, which causes the difference of result.

@ -28,5 +28,5 @@ cmvn=./cmvn.ark
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
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

@ -0,0 +1,20 @@
#!/bin/bash
# this script is for memory check, so please run ./run.sh first.
set +x
set -e
if [ ! -d ../../tools/valgrind/install ]; then
echo "please install valgrind in the speechx tools dir.\n"
exit 1
fi
. ../path.sh
model_dir=../paddle_asr_model
feat_wspecifier=./feats.ark
cmvn=./cmvn.ark
valgrind --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all 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

@ -25,4 +25,4 @@ feat_wspecifier=./feats.ark
cmvn=./cmvn.ark
# 3. run feat
linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark,t:$feat_wspecifier --cmvn_write_path=$cmvn
../../fc_patch/valgrind-build/bin/valgrind --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark,t:$feat_wspecifier --cmvn_write_path=$cmvn

@ -0,0 +1,20 @@
#!/bin/bash
# this script is for memory check, so please run ./run.sh first.
set +x
set -e
if [ ! -d ../../tools/valgrind/install ]; then
echo "please install valgrind in the speechx tools dir.\n"
exit 1
fi
. ../path.sh
model_dir=../paddle_asr_model
feat_wspecifier=./feats.ark
cmvn=./cmvn.ark
valgrind --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all linear_spectrogram_main --wav_rspecifier=scp:$model_dir/wav.scp --feature_wspecifier=ark,t:$feat_wspecifier --cmvn_write_path=$cmvn

@ -22,7 +22,6 @@ fi
model_dir=../paddle_asr_model
# 4. run decoder
pp-model-test --model_path=$model_dir/avg_1.jit.pdmodel --param_path=$model_dir/avg_1.jit.pdparams

@ -0,0 +1,18 @@
#!/bin/bash
# this script is for memory check, so please run ./run.sh first.
set +x
set -e
if [ ! -d ../../tools/valgrind/install ]; then
echo "please install valgrind in the speechx tools dir.\n"
exit 1
fi
. ../path.sh
model_dir=../paddle_asr_model
valgrind --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all pp-model-test --model_path=$model_dir/avg_1.jit.pdmodel --param_path=$model_dir/avg_1.jit.pdparams

@ -4,8 +4,11 @@ SPEECHX_ROOT=$PWD/../..
SPEECHX_EXAMPLES=$SPEECHX_ROOT/build/examples
SPEECHX_BIN=$SPEECHX_EXAMPLES/nnet:$SPEECHX_EXAMPLES/decoder:$SPEECHX_EXAMPLES/feat
SPEECHX_TOOLS=$SPEECHX_ROOT/tools
TOOLS_BIN=$SPEECHX_TOOLS/valgrind/install/bin
[ -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
export PATH=$PATH:$SPEECHX_BIN:$TOOLS_BIN

@ -206,9 +206,9 @@ int32 CTCBeamSearch::SearchOneChar(
size_t beam_size = opts_.beam_size;
const auto& c = log_prob_idx.first;
const auto& log_prob_c = log_prob_idx.second;
size_t prefixes__len = std::min(prefixes_.size(), beam_size);
size_t prefixes_len = std::min(prefixes_.size(), beam_size);
for (size_t i = 0; i < prefixes__len; ++i) {
for (size_t i = 0; i < prefixes_len; ++i) {
auto prefix = prefixes_[i];
if (full_beam && log_prob_c + prefix->score < min_cutoff) {
break;
@ -311,4 +311,4 @@ void CTCBeamSearch::LMRescore() {
}
}
} // namespace ppspeech
} // namespace ppspeech

@ -0,0 +1,26 @@
#!/bin/bash
VALGRIND_VERSION=3.18.1
set -e
tarball=valgrind-3.18.1.tar.bz2
url=https://sourceware.org/pub/valgrind/valgrind-3.18.1.tar.bz2
if [ -f $tarball ]; then
echo "use the $tarball have downloaded."
else
wget -t3 --no-check-certificate $url
fi
tar xjfv $tarball
mv valgrind-3.18.1 valgrind
prefix=$PWD/valgrind/install
cd ./valgrind/
./configure --prefix=$prefix
make
make install
cd -
Loading…
Cancel
Save