Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

madcat Arabic (optional extra corpus text for LM), IAM (making word-based and BPE based setup similar), madcat Chinese (clean scripts, tuning) #2964

Merged
merged 20 commits into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions egs/iam/v1/local/augment_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2018 Hossein Hadian
# 2018 Ashish Arora

# Apache 2.0
# This script performs data augmentation.

nj=4
cmd=run.pl
feat_dim=40
echo "$0 $@"

. ./cmd.sh
. ./path.sh
. ./utils/parse_options.sh || exit 1;

srcdir=$1
outdir=$2
datadir=$3
aug_set=aug1
mkdir -p $datadir/augmentations
echo "copying $srcdir to $datadir/augmentations/$aug_set, allowed length, creating feats.scp"

for set in $aug_set; do
image/copy_data_dir.sh --spk-prefix $set- --utt-prefix $set- \
$srcdir $datadir/augmentations/$set
cat $srcdir/allowed_lengths.txt > $datadir/augmentations/$set/allowed_lengths.txt
local/extract_features.sh --nj $nj --cmd "$cmd" --feat-dim $feat_dim \
--fliplr false --augment true $datadir/augmentations/$set
done

echo " combine original data and data from different augmentations"
utils/combine_data.sh --extra-files images.scp $outdir $srcdir $datadir/augmentations/$aug_set
cat $srcdir/allowed_lengths.txt > $outdir/allowed_lengths.txt
14 changes: 14 additions & 0 deletions egs/iam/v1/local/chain/compare_wer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ for x in $*; do
done
echo

echo -n "# WER val "
for x in $*; do
wer=$(cat $x/decode_val/scoring_kaldi/best_wer | awk '{print $2}')
printf "% 10s" $wer
done
echo

echo -n "# CER val "
for x in $*; do
cer=$(cat $x/decode_val/scoring_kaldi/best_cer | awk '{print $2}')
printf "% 10s" $cer
done
echo

if $used_epochs; then
exit 0; # the diagnostics aren't comparable between regular and discriminatively trained systems.
fi
Expand Down
1 change: 1 addition & 0 deletions egs/iam/v1/local/chain/run_cnn.sh
1 change: 1 addition & 0 deletions egs/iam/v1/local/chain/run_cnn_chainali.sh
1 change: 1 addition & 0 deletions egs/iam/v1/local/chain/run_cnn_e2eali.sh
1 change: 1 addition & 0 deletions egs/iam/v1/local/chain/run_e2e_cnn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ stage=0

nj=30
train_set=train
decode_val=true
gmm=tri3 # this is the source gmm-dir that we'll use for alignments; it
# should have alignments for the specified training data.
nnet3_affix= # affix for exp dirs, e.g. it was _cleaned in tedlium.
Expand All @@ -32,7 +33,8 @@ tdnn_dim=450
# training options
srand=0
remove_egs=false
lang_test=lang_test
lang_test=lang_unk
if $decode_val; then maybe_val=val; else maybe_val= ; fi
# End configuration section.
echo "$0 $@" # Print the command line for logging

Expand Down Expand Up @@ -219,12 +221,13 @@ fi

if [ $stage -le 7 ]; then
frames_per_chunk=$(echo $chunk_width | cut -d, -f1)
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--extra-left-context $chunk_left_context \
--extra-right-context $chunk_right_context \
--extra-left-context-initial 0 \
--extra-right-context-final 0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/test $dir/decode_test || exit 1;
for decode_set in test $maybe_val; do
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/$decode_set $dir/decode_$decode_set || exit 1;
done
fi

echo "Done. Date: $(date). Results:"
local/chain/compare_wer.sh $dir
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ stage=0

nj=30
train_set=train
decode_val=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason there are no results shown herE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started the training scripts, I will surely update the result today.

gmm=tri3 # this is the source gmm-dir that we'll use for alignments; it
# should have alignments for the specified training data.
nnet3_affix= # affix for exp dirs, e.g. it was _cleaned in tedlium.
Expand All @@ -47,6 +48,7 @@ tdnn_dim=450
srand=0
remove_egs=false
lang_test=lang_unk
if $decode_val; then maybe_val=val; else maybe_val= ; fi
# End configuration section.
echo "$0 $@" # Print the command line for logging

Expand Down Expand Up @@ -235,12 +237,13 @@ fi

if [ $stage -le 7 ]; then
frames_per_chunk=$(echo $chunk_width | cut -d, -f1)
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--extra-left-context $chunk_left_context \
--extra-right-context $chunk_right_context \
--extra-left-context-initial 0 \
--extra-right-context-final 0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/test $dir/decode_test || exit 1;
for decode_set in test $maybe_val; do
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/$decode_set $dir/decode_$decode_set || exit 1;
done
fi

