Skip to content

Commit

Permalink
[examples] update units in examples (wenet-e2e#1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
robin1001 authored Jun 11, 2022
1 parent 46b284a commit 7083e6f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
--port 10086 \
--chunk_size 16 \
--model_path \$model/final.zip \
--dict_path \$model/words.txt 2>&1 | tee server.log
--unit_path \$model/units.txt 2>&1 | tee server.log
EOF
id=$(docker create ubuntu:latest)
Expand Down
2 changes: 1 addition & 1 deletion docs/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ model_dir=docker_resource/model
--model_path $model_dir/final.zip \
--context_path $context_path \
--context_score 3 \
--dict_path $model_dir/words.txt 2>&1 | tee log.txt
--unit_path $model_dir/units.txt 2>&1 | tee log.txt
```


3 changes: 2 additions & 1 deletion docs/lm.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ tools/fst/make_tlg.sh data/local/lm data/local/lang data/lang_test || exit 1;
--beam 15.0 --lattice_beam 7.5 --max_active 7000 \
--blank_skip_thresh 0.98 --ctc_weight 0.5 --rescoring_weight 1.0 \
--fst_path data/lang_test/TLG.fst \
--dict_path data/lang_test/words.txt \
data/test/wav.scp data/test/text $dir/final.zip \
data/lang_test/words.txt $dir/lm_with_runtime
data/lang_test/units.txt $dir/lm_with_runtime
```
3 changes: 2 additions & 1 deletion docs/tutorial_librispeech.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
--beam 10.0 --lattice_beam 5 --max_active 7000 --blank_skip_thresh 0.98 \
--ctc_weight 0.5 --rescoring_weight 1.0 --acoustic_scale 1.2 \
--fst_path $fst_dir/TLG.fst \
data/$test/wav.scp data/$test/text $dir/final.zip $fst_dir/words.txt \
--dict_path $fst_dir/words.txt \
data/$test/wav.scp data/$test/text $dir/final.zip $fst_dir/units.txt \
$dir/lm_with_runtime_${test}
tail $dir/lm_with_runtime_${test}/wer
done
Expand Down
3 changes: 2 additions & 1 deletion examples/aishell/s0/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
--blank_skip_thresh 0.98 --ctc_weight 0.5 --rescoring_weight 1.0 \
--chunk_size $chunk_size \
--fst_path data/lang_test/TLG.fst \
--dict_path data/lang_test/words.fst \
data/test/wav.scp data/test/text $dir/final.zip \
data/lang_test/words.txt $dir/lm_with_runtime
data/lang_test/units.txt $dir/lm_with_runtime
# Please see $dir/lm_with_runtime for wer
fi

Expand Down
3 changes: 2 additions & 1 deletion examples/aishell/s0_deprecated/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
--blank_skip_thresh 0.98 --ctc_weight 0.5 --rescoring_weight 1.0 \
--reverse_weight $reverse_weight --chunk_size $chunk_size \
--fst_path data/lang_test/TLG.fst \
--dict_path data/lang_test/words.txt \
data/test/wav.scp data/test/text $dir/final.zip \
data/lang_test/words.txt $dir/lm_with_runtime
data/lang_test/units.txt $dir/lm_with_runtime
# See $dir/lm_with_runtime for wer
fi

Expand Down
3 changes: 2 additions & 1 deletion examples/aishell2/s0/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
--beam 15.0 --lattice_beam 7.5 --max_active 7000 --blank_skip_thresh 0.98 \
--ctc_weight 0.3 --rescoring_weight 1.0 --reverse_weight $reverse_weight\
--fst_path data/lang_test/TLG.fst \
data/test/wav.scp data/test/text $dir/final.zip data/lang_test/words.txt \
--dict_path data/lang_test/words.txt \
data/test/wav.scp data/test/text $dir/final.zip data/lang_test/units.txt \
$dir/lm_with_runtime
# See $dir/lm_with_runtime for wer
tail $dir/lm_with_runtime/wer
Expand Down
3 changes: 2 additions & 1 deletion examples/librispeech/s0/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
--beam 10.0 --lattice_beam 5 --max_active 7000 --blank_skip_thresh 0.98 \
--ctc_weight 0.5 --rescoring_weight 1.0 --acoustic_scale 1.2 \
--fst_path $fst_dir/TLG.fst \
data/$test/wav.scp data/$test/text $dir/final.zip $fst_dir/words.txt \
--dict_path $fst_dir/words.txt \
data/$test/wav.scp data/$test/text $dir/final.zip $fst_dir/units.txt \
$dir/lm_with_runtime_${test}
tail $dir/lm_with_runtime_${test}/wer
done
Expand Down
8 changes: 5 additions & 3 deletions tools/decode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ reverse_weight=0.0
rescoring_weight=1.0
# For CTC WFST based decoding
fst_path=
dict_path=
acoustic_scale=1.0
beam=15.0
lattice_beam=12.0
Expand All @@ -23,7 +24,7 @@ length_penalty=0.0

. tools/parse_options.sh || exit 1;
if [ $# != 5 ]; then
echo "Usage: $0 [options] <wav.scp> <label_file> <model_file> <dict_file> <output_dir>"
echo "Usage: $0 [options] <wav.scp> <label_file> <model_file> <unit_file> <output_dir>"
exit 1;
fi

Expand All @@ -35,7 +36,7 @@ fi
scp=$1
label_file=$2
model_file=$3
dict_file=$4
unit_file=$4
dir=$5

mkdir -p $dir/split${nj}
Expand All @@ -52,6 +53,7 @@ wfst_decode_opts=
if [ ! -z $fst_path ]; then
wfst_decode_opts="--fst_path $fst_path"
wfst_decode_opts="$wfst_decode_opts --beam $beam"
wfst_decode_opts="$wfst_decode_opts --dict_path $dict_path"
wfst_decode_opts="$wfst_decode_opts --lattice_beam $lattice_beam"
wfst_decode_opts="$wfst_decode_opts --max_active $max_active"
wfst_decode_opts="$wfst_decode_opts --min_active $min_active"
Expand All @@ -69,7 +71,7 @@ for n in $(seq ${nj}); do
--chunk_size $chunk_size \
--wav_scp ${dir}/split${nj}/wav.${n}.scp \
--model_path $model_file \
--dict_path $dict_file \
--unit_path $unit_file \
$wfst_decode_opts \
--result ${dir}/split${nj}/${n}.text &> ${dir}/split${nj}/${n}.log
} &
Expand Down

0 comments on commit 7083e6f

Please sign in to comment.