index 5379484a95f64268dafe3cbd8ab49511bf7623a9..0484fd229a60c72336cbb89e631ccbc2de9e2168 100755 (executable)
lattice_beam=8.0 # Beam we use in lattice generation.
iter=final
num_threads=1 # if >1, will use gmm-latgen-faster-parallel
-parallel_opts= # ignored now.
scoring_opts=
+skip_diagnostics=false
skip_scoring=false
extra_left_context=0
extra_right_context=0
-feat_type=
+extra_left_context_initial=-1
+extra_right_context_final=-1
online_ivector_dir=
minimize=false
# End configuration section.
echo " --iter <iter> # Iteration of model to decode; default is final."
echo " --scoring-opts <string> # options to local/score.sh"
echo " --num-threads <n> # number of threads to use, default 1."
- echo " --parallel-opts <opts> # e.g. '--num-threads 4' if you supply --num-threads 4"
exit 1;
fi
model=$srcdir/$iter.mdl
-[ ! -z "$online_ivector_dir" ] && \
+extra_files=
+if [ ! -z "$online_ivector_dir" ]; then
+ steps/nnet2/check_ivectors_compatible.sh $srcdir $online_ivector_dir || exit 1
extra_files="$online_ivector_dir/ivector_online.scp $online_ivector_dir/ivector_period"
+fi
for f in $graphdir/HCLG.fst $data/feats.scp $model $extra_files; do
[ ! -f $f ] && echo "$0: no such file $f" && exit 1;
## Set up features.
-if [ -z "$feat_type" ]; then
- if [ -f $srcdir/final.mat ]; then feat_type=lda; else feat_type=raw; fi
- echo "$0: feature type is $feat_type"
-fi
-
-splice_opts=`cat $srcdir/splice_opts 2>/dev/null`
+echo "$0: feature type is raw"
-case $feat_type in
- raw) feats="ark,s,cs:apply-cmvn $cmvn_opts --utt2spk=ark:$sdata/JOB/utt2spk scp:$sdata/JOB/cmvn.scp scp:$sdata/JOB/feats.scp ark:- |";;
- lda) feats="ark,s,cs:apply-cmvn $cmvn_opts --utt2spk=ark:$sdata/JOB/utt2spk scp:$sdata/JOB/cmvn.scp scp:$sdata/JOB/feats.scp ark:- | splice-feats $splice_opts ark:- ark:- | transform-feats $srcdir/final.mat ark:- ark:- |"
- ;;
- *) echo "$0: invalid feature type $feat_type" && exit 1;
-esac
+feats="ark,s,cs:apply-cmvn $cmvn_opts --utt2spk=ark:$sdata/JOB/utt2spk scp:$sdata/JOB/cmvn.scp scp:$sdata/JOB/feats.scp ark:- |"
if [ ! -z "$transform_dir" ]; then
echo "$0: using transforms from $transform_dir"
[ ! -s $transform_dir/num_jobs ] && \
echo "$0: expected $transform_dir/num_jobs to contain the number of jobs." && exit 1;
nj_orig=$(cat $transform_dir/num_jobs)
- if [ $feat_type == "raw" ]; then trans=raw_trans;
- else trans=trans; fi
- if [ $feat_type == "lda" ] && \
- ! cmp $transform_dir/../final.mat $srcdir/final.mat && \
- ! cmp $transform_dir/final.mat $srcdir/final.mat; then
- echo "$0: LDA transforms differ between $srcdir and $transform_dir"
- exit 1;
- fi
- if [ ! -f $transform_dir/$trans.1 ]; then
- echo "$0: expected $transform_dir/$trans.1 to exist (--transform-dir option)"
+ if [ ! -f $transform_dir/raw_trans.1 ]; then
+ echo "$0: expected $transform_dir/raw_trans.1 to exist (--transform-dir option)"
exit 1;
fi
if [ $nj -ne $nj_orig ]; then
# Copy the transforms into an archive with an index.
- for n in $(seq $nj_orig); do cat $transform_dir/$trans.$n; done | \
- copy-feats ark:- ark,scp:$dir/$trans.ark,$dir/$trans.scp || exit 1;
- feats="$feats transform-feats --utt2spk=ark:$sdata/JOB/utt2spk scp:$dir/$trans.scp ark:- ark:- |"
+ for n in $(seq $nj_orig); do cat $transform_dir/raw_trans.$n; done | \
+ copy-feats ark:- ark,scp:$dir/raw_trans.ark,$dir/raw_trans.scp || exit 1;
+ feats="$feats transform-feats --utt2spk=ark:$sdata/JOB/utt2spk scp:$dir/raw_trans.scp ark:- ark:- |"
else
# number of jobs matches with alignment dir.
- feats="$feats transform-feats --utt2spk=ark:$sdata/JOB/utt2spk ark:$transform_dir/$trans.JOB ark:- ark:- |"
+ feats="$feats transform-feats --utt2spk=ark:$sdata/JOB/utt2spk ark:$transform_dir/raw_trans.JOB ark:- ark:- |"
fi
elif grep 'transform-feats --utt2spk' $srcdir/log/train.1.log >&/dev/null; then
echo "$0: **WARNING**: you seem to be using a neural net system trained with transforms,"
fi
if [ "$post_decode_acwt" == 1.0 ]; then
- lat_wspecifier="ark|gzip -c >$dir/lat.JOB.gz"
+ lat_wspecifier="ark:|gzip -c >$dir/lat.JOB.gz"
else
lat_wspecifier="ark:|lattice-scale --acoustic-scale=$post_decode_acwt ark:- ark:- | gzip -c >$dir/lat.JOB.gz"
fi
+frame_subsampling_opt=
if [ -f $srcdir/frame_subsampling_factor ]; then
# e.g. for 'chain' systems
frame_subsampling_opt="--frame-subsampling-factor=$(cat $srcdir/frame_subsampling_factor)"
--frames-per-chunk=$frames_per_chunk \
--extra-left-context=$extra_left_context \
--extra-right-context=$extra_right_context \
+ --extra-left-context-initial=$extra_left_context_initial \
+ --extra-right-context-final=$extra_right_context_final \
--minimize=$minimize --max-active=$max_active --min-active=$min_active --beam=$beam \
--lattice-beam=$lattice_beam --acoustic-scale=$acwt --allow-partial=true \
--word-symbol-table=$graphdir/words.txt "$model" \
$graphdir/HCLG.fst "$feats" "$lat_wspecifier" || exit 1;
fi
-# The output of this script is the files "lat.*.gz"-- we'll rescore this at
-# different acoustic scales to get the final output.
-
if [ $stage -le 2 ]; then
+ if ! $skip_diagnostics ; then
+ [ ! -z $iter ] && iter_opt="--iter $iter"
+ steps/diagnostic/analyze_lats.sh --cmd "$cmd" $iter_opt $graphdir $dir
+ fi
+fi
+
+
+# The output of this script is the files "lat.*.gz"-- we'll rescore this at
+# different acoustic scales to get the final output.
+if [ $stage -le 3 ]; then
if ! $skip_scoring ; then
[ ! -x local/score.sh ] && \
echo "Not scoring because local/score.sh does not exist or not executable." && exit 1;
echo "score best paths"
- local/score.sh $scoring_opts --cmd "$cmd" $data $graphdir $dir
+ [ "$iter" != "final" ] && iter_opt="--iter $iter"
+ local/score.sh $iter_opt $scoring_opts --cmd "$cmd" $data $graphdir $dir
echo "score confidence and timing with sclite"
fi
fi