Instructions to use prj-beatrice/utmosv2-torch-native with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prj-beatrice/utmosv2-torch-native with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("audio-classification", model="prj-beatrice/utmosv2-torch-native", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("prj-beatrice/utmosv2-torch-native", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
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