|
|
--- |
|
|
license: mit |
|
|
--- |
|
|
This is an `UTMOS` model traced into a jit for simple use. The model and the inference code are from this [space](https://huggingface.co/spaces/sarulab-speech/UTMOS-demo). |
|
|
|
|
|
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/utmos", |
|
|
filename="utmos.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() |
|
|
mos = utmos_model(x).item() |
|
|
print(mos) |
|
|
``` |