hubert / README.md
ryota-komatsu's picture
Update README.md
97569c6 verified
metadata
library_name: transformers
license: mit
language:
  - en
base_model:
  - facebook/hubert-base-ls960

Hubert-Base

Model Details

Model Description

  • Model type: Hubert-Base
  • Language(s) (NLP): English
  • License: MIT

How to Get Started with the Model

Use the code below to get started with the model.

sudo apt install git-lfs  # for UTMOS

conda create -y -n py310 -c pytorch -c nvidia -c conda-forge python=3.10.18 pip=24.0 faiss-gpu=1.12.0
conda activate py310
pip install -r requirements/requirements.txt

sh scripts/setup.sh
import torchaudio

from src.s5hubert import S5HubertForSyllableDiscovery

wav_path = "/path/to/wav"

# download pretrained models from hugging face hub
encoder = S5HubertForSyllableDiscovery.from_pretrained("ryota-komatsu/hubert", device_map="cuda")

# load a waveform
waveform, sr = torchaudio.load(wav_path)
waveform = torchaudio.functional.resample(waveform, sr, 16000)

# encode a waveform into syllabic units
outputs = encoder(waveform.to(encoder.device))
units = outputs[0]["units"]  # [3950, 67, ..., 503]