英文

UniSpeech-SAT-Large 用于说话人验证

Microsoft's UniSpeech

该模型是在16kHz采样的语音音频上进行预训练的,使用了语句和说话人对比损失。使用该模型时,请确保你的语音输入也是以16kHz采样的。

该模型的预训练数据如下:

Paper: UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING

作者:Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu

摘要:自监督学习(SSL)是语音处理中一个长期的目标,因为它利用大规模的无标签数据,避免了大量的人工标注。近年来,在语音识别中应用自监督学习取得了巨大的成功,但在建模说话人特征方面,尚未进行大量的探索。本文旨在改进现有的自监督学习框架,用于说话人表示学习。我们提出了两种方法来增强无监督说话人信息提取的效果。首先,我们在当前的SSL框架中应用了多任务学习,将语句级对比损失与SSL目标函数进行整合。其次,为了更好地区分说话人,我们提出了一种用于数据增强的语句混合策略,通过无监督创建额外的重叠语句,并在训练过程中进行组合。我们将这些方法整合到HuBERT框架中。在SUPERB基准测试上的实验结果表明,所提出的系统在通用表示学习方面取得了最先进的性能,特别适用于面向说话人识别的任务。我们进行了消融实验证明了每种提出方法的有效性。最后,我们扩大了训练数据集,使用了总计94,000小时的公共音频数据,并在所有SUPERB任务中进一步提升了性能。

原始模型可以在 https://github.com/microsoft/UniSpeech/tree/main/UniSpeech-SAT 下找到。

模型微调细节

该模型在 VoxCeleb1 dataset 上使用了带有加性边距Softmax损失的X-Vector头进行微调

X-Vectors: Robust DNN Embeddings for Speaker Recognition

使用方法

说话人验证

from transformers import Wav2Vec2FeatureExtractor, UniSpeechSatForXVector
from datasets import load_dataset
import torch

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")

feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/unispeech-sat-large-sv')
model = UniSpeechSatForXVector.from_pretrained('microsoft/unispeech-sat-large-sv')

# audio files are decoded on the fly
inputs = feature_extractor(dataset[:2]["audio"]["array"], return_tensors="pt")
embeddings = model(**inputs).embeddings
embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()

# the resulting embeddings can be used for cosine similarity-based retrieval
cosine_sim = torch.nn.CosineSimilarity(dim=-1)
similarity = cosine_sim(embeddings[0], embeddings[1])
threshold = 0.89  # the optimal threshold is dataset-dependent
if similarity < threshold:
    print("Speakers are not the same!")

许可证

官方许可证可以在 here 下找到