SarvamASR<T>
Models & Types · AiDotNet.SpeechRecognition.ProprietaryAPI
A Sarvam speech-to-text stand-in: a Conformer encoder with a CTC layer over Unicode characters of the Indic scripts, since Sarvam has not disclosed Saarika’s architecture.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → SarvamASR<T>
Implements: ISpeechRecognizer<T>
For Beginners
This model turns 16 kHz audio into an 80-band log-mel spectrogram, shortens it 4x with two convolutions and encodes it with Conformer blocks. A linear layer gives every frame a probability for each character of the Latin and Indic scripts; collapsing repeats and blanks gives the transcript.
How It Works
This is a stand-in, not Sarvam’s production model. Sarvam has not published Saarika’s architecture; for Saaras V4 it has said only that an audio encoder feeds a temporal-downsampling adapter and an in-house 3B language model. The stand-in is the encoder side of that design as a self-contained recognizer: a Conformer encoder (Gulati et al. 2020) of 18 blocks, width 512, 8 heads and a 31-wide kernel, and a CTC layer (Graves et al. 2006) whose token ids are Unicode code points from 1 through U+0D7F, covering Latin and the Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada and Malayalam blocks of Sarvam’s eleven languages; token 0 is the blank. The adapter and language model are not modelled. The paper’s blocks use relative positional encoding; these use rotary position encoding.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.SpeechRecognition,
inputSize: 16000, outputSize: 34);
var model = new SarvamASR<float>(architecture);
var text = model.Transcribe(waveform).Text;
Constructors
| Constructor | Summary |
|---|---|
SarvamASR(NeuralNetworkArchitecture<T> architecture, SarvamASROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
SarvamASR(NeuralNetworkArchitecture<T> architecture, string modelPath, SarvamASROptions 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) |