WavLMASR<T>
Models & Types · AiDotNet.SpeechRecognition.Foundation
WavLM ASR: speech pre-training with denoising and attention
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → WavLMASR<T>
Implements: ISpeechRecognizer<T>
For Beginners
WavLM extends HuBERT with: (1) gated relative position bias in self-attention for better sequence modeling; (2) denoising pre-training using overlapping utterances to learn robust representations in noisy conditions. The model is pre-trained on 94…
How It Works
References:
- Paper: “WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing” (Chen et al., Microsoft, 2022)
WavLM extends HuBERT with: (1) gated relative position bias in self-attention for better sequence modeling; (2) denoising pre-training using overlapping utterances to learn robust representations in noisy conditions. The model is pre-trained on 94k hours of speech data. WavLM achieves state-of-the-art on the SUPERB benchmark across ASR, speaker verification, separation, and other tasks.
Example
// Create a WavLM ASR model for denoising-augmented speech pre-training
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.SpeechRecognition,
inputHeight: 16000, inputWidth: 1, inputDepth: 1, outputSize: 5000);
var model = new WavLMASR<double>(architecture);
// Or load a pre-trained ONNX model for robust speech recognition
var onnxModel = new WavLMASR<double>(architecture, "wavlmasr.onnx");
Constructors
| Constructor | Summary |
|---|---|
WavLMASR(NeuralNetworkArchitecture<T> architecture, WavLMASROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
WavLMASR(NeuralNetworkArchitecture<T> architecture, string modelPath, WavLMASROptions 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 using WavLM’s denoised SSL encoder with CTC decoding. |
string DetectLanguage(Tensor<T> audio) |
|
void LoadTorchWeights(Func<string, int[], double[]> read, Func<string, bool> has) |
Loads a transformers WavLMForCTC state dict straight from source. |