@@ -40,8 +40,8 @@ int main(int argc, char *argv[]) {
4040
4141 const char *usage =
4242 " Align features given neural-net-based model\n "
43- " Usage: nnet-align-compiled [options] model-in graphs-rspecifier "
44- " feature-rspecifier alignments-wspecifier\n "
43+ " Usage: nnet-align-compiled [options] < model-in> < graphs-rspecifier> "
44+ " < feature-rspecifier> < alignments-wspecifier> \n "
4545 " e.g.: \n "
4646 " nnet-align-compiled 1.mdl ark:graphs.fsts scp:train.scp ark:1.ali\n "
4747 " or:\n "
@@ -54,6 +54,7 @@ int main(int argc, char *argv[]) {
5454 BaseFloat acoustic_scale = 1.0 ;
5555 BaseFloat transition_scale = 1.0 ;
5656 BaseFloat self_loop_scale = 1.0 ;
57+ std::string per_frame_acwt_wspecifier;
5758
5859 align_config.Register (&po);
5960 po.Register (" transition-scale" , &transition_scale,
@@ -63,6 +64,9 @@ int main(int argc, char *argv[]) {
6364 po.Register (" self-loop-scale" , &self_loop_scale,
6465 " Scale of self-loop versus non-self-loop "
6566 " log probs [relative to acoustics]" );
67+ po.Register (" write-per-frame-acoustic-loglikes" , &per_frame_acwt_wspecifier,
68+ " Wspecifier for table of vectors containing the acoustic log-likelihoods "
69+ " per frame for each utterance. E.g. ark:foo/per_frame_logprobs.1.ark" );
6670 po.Register (" use-gpu" , &use_gpu,
6771 " yes|no|optional|wait, only has effect if compiled with CUDA" );
6872 po.Read (argc, argv);
@@ -75,7 +79,7 @@ int main(int argc, char *argv[]) {
7579#if HAVE_CUDA==1
7680 CuDevice::Instantiate ().SelectGpuId (use_gpu);
7781#endif
78-
82+
7983 std::string model_in_filename = po.GetArg (1 ),
8084 fst_rspecifier = po.GetArg (2 ),
8185 feature_rspecifier = po.GetArg (3 ),
@@ -100,6 +104,7 @@ int main(int argc, char *argv[]) {
100104 RandomAccessBaseFloatCuMatrixReader feature_reader (feature_rspecifier);
101105 Int32VectorWriter alignment_writer (alignment_wspecifier);
102106 BaseFloatWriter scores_writer (scores_wspecifier);
107+ BaseFloatVectorWriter per_frame_acwt_writer (per_frame_acwt_wspecifier);
103108
104109 for (; !fst_reader.Done (); fst_reader.Next ()) {
105110 std::string utt = fst_reader.Key ();
@@ -135,7 +140,7 @@ int main(int argc, char *argv[]) {
135140 acoustic_scale, &decode_fst, &nnet_decodable,
136141 &alignment_writer, &scores_writer,
137142 &num_done, &num_err, &num_retry,
138- &tot_like, &frame_count);
143+ &tot_like, &frame_count, &per_frame_acwt_writer );
139144 }
140145 KALDI_LOG << " Overall log-likelihood per frame is " << (tot_like/frame_count)
141146 << " over " << frame_count<< " frames." ;
@@ -152,5 +157,3 @@ int main(int argc, char *argv[]) {
152157 return -1 ;
153158 }
154159}
155-
156-
0 commit comments