LatticeIncrementalDecoderConfig Struct Reference

The normal decoder, lattice-faster-decoder.h, sometimes has an issue when doing real-time applications with long utterances, that each time you get the lattice the lattice determinization can take a considerable amount of time; this introduces latency. More...

#include <lattice-incremental-decoder.h>

Collaboration diagram for LatticeIncrementalDecoderConfig:

Public Member Functions

 LatticeIncrementalDecoderConfig ()
 
void Register (OptionsItf *opts)
 
void Check () const
 

Public Attributes

BaseFloat beam
 
int32 max_active
 
int32 min_active
 
BaseFloat lattice_beam
 
int32 prune_interval
 
BaseFloat beam_delta
 
BaseFloat hash_ratio
 
BaseFloat prune_scale
 
fst::DeterminizeLatticePhonePrunedOptions det_opts
 
int32 determinize_max_delay
 
int32 determinize_min_chunk_size
 

Detailed Description

The normal decoder, lattice-faster-decoder.h, sometimes has an issue when doing real-time applications with long utterances, that each time you get the lattice the lattice determinization can take a considerable amount of time; this introduces latency.

This version of the decoder spreads the work of lattice determinization out throughout the decoding process.

NOTE:

Please see https://www.danielpovey.com/files/ *TBD* .pdf for a technical explanation of what is going on here.