echo "Done. Date: $(date). Results:"
local/chain/compare_wer.sh $dir
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ stage=0

nj=30
train_set=train
decode_val=true
gmm=tri3 # this is the source gmm-dir that we'll use for alignments; it
# should have alignments for the specified training data.
nnet3_affix= # affix for exp dirs, e.g. it was _cleaned in tedlium.
Expand All @@ -44,6 +45,7 @@ tdnn_dim=450
srand=0
remove_egs=false
lang_test=lang_unk
if $decode_val; then maybe_val=val; else maybe_val= ; fi
# End configuration section.
echo "$0 $@" # Print the command line for logging

Expand Down Expand Up @@ -236,12 +238,13 @@ fi

if [ $stage -le 7 ]; then
frames_per_chunk=$(echo $chunk_width | cut -d, -f1)
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--extra-left-context $chunk_left_context \
--extra-right-context $chunk_right_context \
--extra-left-context-initial 0 \
--extra-right-context-final 0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/test $dir/decode_test || exit 1;
for decode_set in test $maybe_val; do
steps/nnet3/decode.sh --acwt 1.0 --post-decode-acwt 10.0 \
--frames-per-chunk $frames_per_chunk \
--nj $nj --cmd "$cmd" \
$dir/graph data/$decode_set $dir/decode_$decode_set || exit 1;
done
fi

echo "Done. Date: $(date). Results:"
local/chain/compare_wer.sh $dir
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#!/bin/bash

# e2eali_1b is the same as e2eali_1a but uses unconstrained egs

# local/chain/compare_wer.sh /home/hhadian/kaldi-rnnlm/egs/iam/v1/exp/chain/cnn_e2eali_1a exp/chain/cnn_e2eali_1b
# System cnn_e2eali_1a cnn_e2eali_1b
# WER 12.79 12.23
# CER 5.73 5.48
# Final train prob -0.0556 -0.0367
# Final valid prob -0.0795 -0.0592
# Final train prob (xent) -0.9178 -0.8382
# Final valid prob (xent) -1.0604 -0.9853
# Parameters 3.95M 3.95M
# local/chain/compare_wer.sh exp/chain/cnn_e2eali_1b
# System cnn_e2eali_1b (dict_50k) cnn_e2eali_1b (dict_500k)
# WER 11.41 10.25
# CER 4.87 4.60
# Final train prob -0.0384 -0.0384
# Final valid prob -0.0444 -0.0444
# Final train prob (xent) -0.8084 -0.8084
# Final valid prob (xent) -0.8470 -0.8470
# Parameters 3.97M 3.97M

# steps/info/chain_dir_info.pl exp/chain/cnn_e2eali_1b
# exp/chain/cnn_e2eali_1b: num-iters=21 nj=2..4 num-params=4.0M dim=40->360 combine=-0.038->-0.038 (over 1) xent:train/valid[13,20,final]=(-1.34,-0.967,-0.838/-1.40,-1.07,-0.985) logprob:train/valid[13,20,final]=(-0.075,-0.054,-0.037/-0.083,-0.072,-0.059)
# exp/chain/cnn_e2eali_1b: num-iters=42 nj=2..4 num-params=4.0M dim=40->376 combine=-0.039->-0.039 (over 1) xent:train/valid[27,41,final]=(-1.28,-0.846,-0.808/-1.27,-0.871,-0.847) logprob:train/valid[27,41,final]=(-0.064,-0.043,-0.038/-0.065,-0.051,-0.044)

set -e -o pipefail

stage=0

nj=30
Expand Down Expand Up @@ -141,7 +139,6 @@ if [ $stage -le 4 ]; then
mkdir -p $dir/configs
cat <<EOF > $dir/configs/network.xconfig
input dim=40 name=input

conv-relu-batchnorm-layer name=cnn1 height-in=40 height-out=40 time-offsets=-3,-2,-1,0,1,2,3 $common1
conv-relu-batchnorm-layer name=cnn2 height-in=40 height-out=20 time-offsets=-2,-1,0,1,2 $common1 height-subsample-out=2
conv-relu-batchnorm-layer name=cnn3 height-in=20 height-out=20 time-offsets=-4,-2,0,2,4 $common2
Expand All @@ -152,11 +149,9 @@ if [ $stage -le 4 ]; then
relu-batchnorm-layer name=tdnn1 input=Append(-4,-2,0,2,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts

## adding the layers for chain branch
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5 $tdnn_opts
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5 $output_opts

# adding the layers for xent branch
# This block prints the configs for a separate output that will be
# trained with a cross-entropy objective in the 'chain' mod?els... this
Expand Down
Loading