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