NemotronSpeech<T>

Models & Types · AiDotNet.SpeechRecognition.NeMo

Nemotron Speech Streaming: NVIDIA’s cache-aware Fast Conformer (Noroozi et al. 2024) with an RNN-T decoder.

Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → NemotronSpeech<T>

Implements: ISpeechRecognizer<T>

For Beginners

Nemotron Speech transcribes English as it is spoken. Its encoder never looks further ahead than a fixed lookahead: the subsampling convolutions and each block’s convolution see only the past, and each frame’s attention covers its own chunk and a fixed window of chunks before it. A transducer decoder then writes tokens frame by frame, so the transcript can grow while audio is still arriving.

How It Works

The defaults are the released nvidia/nemotron-speech-streaming-en-0.6b (its model_config.yaml): 128 log-mel bands without normalization, 8x causal depthwise-separable subsampling of 256 channels to 80 ms frames, 24 Conformer blocks of width 1,024 (8 heads, feed-forward 4,096, a causal kernel-9 convolution), chunked-limited attention with 70 frames of left context and a 13-frame lookahead (a 14-frame chunk, 1.12 s), and an RNN-T decoder of a two-layer 640-unit LSTM prediction network and a 640-wide joint network over a 1,024-piece SentencePiece vocabulary. SpecAugment masks two frequency bands of up to 27 bins and ten time spans of 5%. Training uses AdamW (betas 0.9 and 0.98, weight decay 1e-3) under the Noam schedule with factor 3.0 at width 1,024 and 8,000 warm-up steps. The release’s blocks use relative positional encoding; these use rotary position encoding, the relative scheme ConformerBlockLayer provides. The release’s blank is its last id; here it is 0, and piece p is id p + 1.

Example

var architecture = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.SpeechRecognition,
    inputSize: 16000, outputSize: 1025);
var model = new NemotronSpeech<float>(architecture);
var text = model.Transcribe(waveform).Text;

Constructors

Constructor Summary
NemotronSpeech(NeuralNetworkArchitecture<T> architecture, NemotronSpeechOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
NemotronSpeech(NeuralNetworkArchitecture<T> architecture, string modelPath, NemotronSpeechOptions options)

Properties

Property Summary
IReadOnlyList<string> SupportedLanguages { get; }
SentencePieceModel Tokenizer { get; } The release’s SentencePiece tokenizer (1,024 pieces; output id p + 1 is piece p).
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)