Update README.md
Browse files
README.md
CHANGED
|
@@ -27,28 +27,27 @@ Or with Conda:
|
|
| 27 |
conda install -c conda-forge huggingface_hub
|
| 28 |
```
|
| 29 |
|
| 30 |
-
Now you can download the model by executing the following code:
|
| 31 |
-
|
| 32 |
-
```
|
| 33 |
-
from huggingface_hub import hf_hub_download
|
| 34 |
-
|
| 35 |
-
model_file = hf_hub_download(repo_id='Jenthe/ECAPA2', filename='model.pt')
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
Subsequent calls will load the previously downloaded model automatically.
|
| 39 |
-
|
| 40 |
### Speaker Embedding Extraction
|
| 41 |
|
| 42 |
Extracting speaker embeddings is easy and only requires a few lines of code:
|
|
|
|
| 43 |
```
|
| 44 |
import torch
|
| 45 |
import torchaudio
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
audio = torchaudio.load('sample.wav')
|
| 48 |
model = torch.jit.load(model_file, map_location='cpu')
|
| 49 |
embedding = model.extract_embedding(audio)
|
| 50 |
```
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
### Hierarchical Feature Extraction
|
| 53 |
|
| 54 |
For the extraction of other hierachical features, a separate model function is provided:
|
|
|
|
| 27 |
conda install -c conda-forge huggingface_hub
|
| 28 |
```
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
### Speaker Embedding Extraction
|
| 31 |
|
| 32 |
Extracting speaker embeddings is easy and only requires a few lines of code:
|
| 33 |
+
|
| 34 |
```
|
| 35 |
import torch
|
| 36 |
import torchaudio
|
| 37 |
+
from huggingface_hub import hf_hub_download
|
| 38 |
+
|
| 39 |
+
model_file = hf_hub_download(repo_id='Jenthe/ECAPA2', filename='model.pt')
|
| 40 |
+
model = torch.jit.load(model_file, map_location='cpu')
|
| 41 |
|
| 42 |
+
audio, sr = torchaudio.load('sample.wav')
|
| 43 |
model = torch.jit.load(model_file, map_location='cpu')
|
| 44 |
embedding = model.extract_embedding(audio)
|
| 45 |
```
|
| 46 |
|
| 47 |
+
Subsequent calls will load the previously downloaded model automatically.
|
| 48 |
+
|
| 49 |
+
Note: input audio should have a sample rate of 16 kHz.
|
| 50 |
+
|
| 51 |
### Hierarchical Feature Extraction
|
| 52 |
|
| 53 |
For the extraction of other hierachical features, a separate model function is provided:
|