Update README.md
Browse files
README.md
CHANGED
|
@@ -36,18 +36,15 @@ 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:
|
|
|
|
| 36 |
import torchaudio
|
| 37 |
from huggingface_hub import hf_hub_download
|
| 38 |
|
| 39 |
+
# automatically checks for cached file
|
| 40 |
model_file = hf_hub_download(repo_id='Jenthe/ECAPA2', filename='model.pt')
|
| 41 |
model = torch.jit.load(model_file, map_location='cpu')
|
| 42 |
|
| 43 |
+
# input audio should have a sample rate of 16 kHz
|
| 44 |
audio, sr = torchaudio.load('sample.wav')
|
|
|
|
| 45 |
embedding = model.extract_embedding(audio)
|
| 46 |
```
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
### Hierarchical Feature Extraction
|
| 49 |
|
| 50 |
For the extraction of other hierachical features, a separate model function is provided:
|