Update README.md
Browse files
README.md
CHANGED
@@ -34,17 +34,18 @@ The model is fine-tuned on the [VoxCeleb1 dataset](https://www.robots.ox.ac.uk/~
|
|
34 |
# Usage
|
35 |
## Speaker Verification
|
36 |
```python
|
37 |
-
from transformers import Wav2Vec2FeatureExtractor,
|
38 |
from datasets import load_dataset
|
39 |
import torch
|
40 |
|
41 |
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
|
42 |
|
43 |
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
|
44 |
-
model =
|
45 |
|
46 |
# audio files are decoded on the fly
|
47 |
-
|
|
|
48 |
embeddings = model(**inputs).embeddings
|
49 |
embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()
|
50 |
|
|
|
34 |
# Usage
|
35 |
## Speaker Verification
|
36 |
```python
|
37 |
+
from transformers import Wav2Vec2FeatureExtractor, WavLMForXVector
|
38 |
from datasets import load_dataset
|
39 |
import torch
|
40 |
|
41 |
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
|
42 |
|
43 |
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
|
44 |
+
model = WavLMForXVector.from_pretrained('microsoft/wavlm-base-plus-sv')
|
45 |
|
46 |
# audio files are decoded on the fly
|
47 |
+
audio = [x["array"] for x in dataset[:2]["audio"]]
|
48 |
+
inputs = feature_extractor(audio, padding=True, return_tensors="pt")
|
49 |
embeddings = model(**inputs).embeddings
|
50 |
embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()
|
51 |
|