anton-l HF staff commited on
Commit
fe74f01
1 Parent(s): 74979b4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ datasets:
5
+ tags:
6
+ - speech
7
+ ---
8
+
9
+ # WavLM-Base-Plus
10
+
11
+ [Microsoft's WavLM](https://github.com/microsoft/unilm/tree/master/wavlm)
12
+
13
+ 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.
14
+
15
+ **Note**: This model does not have a tokenizer as it was pretrained on audio alone. In order to use this model **speech recognition**, a tokenizer should be created and the model should be fine-tuned on labeled text data. Check out [this blog](https://huggingface.co/blog/fine-tune-wav2vec2-english) for more in-detail explanation of how to fine-tune the model.
16
+
17
+ The model was pre-trained on:
18
+
19
+ - 60,000 hours of [Libri-Light](https://arxiv.org/abs/1912.07875)
20
+ - 10,000 hours of [GigaSpeech](https://arxiv.org/abs/2106.06909)
21
+ - 24,000 hours of [VoxPopuli](https://arxiv.org/abs/2101.00390)
22
+
23
+ [Paper: WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900)
24
+
25
+ Authors: Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei
26
+
27
+ **Abstract**
28
+ *Self-supervised learning (SSL) achieves great success in speech recognition, while limited exploration has been attempted for other speech processing tasks. As speech signal contains multi-faceted information including speaker identity, paralinguistics, spoken content, etc., learning universal representations for all speech tasks is challenging. In this paper, we propose a new pre-trained model, WavLM, to solve full-stack downstream speech tasks. WavLM is built based on the HuBERT framework, with an emphasis on both spoken content modeling and speaker identity preservation. We first equip the Transformer structure with gated relative position bias to improve its capability on recognition tasks. For better speaker discrimination, we propose an utterance mixing training strategy, where additional overlapped utterances are created unsupervisely and incorporated during model training. Lastly, we scale up the training dataset from 60k hours to 94k hours. WavLM Large achieves state-of-the-art performance on the SUPERB benchmark, and brings significant improvements for various speech processing tasks on their representative benchmarks.*
29
+
30
+ The original model can be found under https://github.com/microsoft/unilm/tree/master/wavlm.
31
+
32
+ # Fine-tuning details
33
+ The model is fine-tuned on the [VoxCeleb1 dataset](https://www.robots.ox.ac.uk/~vgg/data/voxceleb/vox1.html) using an X-Vector head with an Additive Margin Softmax loss
34
+ [X-Vectors: Robust DNN Embeddings for Speaker Recognition](https://www.danielpovey.com/files/2018_icassp_xvectors.pdf)
35
+ # Usage
36
+ ## Speaker Verification
37
+ ```python
38
+ from transformers import Wav2Vec2FeatureExtractor, UniSpeechSatForXVector
39
+ from datasets import load_dataset
40
+ import torch
41
+
42
+ dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
43
+
44
+ feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
45
+ model = UniSpeechSatForXVector.from_pretrained('microsoft/wavlm-base-plus-sv')
46
+
47
+ # audio files are decoded on the fly
48
+ inputs = feature_extractor(dataset[:2]["audio"]["array"], return_tensors="pt")
49
+ embeddings = model(**inputs).embeddings
50
+ embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()
51
+
52
+ # the resulting embeddings can be used for cosine similarity-based retrieval
53
+ cosine_sim = torch.nn.CosineSimilarity(dim=-1)
54
+ similarity = cosine_sim(embeddings[0], embeddings[1])
55
+ threshold = 0.86 # the optimal threshold is dataset-dependent
56
+ if similarity < threshold:
57
+ print("Speakers are not the same!")
58
+ ```
59
+
60
+ # License
61
+
62
+ The official license can be found [here](https://github.com/microsoft/UniSpeech/blob/main/LICENSE)
63
+
64
+ ![design](https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/wavlm.png)