Views
No views yet
1git clone https://github.com/ryota-komatsu/speaker_disentangled_hubert.git
2cd speaker_disentangled_hubert
3
4sudo apt install git-lfs # for UTMOS
5
6conda create -y -n py310 -c pytorch -c nvidia -c conda-forge python=3.10.19 pip=24.0 faiss-gpu=1.12.0
7conda activate py310
8pip install -r requirements/requirements.txt
9
10sh scripts/setup.sh1import re
2
3import torch
4import torchaudio
5from transformers import AutoModelForCausalLM, AutoTokenizer
6
7from src.flow_matching import FlowMatchingWithBigVGan
8from src.s5hubert.models.sylreg import SylRegForSyllableDiscovery
9
10wav_path = "/path/to/wav"
11
12# download pretrained models from hugging face hub
13encoder = SylRegForSyllableDiscovery.from_pretrained("ryota-komatsu/SylReg-Distill", device_map="cuda")
14decoder = FlowMatchingWithBigVGan.from_pretrained("ryota-komatsu/SylReg-Decoder-Base", device_map="cuda")
15
16# load a waveform
17waveform, sr = torchaudio.load(wav_path)
18waveform = torchaudio.functional.resample(waveform, sr, 16000)
19
20# encode a waveform into syllabic units
21outputs = encoder(waveform.to(encoder.device))
22units = outputs[0]["units"] # [3950, 67, ..., 503]
23
24# unit-to-speech synthesis
25generated_speech = decoder(units.unsqueeze(0)).waveform.cpu()| License | Provider | |
|---|---|---|
| LibriTTS-R | CC BY 4.0 | Y. Koizumi et al. |