hubert large speech emotion recognition russian dusha finetuned
Overview
Highlights
- Fine-tuned HuBERT Large for high-accuracy Russian emotion detection
- Direct audio-to-emotion classification without needing text transcripts
- Optimized for sentiment analysis in Russian voice interfaces
- Apache-2.0 license ensures flexible commercial integration
- Specialized in capturing nuanced Russian linguistic prosody
Usage
# Install Hugging Face transformers
pip install transformers torch
# Load model with transformers
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned")
tokenizer = AutoTokenizer.from_pretrained("xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned")
Hugging Face Download
We recommend downloading the model via the Hugging Face CLI or Hub SDK.
Guidance:Before downloading, install huggingface_hub with:
pip install -U huggingface_hub
CLI Download
Download the full repository
huggingface-cli download xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned
Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned config.json --local-dir ./dir
See the official docs for more CLI options
SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned')
Git Download
Make sure git-lfs is installed first
git lfs install
git clone https://huggingface.co/xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned
To skip LFS large-file downloads, use:
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned
Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.
PyTorch / Transformers Usage
Install Transformers
pip install -U transformers torch
Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned')
tokenizer = AutoTokenizer.from_pretrained('xbgoose/hubert-large-speech-emotion-recognition-russian-dusha-finetuned')
Full Documentation
---
language:
- ru
tags:
- SER
- speech
- audio
- russian
license: apache-2.0
pipeline_tag: audio-classification
base_model: facebook/hubert-large-ls960-ft
datasets:
- xbgoose/dusha
---
HuBERT fine-tuned on DUSHA dataset for speech emotion recognition in russian language
The pre-trained model is this one - facebook/hubert-large-ls960-ft
The DUSHA dataset used can be found here
Fine-tuning
Fine-tuned in Google Colab using Pro account with A100 GPU
Freezed all layers exept projector, classifier and all 24 HubertEncoderLayerStableLayerNorm layers
Used half of the train dataset
Training parameters
- 2 epochs
- train batch size = 8
- eval batch size = 8
- gradient accumulation steps = 4
- learning rate = 5e-5 without warm up and decay
Metrics
Achieved
- accuracy = 0.86
- balanced = 0.76
- macro f1 score = 0.81
on test set, improving accucary and f1 score compared to dataset baseline
Usage
from transformers import HubertForSequenceClassification, Wav2Vec2FeatureExtractor
import torchaudio
import torch
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("facebook/hubert-large-ls960-ft")
model = HubertForSequenceClassification.from_pretrained("xbgoose/hubert-speech-emotion-recognition-russian-dusha-finetuned")
num2emotion = {0: 'neutral', 1: 'angry', 2: 'positive', 3: 'sad', 4: 'other'}
filepath = "path/to/audio.wav"
waveform, sample_rate = torchaudio.load(filepath, normalize=True)
transform = torchaudio.transforms.Resample(sample_rate, 16000)
waveform = transform(waveform)
inputs = feature_extractor(
waveform,
sampling_rate=feature_extractor.sampling_rate,
return_tensors="pt",
padding=True,
max_length=16000 * 10,
truncation=True
)
logits = model(inputs['input_values'][0]).logits
predictions = torch.argmax(logits, dim=-1)
predicted_emotion = num2emotion[predictions.numpy()[0]]
print(predicted_emotion)