SPIRALOptions
Options & Configuration · AiDotNet.SpeechRecognition.Foundation
Options for SPIRAL: self-supervised perturbation-invariant pre-training of a convolution-Transformer speech encoder, with a convolutional CTC classifier.
Inheritance: ModelOptions → SPIRALOptions
For Beginners
These options set the size of SPIRAL’s encoder, how its student is perturbed, and how its teacher follows the student during pre-training.
How It Works
The defaults are the BASE model of Huang et al. 2022 (Table 1, section 4.2). For LARGE set FirstBlockLayers 4, FirstBlockLayerDrop 0.05, EncoderDim 1024, NumEncoderLayers 20, NumAttentionHeads 16, FeedForwardDim 4096, ProjectionDim 512, PredictorChannels 512, TeacherMomentumStart 0.990, TeacherMomentumEnd 0.999 and PretrainingSteps 500000.
Constructors
| Constructor | Summary |
|---|---|
SPIRALOptions() |
Initializes a new instance with default values. |
SPIRALOptions(SPIRALOptions other) |
Initializes a new instance by copying from another instance. |
Properties
| Property | Summary |
|---|---|
OnnxModelOptions OnnxOptions { get; set; } |
ONNX runtime options. |
double DropoutRate { get; set; } |
Dropout in the convolutions and Transformers, for the student and the teacher alike (section 3.2; 0.1 in the released configuration). |
double FirstBlockLayerDrop { get; set; } |
LayerDrop in the first block (Table 1: BASE 0, LARGE 0.05). |
double FrequencyMaskProbability { get; set; } |
Proportion of mel bins that start a frequency mask, filled with zeros (section 4.2: 0.02). |
double LayerDrop { get; set; } |
LayerDrop in the second block (Table 1: 0.05). |
double LogMelFloor { get; set; } |
Floor added to the mel energies before the logarithm. |
double TeacherMomentumEnd { get; set; } |
Final teacher moving-average rate α, reached by a cosine schedule (section 4.2: BASE 1.0, LARGE 0.999). |
double TeacherMomentumStart { get; set; } |
Initial teacher moving-average rate α (section 4.2: BASE 0.995, LARGE 0.990). |
double Temperature { get; set; } |
Contrastive temperature κ of Equation 2 (0.3 in the released configuration; the paper does not state it). |
double TimeMaskProbability { get; set; } |
Proportion of time steps that start a SpecAugment time mask, filled with the fixed Gaussian mask embedding (section 4.2: 0.025). |
int ClassifierChannels { get; set; } |
Channels of the fine-tuning classifier’s two kernel-5 convolutions (section 3.5: 512). |
int EncoderDim { get; set; } |
Width of the second block, the encoder output (Table 1: BASE 768, LARGE 1024); its down-sampling convolution has twice this many channels. |
int FeedForwardDim { get; set; } |
Feed-forward width in the second block (Table 1: BASE 3072, LARGE 4096). |
int FirstBlockDim { get; set; } |
Width of the first block’s Transformer and its closing convolutions (Table 1: 512 for BASE and LARGE). |
int FirstBlockFeedForwardDim { get; set; } |
Feed-forward width in the first block (Table 1: 2048). |
int FirstBlockHeads { get; set; } |
Attention heads in the first block (Table 1: 8). |
int FirstBlockLayers { get; set; } |
Transformer layers in the first block (Table 1: BASE 2, LARGE 4). |
int FrequencyMaskLength { get; set; } |
Width of each frequency mask in bins (section 4.2: 20). |
int HopLength { get; set; } |
Frame stride in samples (section 4.2: 10 ms). |
int MaxAudioLengthSeconds { get; set; } |
Longest audio a transcription covers, in seconds; longer input is truncated. |
int MaxTeacherPaddingUnits { get; set; } |
Most padding added at each end of the teacher’s input for position randomization, in units of the encoder’s total stride (16 in the released configuration), drawn uniformly at each end whatever the utterance’s length, as the reference’s Ran… |
int MaxTextLength { get; set; } |
Most tokens a transcription decodes. |
int Negatives { get; set; } |
Distractors per position in the in-utterance contrastive loss (100 in the released configuration; the paper does not state it). |
int NumAttentionHeads { get; set; } |
Attention heads in the second block (Table 1: BASE 12, LARGE 16). |
int NumEncoderLayers { get; set; } |
Transformer layers in the second block (Table 1: BASE 10, LARGE 20). |
int NumMels { get; set; } |
Log-mel bins (section 4.2: 128-dimensional log-mel filterbank). |
int PredictorChannels { get; set; } |
Channels of the predictor’s two convolutions (Table 1: BASE 256, LARGE 512). |
int PretrainingSteps { get; set; } |
Pre-training updates the teacher’s momentum schedule spans (section 4.2: BASE 200k, LARGE 500k). |
int ProjectionDim { get; set; } |
Projection head output width (Table 1: BASE 256, LARGE 512). |
int SampleRate { get; set; } |
Audio sample rate in Hz. |
int TimeMaskLength { get; set; } |
Length of each time mask in frames (section 4.2: 20). |
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 (section 4.2: 20 ms). |
string Language { get; set; } |
Language reported for transcriptions. |
string ModelPath { get; set; } |
Path to an exported ONNX model, when one is used. |