Downloads · 30 days
4.7K
46% of all-time downloads
waveletdeboshir/whisper-base-ser-dusha
whisper-base-ser-dusha is a audio classification model from waveletdeboshir. Use it for the audio classification task on the model card, and read the license before you ship it in a product. It is set up for transformers.
Whisper-base encoder with classification head for speech emotion recognition.
Downloads · 30 days
4.7K
46% of all-time downloads
All-time downloads
10.3K
Public
Parameters
20.7M
82.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors82.9 MB · 100%
From the Hugging Face model README
Whisper-base encoder with classification head for speech emotion recognition.
Dusha dataset: https://github.com/salute-developers/golos/tree/master/dusha
Multiclass classification into 5 classes:
Model was fine-tuned on full Dusha-crowd with
import torch
import torchaudio
from transformers import WhisperForAudioClassification, WhisperFeatureExtractor
# load model and feature extractor
model = WhisperForAudioClassification.from_pretrained("waveletdeboshir/whisper-base-ser-dusha")
model.eval()
feature_extractor = WhisperFeatureExtractor.from_pretrained("waveletdeboshir/whisper-base-ser-dusha")
# load audio and resample if necessary
wav, sr = torchaudio.load("audio.wav")
if sr != 16000:
wav = torchaudio.functional.resample(wav, sr, 16000)
# compute predictions
features = feature_extractor(wav[0], sampling_rate=16000, return_tensors="pt").input_features
with torch.no_grad():
preds = model(features)
# get emotion and its probability
probs = torch.nn.functional.softmax(preds.logits, dim=-1)
print(f"Predicted emotion: {model.config.id2label[probs.argmax().item()]} with probability {probs.max().item():.4f}")