GoogleSpeechV2Options

Options & Configuration · AiDotNet.SpeechRecognition.ProprietaryAPI

Options for Google Speech-to-Text V2, built as Google USM-CTC: a BEST-RQ pre-trained Conformer with a CTC layer.

Inheritance: ModelOptions → GoogleSpeechV2Options

For Beginners

These options set the size of Google Speech-to-Text V2’s Conformer encoder, how it learns from unlabeled speech, and how far its attention reaches.

How It Works

The defaults are the paper’s Conformer-2B (Zhang et al. 2023, Table 2: 32 layers, 1536 wide, 16 heads, kernel 5) over 128-bin log-mel features (section 2.7), with BEST-RQ pre-training under a 16-codebook multi-softmax loss and 8-second chunk-wise attention (section 2.4). EncoderDim 1024, NumEncoderLayers 24 and NumAttentionHeads 8 give Conformer-0.6.

Constructors

Constructor Summary
GoogleSpeechV2Options() Initializes a new instance with default values.
GoogleSpeechV2Options(GoogleSpeechV2Options other) Initializes a new instance by copying from another instance.

Properties

Property Summary
OnnxModelOptions OnnxOptions { get; set; } ONNX runtime options.
double LogMelFloor { get; set; } Floor added to the mel energies before the logarithm.
double MaskNoiseStd { get; set; } Standard deviation of the zero-mean normal noise that replaces masked frames (BEST-RQ’s default: 0.1).
double MaskProbability { get; set; } Probability that each input frame starts a masked span (BEST-RQ’s default: 0.01).
double RopeTheta { get; set; } Rotary base of the attention’s relative position encoding, which stands in for the paper’s relative attention (section 2.1).
int AttentionChunkSeconds { get; set; } Chunk-wise attention window in seconds (section 2.4: an 8-second chunk was best); zero attends over the whole input.
int CodeDim { get; set; } Codebook entry dimension, the height of each projection matrix (BEST-RQ’s default: 16).
int CodebookSize { get; set; } Entries per random-projection codebook, which is also each pre-training softmax’s width (BEST-RQ’s default, which section 2.7 follows: 8192).
int ConvKernel { get; set; } Depthwise convolution kernel (Table 2: 5).
int EncoderDim { get; set; } Conformer width (Table 2, Conformer-2B: 1536; Conformer-0.6: 1024).
int FeedForwardMultiplier { get; set; } Feed-forward expansion of each half-step feed-forward module (Gulati et al.
int HopLength { get; set; } Frame stride in samples (10 ms, BEST-RQ’s, which the 4x reduction turns into 40 ms encoder frames).
int MaskLength { get; set; } Masked span length in input frames (BEST-RQ’s default: 400 ms, 40 frames at the 10 ms stride).
int MaxAudioLengthSeconds { get; set; } Longest audio a transcription covers, in seconds; longer input is truncated.
int MaxTextLength { get; set; } Most tokens a transcription decodes.
int NumAttentionHeads { get; set; } Attention heads per block (Table 2, Conformer-2B: 16; Conformer-0.6: 8).
int NumCodebooks { get; set; } Codebooks of the multi-softmax loss, each with its own quantizer and softmax layer (sections 2.2.1 and 2.7: 16).
int NumEncoderLayers { get; set; } Conformer blocks (Table 2, Conformer-2B: 32; Conformer-0.6: 24).
int NumMels { get; set; } Log-mel bins (section 2.7: 128-dimensional log-mel filterbank coefficients).
int SampleRate { get; set; } Audio sample rate in Hz (section 2.7: audio is resampled to 16 kHz).
int StackedFrames { get; set; } Input frames stacked per quantized label, matching the encoder’s 4x reduction (BEST-RQ’s default: 4).
int VocabSize { get; set; } CTC vocabulary size, blank (token 0) included; tokens above 0 decode as Unicode code points.
int WindowLength { get; set; } Analysis window in samples (25 ms at 16 kHz; the paper does not state it).
string Language { get; set; } Language reported for transcriptions.
string ModelPath { get; set; } Path to an exported ONNX model, when one is used.