Blame view
egs/csj/s5/local/nnet3/run_tdnn.sh
3.8 KB
8dcb6dfcb first commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
#!/bin/bash # This is modified from swbd/s5c/local/nnet3/run_tdnn.sh # Tomohiro Tanaka 15/05/2016 # this is the standard "tdnn" system, built in nnet3; it's what we use to # call multi-splice. . ./cmd.sh # At this script level we don't support not running on GPU, as it would be painfully slow. # If you want to run without GPU you'd have to call train_tdnn.sh with --gpu false, # --num-threads 16 and --minibatch-size 128. train_stage=-10 stage=0 common_egs_dir= reporting_email= remove_egs=true affix=1a # affix for the TDNN directory name nnet3_affix= train_set=train_nodup gmm=tri4 . ./cmd.sh . ./path.sh . ./utils/parse_options.sh if ! cuda-compiled; then cat <<EOF && exit 1 This script is intended to be used with GPUs but you have not compiled Kaldi with CUDA If you want to use GPUs (and have them), go to src/, and configure and make on a machine where "nvcc" is installed. EOF fi local/nnet3/run_ivector_common.sh --stage $stage \ --train-set $train_set \ --gmm $gmm \ --nnet3-affix "$nnet3_affix" || exit 1; gmm_dir=exp/$gmm ali_dir=exp/${gmm}_ali_${train_set}_sp dir=exp/nnet3${nnet3_affix}/tdnn${affix} train_ivector_dir=exp/nnet3${nnet3_affix}/ivectors_${train_set}_sp_hires if [ -e data/train_dev ] ;then dev_set=train_dev fi if [ $stage -le 9 ]; then echo "$0: creating neural net configs"; num_targets=$(tree-info $ali_dir/tree | grep num-pdfs | awk '{print $2}') mkdir -p $dir/configs cat <<EOF > $dir/configs/network.xconfig input dim=100 name=ivector input dim=40 name=input # please note that it is important to have input layer with the name=input # as the layer immediately preceding the fixed-affine-layer to enable # the use of short notation for the descriptor fixed-affine-layer name=lda input=Append(-2,-1,0,1,2,ReplaceIndex(ivector, t, 0)) affine-transform-file=$dir/configs/lda.mat # the first splicing is moved before the lda layer, so no splicing here relu-renorm-layer name=tdnn1 dim=1024 relu-renorm-layer name=tdnn2 input=Append(-1,2) dim=1024 relu-renorm-layer name=tdnn3 input=Append(-3,3) dim=1024 relu-renorm-layer name=tdnn4 input=Append(-3,3) dim=1024 relu-renorm-layer name=tdnn5 input=Append(-7,2) dim=1024 relu-renorm-layer name=tdnn6 dim=1024 output-layer name=output input=tdnn6 dim=$num_targets max-change=1.5 EOF steps/nnet3/xconfig_to_configs.py --xconfig-file $dir/configs/network.xconfig --config-dir $dir/configs/ fi if [ $stage -le 10 ]; then if [[ $(hostname -f) == *.clsp.jhu.edu ]] && [ ! -d $dir/egs/storage ]; then utils/create_split_dir.pl \ /export/b0{3,4,5,6}/$USER/kaldi-data/egs/csj-$(date +'%m_%d_%H_%M')/s5/$dir/egs/storage $dir/egs/storage fi steps/nnet3/train_dnn.py --stage=$train_stage \ --cmd="$decode_cmd" \ --feat.online-ivector-dir $train_ivector_dir \ --feat.cmvn-opts="--norm-means=false --norm-vars=false" \ --trainer.num-epochs 2 \ --trainer.optimization.num-jobs-initial 1 \ --trainer.optimization.num-jobs-final 4 \ --trainer.optimization.initial-effective-lrate 0.0017 \ --trainer.optimization.final-effective-lrate 0.00017 \ --egs.dir "$common_egs_dir" \ --cleanup.remove-egs $remove_egs \ --cleanup.preserve-model-interval 100 \ --use-gpu true \ --feat-dir=data/${train_set}_sp_hires \ --ali-dir $ali_dir \ --lang data/lang \ --reporting.email="$reporting_email" \ --dir=$dir || exit 1; fi graph_dir=exp/tri4/graph_csj_tg if [ $stage -le 11 ]; then for eval_num in $dev_set eval1 eval2 eval3 ; do steps/nnet3/decode.sh --nj 10 --cmd "$decode_cmd" \ --online-ivector-dir exp/nnet3${nnet3_affix}/ivectors_${eval_num}_hires \ $graph_dir data/${eval_num}_hires $dir/decode_${eval_num}_csj || exit 1; done fi wait; exit 0; |