language: zh
datasets:
- superb
tags:
- 语音
- 音频
- hubert
- 音频分类
license: apache-2.0
widget:
- example_title: VoxCeleb 说话人 id10003
src: https://cdn-media.huggingface.co/speech_samples/VoxCeleb1_00003.wav
- example_title: VoxCeleb 说话人 id10004
src: https://cdn-media.huggingface.co/speech_samples/VoxCeleb_00004.wav
用于说话人识别的Hubert-Large模型
模型描述
这是S3PRL的Hubert模型在SUPERB说话人识别任务上的移植版本。
基础模型为hubert-large-ll60k,该模型基于16kHz采样的语音音频进行预训练。使用时请确保输入语音同样以16kHz采样。
更多信息请参考SUPERB:语音处理通用性能基准
任务与数据集描述
说话人识别(SI)将每段语音按其说话人身份进行多分类,训练集和测试集的说话人集合相同。采用广泛使用的VoxCeleb1数据集。
原始模型的训练和评估说明请参阅S3PRL下游任务README。
使用示例
可通过音频分类管道使用模型:
from datasets import load_dataset
from transformers import pipeline
dataset = load_dataset("anton-l/superb_demo", "si", split="test")
classifier = pipeline("audio-classification", model="superb/hubert-large-superb-sid")
labels = classifier(dataset[0]["file"], top_k=5)
或直接使用模型:
import torch
import librosa
from datasets import load_dataset
from transformers import HubertForSequenceClassification, Wav2Vec2FeatureExtractor
def map_to_array(example):
speech, _ = librosa.load(example["file"], sr=16000, mono=True)
example["speech"] = speech
return example
dataset = load_dataset("anton-l/superb_demo", "si", split="test")
dataset = dataset.map(map_to_array)
model = HubertForSequenceClassification.from_pretrained("superb/hubert-large-superb-sid")
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("superb/hubert-large-superb-sid")
inputs = feature_extractor(dataset[:2]["speech"], sampling_rate=16000, padding=True, return_tensors="pt")
logits = model(**inputs).logits
predicted_ids = torch.argmax(logits, dim=-1)
labels = [model.config.id2label[_id] for _id in predicted_ids.tolist()]
评估结果
评估指标为准确率。
|
s3prl |
transformers |
测试集 |
0.9033 |
0.9035 |
BibTeX条目及引用信息
@article{yang2021superb,
title={SUPERB:语音处理通用性能基准},
author={杨书文、纪柏涵、庄永松、赖正一等},
journal={arXiv预印本 arXiv:2105.01051},
year={2021}
}