Commit d8f88fe8 authored by Dan Povey's avatar Dan Povey
Browse files

sandbox/dan2: Adding new version of nnet training scripts for RM.

git-svn-id: https://svn.code.sf.net/p/kaldi/code/sandbox/dan2@2778 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent 5f397825
#!/bin/bash
. cmd.sh
# This examples runs on top of "raw-fMLLR" features.
( steps/nnet2/train_tanh.sh --splice-width 7 \
--egs-dir exp/tri4a1xa32_nnet/egs \
--softmax-learning-rate-factor 0.5 --cleanup false \
--initial-learning-rate 0.08 --final-learning-rate 0.008 \
--num-hidden-layers 2 \
--num-epochs-extra 10 --add-layers-period 1 \
--mix-up 4000 \
--cmd "$decode_cmd" \
--hidden-layer-dim 375 \
data/train data/lang exp/tri3c_ali exp/nnet4a || exit 1
steps/nnet2/decode.sh --config conf/decode.config --cmd "$decode_cmd" --nj 20 --feat-type raw \
--transform-dir exp/tri3c/decode \
exp/tri3c/graph data/test exp/nnet4a/decode
steps/nnet2/decode.sh --config conf/decode.config --cmd "$decode_cmd" --nj 20 --feat-type raw \
--transform-dir exp/tri3c/decode_ug \
exp/tri3c/graph_ug data/test exp/nnet4a/decode_ug
)
#!/bin/bash
# This trains only unadapted (just cepstral mean normalized) features,
# and uses various combinations of VTLN warping factor and time-warping
# factor to artificially expand the amount of data.
. cmd.sh
set -e
if true; then
featdir=`pwd`/mfcc/nnet4b; mkdir -p $featdir
mkdir -p conf/nnet4b
all_fbankdirs=""
all_mfccdirs=""
pairs="1.1-1.0 1.05-1.2 1.0-0.8 0.95-1.1 0.9-0.9"
for pair in $pairs; do
vtln_warp=`echo $pair | cut -d- -f1`
time_warp=`echo $pair | cut -d- -f2`
fs=`perl -e "print ($time_warp*10);"`
fbank_conf=conf/nnet4b/fbank_vtln${vtln_warp}_time${time_warp}.conf
( echo "--num-mel-bins=40"; echo "--frame-shift=$fs"; echo "--vtln-warp=$vtln_warp" ) > $fbank_conf
echo "Making filterbank features for $pair"
fbank_data=data/nnet4b/train_fbank_vtln${vtln_warp}_time${time_warp}
all_fbankdirs="$all_fbankdirs $fbank_data"
utils/copy_data_dir.sh --spk-prefix ${pair}- --utt-prefix ${pair}- data/train $fbank_data
steps/make_fbank.sh --fbank-config $fbank_conf --nj 8 --cmd "run.pl" $fbank_data exp/nnet4b/make_mfcc/mfcc_$pair $featdir
steps/compute_cmvn_stats.sh $fbank_data exp/nnet4b/fbank_$pair $featdir
echo "Making MFCC features for $pair"
mfcc_data=data/nnet4b/train_mfcc_vtln${vtln_warp}_time${time_warp}
mfcc_conf=conf/nnet4b/mfcc_vtln${vtln_warp}_time${time_warp}.conf
( echo "--use-energy=false"; echo "--frame-shift=$fs" ; echo "--vtln-warp=$vtln_warp" ) > $mfcc_conf
utils/copy_data_dir.sh --spk-prefix ${pair}- --utt-prefix ${pair}- data/train $mfcc_data
steps/make_mfcc.sh --mfcc-config $mfcc_conf --nj 8 --cmd "run.pl" $mfcc_data exp/nnet4b/make_mfcc/mfcc_$pair $featdir
steps/compute_cmvn_stats.sh $mfcc_data exp/nnet4b/mfcc_$pair $featdir
all_mfccdirs="$all_mfccdirs $mfcc_data"
done
utils/combine_data.sh data/nnet4b/train_fbank_all $all_fbankdirs
utils/combine_data.sh data/nnet4b/train_mfcc_all $all_mfccdirs
steps/align_fmllr.sh --nj 8 --cmd "$train_cmd" \
data/nnet4b/train_mfcc_all data/lang exp/tri3b exp/tri3b_ali_nnet4b
fi
( steps/nnet2/train_block.sh \
--bias-stddev 0.5 --splice-width 7 --egs-opts "--feat-type raw" \
--softmax-learning-rate-factor 0.5 --cleanup false \
--initial-learning-rate 0.04 --final-learning-rate 0.004 \
--num-epochs-extra 10 --add-layers-period 1 \
--mix-up 4000 \
--cmd "$decode_cmd" \
--hidden-layer-dim 450 \
data/nnet4b/train_fbank_all data/lang exp/tri3b_ali_nnet4b exp/nnet4b || exit 1
steps/nnet2/decode.sh --config conf/decode.config --cmd "$decode_cmd" --nj 20 --feat-type raw \
exp/tri3b/graph data/test_fbank exp/nnet4b/decode
steps/nnet2/decode.sh --config conf/decode.config --cmd "$decode_cmd" --nj 20 --feat-type raw \
exp/tri3b/graph_ug data/test_fbank exp/nnet4b/decode_ug
)
#!/bin/bash
. cmd.sh
# result: exp/tri4a1_nnet/decode/wer_2:%WER 1.69 [ 212 / 12533, 26 ins, 44 del, 142 sub ]
( steps/train_nnet_cpu.sh --num-epochs 20 \
--num-epochs-extra 10 --add-layers-period 1 \
--mix-up 4000 --num-iters-final 5 --shrink-interval 3 \
--initial-learning-rate 0.02 --final-learning-rate 0.004 \
--cmd "$decode_cmd" \
--num-parameters 750000 \
data/train data/lang exp/tri3b_ali exp/tri4a1_nnet
# This example runs on top of "raw-fMLLR" features:
local/nnet2/run_4a.sh
steps/decode_nnet_cpu.sh --config conf/decode.config --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_nnet/decode )
# using conf/decode.config as we need much larger beams for RM.
steps/make_denlats_nnet_cpu.sh --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_denlats
steps/train_nnet_cpu_mmi.sh --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_a
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_a/decode
(
steps/train_nnet_cpu_mmi.sh --initial-learning-rate 0.0005 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_b
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_b/decode
)&
# Get WER on training data before MMI.
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_nnet/decode_train
# WER on tri3b as baseline, want to see how it compares to tri3b_mmi
steps/decode.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri3b/decode_train
steps/decode.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri3b_mmi/decode_train
(
steps/train_nnet_cpu_mmi.sh --boost 0.1 --initial-learning-rate 0.0005 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_c
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_c/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_c/decode_train
)&
(
steps/train_nnet_cpu_mmi.sh --E 0.5 --boost 0.1 --initial-learning-rate 0.0005 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_d
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_d/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_d/decode_train
)&
(
steps/train_nnet_cpu_mmi.sh --E 0.5 --boost 0.1 --initial-learning-rate 0.001 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_e
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_e/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_e/decode_train
)&
( # _e2 is as _e, but 2 epochs per EBW iter.
steps/train_nnet_cpu_mmi.sh --epochs-per-ebw-iter 2 --E 0.5 --boost 0.1 --initial-learning-rate 0.001 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_e2
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_e2/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_e2/decode_train
)&
( # With E = 0.0 it was terrible. WER is 12.5%
steps/train_nnet_cpu_mmi.sh --E 0.0 --boost 0.1 --initial-learning-rate 0.001 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_f
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_f/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_f/decode_train
)&
(
steps/train_nnet_cpu_mmi.sh --E 0.25 --boost 0.1 --initial-learning-rate 0.001 \
--minibatch-size 128 --cmd "$decode_cmd" --transform-dir exp/tri3b_ali \
data/train data/lang exp/tri4a1_nnet exp/tri4a1_nnet exp/tri4a1_denlats exp/tri4a1_mmi_g
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 20 \
--transform-dir exp/tri3b/decode \
exp/tri3b/graph data/test exp/tri4a1_mmi_g/decode
# WER on trainnig data
steps/decode_nnet_cpu.sh --cmd "$decode_cmd" --nj 8 \
--config conf/decode.config --transform-dir exp/tri3b \
exp/tri3b/graph data/train exp/tri4a1_mmi_g/decode_train
)&
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment