Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
datasets:
|
5 |
+
- librispeech_asr
|
6 |
+
tags:
|
7 |
+
- speech
|
8 |
+
---
|
9 |
+
|
10 |
+
# UniSpeech-SAT-Base for Speaker Diarization
|
11 |
+
|
12 |
+
[Microsoft's UniSpeech](https://www.microsoft.com/en-us/research/publication/unispeech-unified-speech-representation-learning-with-labeled-and-unlabeled-data/)
|
13 |
+
|
14 |
+
The model was pretrained on 16kHz sampled speech audio with utterance and speaker contrastive loss. When using the model, make sure that your speech input is also sampled at 16kHz.
|
15 |
+
|
16 |
+
The model was pre-trained on:
|
17 |
+
|
18 |
+
- 960 hours of [LibriSpeech](https://huggingface.co/datasets/librispeech_asr)
|
19 |
+
|
20 |
+
[Paper: UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER
|
21 |
+
AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752)
|
22 |
+
|
23 |
+
Authors: Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu
|
24 |
+
|
25 |
+
**Abstract**
|
26 |
+
*Self-supervised learning (SSL) is a long-standing goal for speech processing, since it utilizes large-scale unlabeled data and avoids extensive human labeling. Recent years witness great successes in applying self-supervised learning in speech recognition, while limited exploration was attempted in applying SSL for modeling speaker characteristics. In this paper, we aim to improve the existing SSL framework for speaker representation learning. Two methods are introduced for enhancing the unsupervised speaker information extraction. First, we apply the multi-task learning to the current SSL framework, where we integrate the utterance-wise contrastive loss with the SSL objective function. Second, for better speaker discrimination, we propose an utterance mixing strategy for data augmentation, where additional overlapped utterances are created unsupervisely and incorporate during training. We integrate the proposed methods into the HuBERT framework. Experiment results on SUPERB benchmark show that the proposed system achieves state-of-the-art performance in universal representation learning, especially for speaker identification oriented tasks. An ablation study is performed verifying the efficacy of each proposed method. Finally, we scale up training dataset to 94 thousand hours public audio data and achieve further performance improvement in all SUPERB tasks..*
|
27 |
+
|
28 |
+
The original model can be found under https://github.com/microsoft/UniSpeech/tree/main/UniSpeech-SAT.
|
29 |
+
|
30 |
+
# Fine-tuning details
|
31 |
+
|
32 |
+
The model is fine-tuned on the [LibriMix dataset](https://github.com/JorisCos/LibriMix) using just a linear layer for mapping the network outputs.
|
33 |
+
|
34 |
+
# Usage
|
35 |
+
|
36 |
+
## Speaker Diarization
|
37 |
+
|
38 |
+
```python
|
39 |
+
from transformers import Wav2Vec2FeatureExtractor, UniSpeechSatForAudioFrameClassification
|
40 |
+
from datasets import load_dataset
|
41 |
+
import torch
|
42 |
+
|
43 |
+
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
|
44 |
+
|
45 |
+
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/unispeech-sat-base-sd')
|
46 |
+
model = UniSpeechSatForAudioFrameClassification.from_pretrained('microsoft/unispeech-sat-base-sd')
|
47 |
+
|
48 |
+
# audio file is decoded on the fly
|
49 |
+
inputs = feature_extractor(dataset[0]["audio"]["array"], return_tensors="pt")
|
50 |
+
logits = model(**inputs).logits
|
51 |
+
probabilities = torch.sigmoid(logits[0])
|
52 |
+
# labels is a one-hot array of shape (num_frames, num_speakers)
|
53 |
+
labels = (probabilities > 0.5).long()
|
54 |
+
```
|
55 |
+
|
56 |
+
# License
|
57 |
+
|
58 |
+
The official license can be found [here](https://github.com/microsoft/UniSpeech/blob/main/LICENSE)
|
59 |
+
|
60 |
+
![design](https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/UniSpeechSAT.png)
|