🚀 用于说话人识别的Hubert-Large
本项目提供用于说话人识别的Hubert-Large模型,可基于语音音频准确识别说话人身份,在相关任务中表现出色。
🚀 快速开始
本模型基于预训练的hubert-large-ll60k
,在16kHz采样的语音音频上进行训练。使用时,请确保输入的语音也采样为16kHz。
✨ 主要特性
📦 安装指南
文档未提及具体安装步骤,可参考相关依赖库的官方文档进行安装,如datasets
、transformers
、torch
、librosa
等。
💻 使用示例
基础用法
你可以通过音频分类管道使用该模型:
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()]
📚 详细文档
任务和数据集描述
说话人识别(SI)将每个语音片段的说话人身份作为多分类问题进行分类,训练和测试使用相同的预定义说话人集合。本项目采用了广泛使用的VoxCeleb1数据集。
评估结果
评估指标为准确率。
|
s3prl |
transformers |
test |
0.9033 |
0.9035 |
BibTeX引用和引用信息
@article{yang2021superb,
title={SUPERB: Speech processing Universal PERformance Benchmark},
author={Yang, Shu-wen and Chi, Po-Han and Chuang, Yung-Sung and Lai, Cheng-I Jeff and Lakhotia, Kushal and Lin, Yist Y and Liu, Andy T and Shi, Jiatong and Chang, Xuankai and Lin, Guan-Ting and others},
journal={arXiv preprint arXiv:2105.01051},
year={2021}
}
📄 许可证
本项目采用Apache-2.0许可证。