🚀 用於說話人識別的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許可證。