GLOSSARY OF TERMS: chunk: We do the determinization on chunks of frames; these may coincide with the chunks on which the user calls AdvanceDecoding(). The basic idea is to extract chunks of the raw lattice and determinize them individually, but it gets much more complicated than that. The chunks should normally be at least as long as a word (let's say, at least 20 frames), or the overhead of this algorithm might become excessive and affect RTF.

raw lattice chunk: A chunk of raw (i.e. undeterminized) lattice that we will determinize. In the paper this corresponds to the FST B that is described in Section 5.2.

token_label, state_label / token-label, state-label:

In the paper these are both referred to as `state labels` (these are special, large integer id's that refer to states in the undeterminized lattice and in the the determinized lattice); but we use two separate terms here, for more clarity, when referring to the undeterminized vs. determinized lattice.

token_label conceptually refers to states in the raw lattice, but we don't materialize the entire raw lattice as a physical FST and and these tokens are actually tokens (template type Token) held by the decoder

state_label when used in this code refers specifically to labels that identify states in the determinized lattice (i.e. state indexes in lat_).

token-final state A state in a raw lattice or in a determinized chunk that has an arc entering it that has a `token-label` on it (as defined above). These states will have nonzero final-probs.

redeterminized-non-splice-state, aka ns_redet: A redeterminized state which is not also a splice state; refer to the paper for explanation. In the already-determinized part this means a redeterminized state which is not final.

canonical appended lattice: This is the appended compact lattice that we conceptually have (i.e. what we described in the paper). The difference from the "actual appended lattice" stored in LatticeIncrementalDeterminizer::clat_ is that the actual appended lattice has all its final-arcs replaced with final-probs, and we keep the real final-arcs "on the side" in a separate data structure. The final-probs in clat_ aren't necessarily related to the costs on the final-arcs; instead they can have arbitrary values passed in by the user (e.g. if we want to include final-probs). This means that the clat_ can be returned without modification to the user who wants a partially determinized result.

final-arc: An arc in the canonical appended CompactLattice which goes to a final-state. These arcs will have `state-labels` as their labels.

Definition at line 106 of file lattice-incremental-decoder.h.

Constructor & Destructor Documentation

◆ LatticeIncrementalDecoderConfig()

Definition at line 133 of file lattice-incremental-decoder.h.

References DeterminizeLatticePhonePrunedOptions::minimize.

134  : beam(16.0),
135  max_active(std::numeric_limits<int32>::max()),
136  min_active(200),
137  lattice_beam(10.0),
138  prune_interval(25),
139  beam_delta(0.5),
140  hash_ratio(2.0),
141  prune_scale(0.01),
144  det_opts.minimize = false;
145  }
fst::DeterminizeLatticePhonePrunedOptions det_opts

Member Function Documentation

◆ Check()

void Check ( ) const
inline

Definition at line 173 of file lattice-incremental-decoder.h.

References KALDI_ERR, DeterminizeLatticePhonePrunedOptions::minimize, and DeterminizeLatticePhonePrunedOptions::word_determinize.

Referenced by LatticeIncrementalDecoderTpl< FST, decoder::BackpointerToken >::LatticeIncrementalDecoderTpl().

173  {
174  if (!(beam > 0.0 && max_active > 1 && lattice_beam > 0.0 &&
175  min_active <= max_active && prune_interval > 0 &&
176  beam_delta > 0.0 && hash_ratio >= 1.0 &&
177  prune_scale > 0.0 && prune_scale < 1.0 &&
180  KALDI_ERR << "Invalid options given to decoder";
181  /* Minimization of the chunks is not compatible withour algorithm (or at
182  least, would require additional complexity to implement.) */
184  KALDI_ERR << "Invalid determinization options given to decoder.";
185  }
fst::DeterminizeLatticePhonePrunedOptions det_opts
#define KALDI_ERR
Definition: kaldi-error.h:147

◆ Register()

void Register ( OptionsItf opts)
inline

Definition at line 146 of file lattice-incremental-decoder.h.

References OptionsItf::Register(), and DeterminizeLatticePhonePrunedOptions::Register().

Referenced by main().

146  {
147  det_opts.Register(opts);
148  opts->Register("beam", &beam, "Decoding beam. Larger->slower, more accurate.");
149  opts->Register("max-active", &max_active,
150  "Decoder max active states. Larger->slower; "
151  "more accurate");
152  opts->Register("min-active", &min_active, "Decoder minimum #active states.");
153  opts->Register("lattice-beam", &lattice_beam,
154  "Lattice generation beam. Larger->slower, "
155  "and deeper lattices");
156  opts->Register("prune-interval", &prune_interval,
157  "Interval (in frames) at "
158  "which to prune tokens");
159  opts->Register("beam-delta", &beam_delta,
160  "Increment used in decoding-- this "
161  "parameter is obscure and relates to a speedup in the way the "
162  "max-active constraint is applied. Larger is more accurate.");
163  opts->Register("hash-ratio", &hash_ratio,
164  "Setting used in decoder to "
165  "control hash behavior");
166  opts->Register("determinize-max-delay", &determinize_max_delay,
167  "Maximum frames of delay between decoding a frame and "
168  "determinizing it");
169  opts->Register("determinize-min-chunk-size", &determinize_min_chunk_size,
170  "Minimum chunk size used in determinization");
171 
172  }
fst::DeterminizeLatticePhonePrunedOptions det_opts

Member Data Documentation

◆ beam

BaseFloat beam

Definition at line 109 of file lattice-incremental-decoder.h.

◆ beam_delta

BaseFloat beam_delta

Definition at line 114 of file lattice-incremental-decoder.h.

◆ det_opts

◆ determinize_max_delay

int32 determinize_max_delay

Definition at line 129 of file lattice-incremental-decoder.h.

◆ determinize_min_chunk_size

int32 determinize_min_chunk_size

Definition at line 130 of file lattice-incremental-decoder.h.

◆ hash_ratio

BaseFloat hash_ratio

Definition at line 115 of file lattice-incremental-decoder.h.

◆ lattice_beam

BaseFloat lattice_beam

Definition at line 112 of file lattice-incremental-decoder.h.

◆ max_active

int32 max_active

Definition at line 110 of file lattice-incremental-decoder.h.

◆ min_active

int32 min_active

Definition at line 111 of file lattice-incremental-decoder.h.

◆ prune_interval

int32 prune_interval

Definition at line 113 of file lattice-incremental-decoder.h.

◆ prune_scale

BaseFloat prune_scale

Definition at line 116 of file lattice-incremental-decoder.h.


The documentation for this struct was generated from the following file: