Skip to content

Commit

Permalink
modified run_common_lang.sh to used make_mfcc{,_pitch}.sh instead of …
Browse files Browse the repository at this point in the history
…make_pitch.sh.
  • Loading branch information
pegahgh committed Apr 27, 2017
1 parent 14c7e65 commit 2579669
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 47 deletions.
2 changes: 1 addition & 1 deletion egs/babel_multilang/s5/local/nnet3/extract_ivector_lang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ivector_suffix=_gb
lang=$1
global_extractor=$2

if [ $stage -le 8 ]; then
if [ $stage -le 7 ]; then
# We extract iVectors on all the train_nodup data, which will be what we
# train the system on.
# having a larger number of speakers is helpful for generalization, and to
Expand Down
56 changes: 19 additions & 37 deletions egs/babel_multilang/s5/local/nnet3/run_common_langs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,57 +59,39 @@ if [ "$speed_perturb" == "true" ]; then
fi

if [ $stage -le 3 ] && [ ! -f data/$lang/${train_set}_hires/.done ]; then
hires_config="--mfcc-config conf/mfcc_hires.conf"
feat_suffix=_hires_mfcc
mfccdir=mfcc_hires/$lang
if $use_pitch; then
feat_suffix=${feat_suffix}_pitch
hires_config="$hires_configs --pitch-config $pitch_conf"
mfccdir=${mfccdir}_pitch/$lang
fi

if [[ $(hostname -f) == *.clsp.jhu.edu ]] && [ ! -d $mfccdir/storage ]; then
date=$(date +'%m_%d_%H_%M')
utils/create_split_dir.pl /export/b0{1,2,3,4}/$USER/kaldi-data/egs/$lang-$date/s5c/$mfccdir/storage $mfccdir/storage
fi


for dataset in $train_set ; do
utils/copy_data_dir.sh data/$lang/$dataset data/$lang/${dataset}_hires
data_dir=data/$lang/${dataset}${feat_suffix}
log_dir=exp/$lang/make${feat_suffix}/$dataset

# scale the waveforms, this is useful as we don't use CMVN
data_dir=data/$lang/${dataset}_hires
utils/copy_data_dir.sh data/$lang/$dataset ${data_dir} || exit 1;

utils/data/perturb_data_dir_volume.sh $data_dir || exit 1 ;
# scale the waveforms, this is useful as we don't use CMVN
utils/data/perturb_data_dir_volume.sh $data_dir || exit 1;

steps/make_mfcc.sh --nj 70 --mfcc-config conf/mfcc_hires.conf \
--cmd "$train_cmd" data/$lang/${dataset}_hires exp/$lang/make_hires/$dataset $mfccdir;
steps/make${feat_suffix}.sh --nj 70 $hires_config \
--cmd "$train_cmd" ${data_dir} $log_dir $mfccdir;

steps/compute_cmvn_stats.sh data/$lang/${dataset}_hires exp/$lang/make_hires/${dataset} $mfccdir;
steps/compute_cmvn_stats.sh ${data_dir} $log_dir $mfccdir;

# Remove the small number of utterances that couldn't be extracted for some
# reason (e.g. too short; no such file).
utils/fix_data_dir.sh data/$lang/${dataset}_hires;
utils/fix_data_dir.sh ${data_dir};
done
touch data/$lang/${train_set}_hires/.done
touch ${data_dir}/.done
fi

if [ $stage -le 4 ]; then
if [[ "$use_pitch" == "true" ]]; then
pitchdir=pitch/$lang
train_set=${train_set}_hires
for dataset in $train_set; do
if $use_pitch; then
mkdir -p $pitchdir
if [ ! -f data/$lang/${dataset}_pitch/feats.scp ]; then
echo "$0: Generating pitch features for data/$lang as use_pitch=$use_pitch"
utils/copy_data_dir.sh data/$lang/$dataset data/$lang/${dataset}_pitch
steps/make_pitch.sh --nj 70 --pitch-config $pitch_conf \
--cmd "$train_cmd" data/$lang/${dataset}_pitch exp/$lang/make_pitch/${dataset} $pitchdir;
fi
feat_suffix=_pitch
fi

if [ ! -f data/$lang/${dataset}_mfcc${feat_suffix}/feats.scp ]; then
steps/append_feats.sh --nj 16 --cmd "$train_cmd" data/$lang/${dataset} \
data/$lang/${dataset}${feat_suffix} data/$lang/${dataset}_mfcc${feat_suffix} \
exp/$lang/append_mfcc${feat_suffix}/${dataset} mfcc${feat_suffix}/$lang

