UTMOS v2

The official UTMOS v2 fusion_stage3 fold-0 model, adapted to use with only torch, torchaudio, and transformers.

import soundfile as sf
import torch
from transformers import AutoModel

device = "cuda" if torch.cuda.is_available() else "cpu"
wav, sr = sf.read("audio.wav", dtype="float32")
wav = torch.from_numpy(wav)
model = AutoModel.from_pretrained(
    "prj-beatrice/utmosv2-torch-native", trust_remote_code=True
).eval().to(device)

with torch.inference_mode():
    score = model(wav.to(device), sampling_rate=sr).scores[0]
print(score)

This is the corresponding code from the official README:

import utmosv2

reference_model = utmosv2.create_model(pretrained=True)
reference = reference_model.predict(data=wav.unsqueeze(0), sr=sr)[0]
print(reference)

Results may differ because this port uses a different random-number generator for crop sampling and Beta mixup.

Padded batches use a waveform tensor [batch_size, max_length] and an input_lengths tensor [batch_size]. data_domain (default "sarulab") selects the dataset calibration. Pass remove_silent_section=False to disable UTMOS v2's silence-removal option.

License

UTMOS v2 and the wrapper are MIT-licensed; Wav2Vec2 and EfficientNetV2-S components are Apache-2.0. See LICENSE.

Downloads last month
21
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support