/ Модель

Характеристики

Параметры
905 млн
Лицензия
Apache 2.0
Архитектура
whisper · dense
Базовая модель
whisper-large-v3
Библиотека
transformers
Опубликована
21 сен 2024

speech-emotion-recognition-with-openai-whisper-large-v3

Классификация аудиоАудио → label3 профессии

Дообученная на базе Whisper large-v3 модель классифицирует эмоции в аудиозаписях по семи категориям.

1 729скачиваний за 30 дней127лайковвеса обновлены1 ноя 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Модель firdhokk/speech-emotion-recognition-with-openai-whisper-large-v3 разработана на основе Whisper large-v3 от OpenAI и дообучена для классификации эмоций в аудиозаписях. Это плотная модель архитектуры Whisper с примерно 905,2 млн параметров, предназначенная для распознавания эмоциональной окраски речи.

Модель принимает аудио и относит запись к одной из семи категорий: гнев, отвращение, страх, радость, нейтральное состояние, грусть или удивление. Для подготовки аудио README описывает загрузку через Librosa и обработку Whisper Feature Extractor. В обучении использовались датасеты RAVDESS, SAVEE, TESS и URDU; спокойная эмоция была исключена из обучения из-за малого числа примеров. В README приведены метрики оценки, включая точность 0,9199, однако результаты на других данных и переносимость между языками и условиями записи не описаны.

Репозиторий использует библиотеку Transformers и формат safetensors. Лицензия — Apache-2.0. Модель подходит для экспериментов и приложений, которым требуется классифицировать эмоции по речи; её оценки не следует считать надёжным измерением эмоционального состояния человека.

Сценарии применения

  • классификация эмоциональной окраски речи
  • анализ эмоций в голосовых сообщениях
  • разметка аудиозаписей по эмоциональным категориям
  • анализ эмоциональных реакций в речевых датасетах

Ограничения

Спокойная эмоция исключена из обучения из-за недостатка примеров; качество на языках, голосах и условиях записи вне использованных датасетов не описано. Предсказанные категории не являются надёжным измерением эмоционального состояния человека.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

🎧 Speech Emotion Recognition with Whisper

This project leverages the Whisper model to recognize emotions in speech. The goal is to classify audio recordings into different emotional categories, such as Happy, Sad, Surprised, and etc.

🗂 Dataset

The dataset used for training and evaluation is sourced from multiple datasets, including:

The dataset contains recordings labeled with various emotions. Below is the distribution of the emotions in the dataset:

EmotionCount
sad752
happy752
angry752
neutral716
disgust652
fearful652
surprised652
calm192

This distribution reflects the balance of emotions in the dataset, with some emotions having more samples than others. Excluded the "calm" emotion during training due to its underrepresentation.

🎤 Preprocessing

  • Audio Loading: Using Librosa to load the audio files and convert them to numpy arrays.
  • Feature Extraction: The audio data is processed using the Whisper Feature Extractor, which standardizes and normalizes the audio features for input to the model.

🔧 Model

The model used is the Whisper Large V3 model, fine-tuned for audio classification tasks:

  • Model: openai/whisper-large-v3
  • Output: Emotion labels (Angry', 'Disgust', 'Fearful', 'Happy', 'Neutral', 'Sad', 'Surprised')

I map the emotion labels to numeric IDs and use them for model training and evaluation.

⚙️ Training

The model is trained with the following parameters:

  • Learning Rate: 5e-05
  • Train Batch Size: 2
  • Eval Batch Size: 2
  • Random Seed: 42
  • Gradient Accumulation Steps: 5
  • Total Train Batch Size: 10 (effective batch size after gradient accumulation)
  • Optimizer: Adam with parameters: betas=(0.9, 0.999) and epsilon=1e-08
  • Learning Rate Scheduler: linear
  • Warmup Ratio for LR Scheduler: 0.1
  • Number of Epochs: 25
  • Mixed Precision Training: Native AMP (Automatic Mixed Precision)

These parameters ensure efficient model training and stability, especially when dealing with large datasets and deep models like Whisper. The training utilizes Wandb for experiment tracking and monitoring.

📊 Metrics

The following evaluation metrics were obtained after training the model:

  • Loss: 0.5008
  • Accuracy: 0.9199
  • Precision: 0.9230
  • Recall: 0.9199
  • F1 Score: 0.9198

These metrics demonstrate the model's performance on the speech emotion recognition task. The high values for accuracy, precision, recall, and F1 score indicate that the model is effectively identifying emotional states from speech data.

🧪 Results

After training, the model is evaluated on the test dataset, and the results are monitored using Wandb in this Link.

Training LossEpochStepValidation LossAccuracyPrecisionRecallF1
0.49480.99953940.49110.82860.84490.82860.8302
0.62711.99907880.53070.82250.85590.82250.8277
0.23642.998511820.50760.86920.87270.86920.8684
0.01563.998015760.56690.87320.88680.87320.8745
0.23055.019710.45780.91080.91420.91080.9114
0.01125.999523650.47010.91080.91590.91080.9114
0.00136.999027590.52320.91380.92040.91380.9137
0.18947.998531530.50080.91990.92300.91990.9198
0.08778.998035470.55170.91380.91520.91380.9138
0.147110.039420.58560.88950.90020.88950.8915
0.002610.999543360.83340.87730.89490.87730.8770

🚀 How to Use

# Requires: librosa
from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
import librosa
import torch
import numpy as np

model_id = "firdhokk/speech-emotion-recognition-with-openai-whisper-large-v3"
model = AutoModelForAudioClassification.from_pretrained(model_id)

feature_extractor = AutoFeatureExtractor.from_pretrained(model_id, do_normalize=True)
id2label = model.config.id2label
def preprocess_audio(audio_path, feature_extractor, max_duration=30.0):
    audio_array, sampling_rate = librosa.load(audio_path, sr=None)
    
    max_length = int(feature_extractor.sampling_rate * max_duration)
    if len(audio_array) > max_length:
        audio_array = audio_array[:max_length]
    else:
        audio_array = np.pad(audio_array, (0, max_length - len(audio_array)))

    inputs = feature_extractor(
        audio_array,
        sampling_rate=feature_extractor.sampling_rate,
        max_length=max_length,
        truncation=True,
        return_tensors="pt",
    )
    return inputs
def predict_emotion(audio_path, model, feature_extractor, id2label, max_duration=30.0):
    inputs = preprocess_audio(audio_path, feature_extractor, max_duration)
    
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model = model.to(device)
    inputs = {key: value.to(device) for key, value in inputs.items()}

    with torch.no_grad():
        outputs = model(**inputs)

    logits = outputs.logits
    predicted_id = torch.argmax(logits, dim=-1).item()
    predicted_label = id2label[predicted_id]
    
    return predicted_label
audio_path = "/content/drive/MyDrive/Audio/Speech_URDU/Happy/SM5_F4_H058.wav"

predicted_emotion = predict_emotion(audio_path, model, feature_extractor, id2label)
print(f"Predicted Emotion: {predicted_emotion}")

🎯 Framework versions

  • Transformers 4.44.2
  • Pytorch 2.4.1+cu121
  • Datasets 3.0.0
  • Tokenizers 0.19.1

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · audio-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
WhisperForAudioClassification
Ревизия весов
15fd074

0 моделей