Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
This is an [ECAPA model](https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb) traced into a jit for simple use.
|
5 |
+
|
6 |
+
Usage:
|
7 |
+
|
8 |
+
```python
|
9 |
+
from huggingface_hub import hf_hub_download
|
10 |
+
import torch
|
11 |
+
import soundfile as sf
|
12 |
+
|
13 |
+
# Download the model from repo
|
14 |
+
model_path = hf_hub_download(
|
15 |
+
repo_id="balacoon/ecapa",
|
16 |
+
filename="ecapa.jit",
|
17 |
+
repo_type="model",
|
18 |
+
local_dir="./",
|
19 |
+
)
|
20 |
+
|
21 |
+
# load model
|
22 |
+
utmos_model = torch.jit.load(model_path).to(torch.device("cuda"))
|
23 |
+
# load audio
|
24 |
+
wav, sr = sf.read(
|
25 |
+
"rms_arctic_a0001.wav",
|
26 |
+
dtype="int16"
|
27 |
+
)
|
28 |
+
assert sr == 16000
|
29 |
+
# run inference
|
30 |
+
x = torch.tensor(wav).unsqueeze(0).cuda()
|
31 |
+
x_len = torch.tensor([x.shape[1]], device=x.device)
|
32 |
+
emb = utmos_model(x, x_len)
|
33 |
+
```
|