From 1263b210b2f3abb6080bb23125a8ec3c95cdefba Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Mon, 17 May 2021 10:47:56 +0000 Subject: [PATCH] more decoding method --- examples/librispeech/s1/README.md | 0 examples/librispeech/s1/conf/conformer.yaml | 2 +- examples/librispeech/s1/local/test.sh | 44 +++++++++++++++------ 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 examples/librispeech/s1/README.md diff --git a/examples/librispeech/s1/README.md b/examples/librispeech/s1/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/examples/librispeech/s1/conf/conformer.yaml b/examples/librispeech/s1/conf/conformer.yaml index 1981b946f..cf433f6d9 100644 --- a/examples/librispeech/s1/conf/conformer.yaml +++ b/examples/librispeech/s1/conf/conformer.yaml @@ -2,7 +2,7 @@ data: train_manifest: data/manifest.train dev_manifest: data/manifest.dev - test_manifest: data/manifest.test + test_manifest: data/manifest.test-clean vocab_filepath: data/vocab.txt unit_type: 'spm' spm_model_prefix: 'data/bpe_unigram_5000' diff --git a/examples/librispeech/s1/local/test.sh b/examples/librispeech/s1/local/test.sh index 240a63b06..890f95967 100755 --- a/examples/librispeech/s1/local/test.sh +++ b/examples/librispeech/s1/local/test.sh @@ -21,17 +21,39 @@ ckpt_prefix=$2 # exit 1 #fi -python3 -u ${BIN_DIR}/test.py \ ---device ${device} \ ---nproc 1 \ ---config ${config_path} \ ---result_file ${ckpt_prefix}.rsl \ ---checkpoint_path ${ckpt_prefix} - -if [ $? -ne 0 ]; then - echo "Failed in evaluation!" - exit 1 -fi +for type in attention ctc_greedy_search; do + echo "decoding ${type}" + batch_size=64 + python3 -u ${BIN_DIR}/test.py \ + --device ${device} \ + --nproc 1 \ + --config ${config_path} \ + --result_file ${ckpt_prefix}.rsl \ + --checkpoint_path ${ckpt_prefix} \ + --opts decoding.decoding_method ${type} decoding.batch_size ${batch_size} + + if [ $? -ne 0 ]; then + echo "Failed in evaluation!" + exit 1 + fi +done + +for type in ctc_prefix_beam_search attention_rescoring; do + echo "decoding ${type}" + batch_size=1 + python3 -u ${BIN_DIR}/test.py \ + --device ${device} \ + --nproc 1 \ + --config ${config_path} \ + --result_file ${ckpt_prefix}.rsl \ + --checkpoint_path ${ckpt_prefix} \ + --opts decoding.decoding_method ${type} decoding.batch_size ${batch_size} + + if [ $? -ne 0 ]; then + echo "Failed in evaluation!" + exit 1 + fi +done exit 0