FastEmit<T>
Models & Types · AiDotNet.SpeechRecognition.Streaming
FastEmit (Yu et al. 2021): a streaming Conformer transducer trained with sequence-level emission regularization.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → FastEmit<T>
Implements: ISpeechRecognizer<T>
For Beginners
FastEmit turns 16 kHz audio into an 80-band log-mel spectrogram, shortens it 4x with two convolutions, and encodes it with Conformer blocks, each mixing self-attention (long-range context) with a convolution (local patterns). A small LSTM remembers the words written so far and a joint network combines it with each audio frame to pick the next token or “nothing yet”.
How It Works
The model is the paper’s streaming Conformer-T on LibriSpeech: Conformer (M) (16 blocks, width 256, 4 heads, kernel 32) whose blocks see no future frames (left-context attention and causal convolution, section 3.3), a single-layer LSTM prediction network (section 3.2) and a 1,024 word-piece vocabulary. Training adds FastEmit’s regularization with lambda = 0.004, the value the paper sets for Conformer (section 4.1): label emissions’ gradients are scaled by 1 + lambda, which pushes the model to emit earlier. SpecAugment masks the features in training (section 3.1). The RNN-T decoder (Graves 2012) trains with the transducer loss and decodes greedily, at most ten labels per frame. The paper’s blocks use relative
positional encoding; these use rotary position encoding, the relative scheme
ConformerBlockLayer provides.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.SpeechRecognition,
inputSize: 16000, outputSize: 34);
var model = new FastEmit<float>(architecture);
var text = model.Transcribe(waveform).Text;
Constructors
| Constructor | Summary |
|---|---|
FastEmit(NeuralNetworkArchitecture<T> architecture, FastEmitOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
FastEmit(NeuralNetworkArchitecture<T> architecture, string modelPath, FastEmitOptions options) |
Properties
| Property | Summary |
|---|---|
IReadOnlyList<string> SupportedLanguages { get; } |
|
bool SupportsStreaming { get; } |
|
bool SupportsWordTimestamps { get; } |
Methods
| Method | Summary |
|---|---|
IReadOnlyDictionary<string, T> DetectLanguageProbabilities(Tensor<T> audio) |
|
IStreamingTranscriptionSession<T> StartStreamingSession(string language) |
|
ModelMetadata<T> GetModelMetadata() |
|
Task<TranscriptionResult<T>> TranscribeAsync(Tensor<T> audio, string language, bool? includeTimestamps, CancellationToken cancellationToken) |
|
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
TranscriptionResult<T> Transcribe(Tensor<T> audio, string language, bool? includeTimestamps) |
Transcribes audio: the encoder and the transducer with greedy decoding. |
string DetectLanguage(Tensor<T> audio) |