ConformerCTC<T>
Models & Types · AiDotNet.SpeechRecognition.ConformerFamily
Conformer-CTC: the Conformer encoder (Gulati et al. 2020) with a CTC layer in place of the transducer.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → ConformerCTC<T>
Implements: ISpeechRecognizer<T>
For Beginners
Conformer-CTC 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 linear layer gives every frame a probability for each token; collapsing repeats and blanks gives the transcript.
How It Works
The defaults are NVIDIA NeMo’s Conformer-CTC Large: 18 blocks, width 512, 8 heads and a 31-wide depthwise kernel over 80 mel bins with 4x convolution subsampling; a linear CTC layer replaces the paper’s RNN-T decoder. SpecAugment masks the features in training (section 3.1). The CTC layer trains with the CTC loss (Graves et al. 2006) and decodes greedily. 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 ConformerCTC<float>(architecture);
var text = model.Transcribe(waveform).Text;
Constructors
| Constructor | Summary |
|---|---|
ConformerCTC(NeuralNetworkArchitecture<T> architecture, ConformerCTCOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
ConformerCTC(NeuralNetworkArchitecture<T> architecture, string modelPath, ConformerCTCOptions 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 CTC layer with greedy decoding. |
string DetectLanguage(Tensor<T> audio) |