Update README.md
Browse files
README.md
CHANGED
@@ -34,29 +34,31 @@ The original model can be found under https://github.com/microsoft/unilm/tree/ma
|
|
34 |
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
|
35 |
[X-Vectors: Robust DNN Embeddings for Speaker Recognition](https://www.danielpovey.com/files/2018_icassp_xvectors.pdf)
|
36 |
# Usage
|
37 |
-
## Speaker
|
38 |
-
```
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
model =
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
```
|
61 |
|
62 |
# License
|
|
|
34 |
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
|
35 |
[X-Vectors: Robust DNN Embeddings for Speaker Recognition](https://www.danielpovey.com/files/2018_icassp_xvectors.pdf)
|
36 |
# Usage
|
37 |
+
## Speaker Embeddings
|
38 |
+
```javascript
|
39 |
+
import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers';
|
40 |
+
|
41 |
+
const processor = await AutoProcessor.from_pretrained('D4ve-R/wavlm-base-plus-sv');
|
42 |
+
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav';
|
43 |
+
const audio = await read_audio(url, 16000);
|
44 |
+
const inputs = await processor(audio);
|
45 |
+
|
46 |
+
const model = await AutoModel.from_pretrained('D4ve-R/wavlm-base-plus-sv', {quantized: false});
|
47 |
+
const embeddings = await model(inputs);
|
48 |
+
// {
|
49 |
+
// embeddings: Tensor {
|
50 |
+
// dims: [ 1, 512 ],
|
51 |
+
// type: 'float32',
|
52 |
+
// data: Float32Array(512) [-0.349443256855011, -0.39341306686401367, 0.022836603224277496, ...],
|
53 |
+
// size: 512
|
54 |
+
// },
|
55 |
+
// logits: Tensor {
|
56 |
+
// dims: [ 1, 512 ],
|
57 |
+
// type: 'float32',
|
58 |
+
// data: Float32Array(512) [-0.349443256855011, -0.39341306686401367, 0.022836603224277496, ...],
|
59 |
+
// size: 512
|
60 |
+
// }
|
61 |
+
// }
|
62 |
```
|
63 |
|
64 |
# License
|