steps/compute_cmvn_stats.sh data/$lang/${dataset}_mfcc${feat_suffix} exp/$lang/make_cmvn_mfcc${feat_suffix}/${x} mfcc${feat_suffix}/$lang
fi
done
fi
fi

exit 0;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ langconf=conf/$lda_mllt_lang/lang.conf
[ ! -f $langconf ] && echo 'Language configuration does not exist! Use the configurations in conf/lang/* as a startup' && exit 1
. $langconf || exit 1;

if [ $stage -le 5 ]; then
if [ $stage -le 4 ]; then
# We need to build a small system just because we need the LDA+MLLT transform
# to train the diag-UBM on top of. We use --num-iters 13 because after we get
# the transform (12th iter is the last), any further training is pointless.
Expand All @@ -51,13 +51,13 @@ if [ $stage -le 5 ]; then
data/$lda_mllt_lang/lang exp/$lda_mllt_lang/tri5_ali${suffix} exp/$lda_mllt_lang/nnet3/tri3b
fi

if [ $stage -le 6 ]; then
if [ $stage -le 5 ]; then
# To train a diagonal UBM we don't need very much data, so use the smallest subset.
steps/online/nnet2/train_diag_ubm.sh --cmd "$train_cmd" --nj 200 --num-frames 500000 \
$multi_data_dir $numGaussUBM exp/$lda_mllt_lang/nnet3/tri3b $global_extractor_dir/diag_ubm
fi

if [ $stage -le 7 ]; then
if [ $stage -le 6 ]; then
# iVector extractors can be sensitive to the amount of data, but this one has a
# fairly small dim (defaults to 100) so we don't use all of it, we use just the
# 100k subset (just under half the data).
Expand Down
12 changes: 6 additions & 6 deletions egs/babel_multilang/s5/local/nnet3/run_tdnn_multilingual.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ else
fi
feat_dim=`feat-to-dim scp:${multi_data_dirs[0]}/feats.scp -`

if [ $stage -le 9 ]; then
if [ $stage -le 8 ]; then
echo "$0: creating multilingual neural net configs using the xconfig parser";
if [ -z $bnf_dim ]; then
bnf_dim=1024
Expand Down Expand Up @@ -202,7 +202,7 @@ EOF
nnet3-copy --edits="remove-output-nodes name=output-tmp" $dir/configs/ref.raw $dir/configs/ref.raw || exit 1;
fi

if [ $stage -le 10 ]; then
if [ $stage -le 9 ]; then
echo "$0: Generates separate egs dir per language for multilingual training."
# sourcing the "vars" below sets
#model_left_context=(something)
Expand All @@ -225,7 +225,7 @@ if [ -z $megs_dir ];then
megs_dir=$dir/egs
fi

if [ $stage -le 11 ] && [ ! -z $megs_dir ]; then
if [ $stage -le 10 ] && [ ! -z $megs_dir ]; then
echo "$0: Generate multilingual egs dir using "
echo "separate egs dirs for multilingual training."
if [ ! -z "$lang2weight" ]; then
Expand All @@ -238,7 +238,7 @@ if [ $stage -le 11 ] && [ ! -z $megs_dir ]; then
$num_langs ${common_egs_dir[@]} || exit 1;
fi

if [ $stage -le 12 ]; then
if [ $stage -le 11 ]; then
steps/nnet3/train_raw_dnn.py --stage=$train_stage \
--cmd="$decode_cmd" \
--feat.cmvn-opts="--norm-means=false --norm-vars=false" \
Expand All @@ -262,7 +262,7 @@ if [ $stage -le 12 ]; then
--dir=$dir || exit 1;
fi

if [ $stage -le 13 ]; then
if [ $stage -le 12 ]; then
for lang_index in `seq 0 $[$num_langs-1]`;do
lang_dir=$dir/${lang_list[$lang_index]}
mkdir -p $lang_dir
Expand All @@ -282,7 +282,7 @@ if [ $stage -le 13 ]; then
fi

# decoding different languages
if [ $stage -le 14 ]; then
if [ $stage -le 13 ]; then
num_decode_lang=${#decode_lang_list[@]}
for lang_index in `seq 0 $[$num_decode_lang-1]`; do
if [ ! -f $dir/${decode_lang_list[$lang_index]}/decode_dev10h.pem/.done ]; then
Expand Down

0 comments on commit 2579669

Please sign in to comment.