Views
No views yet
microsoft/wavlm-base-plus backbone, this model achieves competitive performance while training only ~838K parameters (0.88% of the total model). This lightweight approach drastically reduces compute requirements without sacrificing accuracy, making it ideal for resource-constrained environments.microsoft/wavlm-base-plusProlongation, Repetition, Block, Interjection, Fluent)Block class (silent pauses/blocks), which is a known challenge in audio-only disfluency detection. It is trained on the SEP-28k dataset (mostly English podcasts) and may not generalize perfectly to other languages or studio-quality clean audio without background noise.1import torch
2from peft import PeftModel
3from transformers import AutoConfig, WavLMForSequenceClassification
4import torchaudio
5
6# 1. Configuration
7base_model_id = "microsoft/wavlm-base-plus"
8peft_model_id = "stuttering-detection-wavlm-lora"
9num_classes = 5
10
11# 2. Load Base Model
12config = AutoConfig.from_pretrained(base_model_id, num_labels=num_classes)
13base_model = WavLMForSequenceClassification.from_pretrained(base_model_id, config=config, ignore_mismatched_sizes=True)
14
15# 3. Apply LoRA Weights
16model = PeftModel.from_pretrained(base_model, peft_model_id)
17model.eval()
18
19# 4. Inference (Example)
20waveform, sample_rate = torchaudio.load("path_to_audio.wav")
21inputs = processor(waveform, sampling_rate=sample_rate, return_tensors="pt")
22with torch.no_grad():
23 logits = model(**inputs).logits
24 predictions = torch.argmax(logits, dim=-1)
25print(f"Predicted Class ID: {predictions.item()}")