提交 300caf18 编写于 作者: Y Yang Zhou

add valgrind

上级 6b654b51
# 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
#!/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
#!/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
#!/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
\ No newline at end of file
} // namespace ppspeech
#!/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 -
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册