Views
No views yet
1git clone https://github.com/ryota-komatsu/speaker_disentangled_hubert.git
2cd speaker_disentangled_hubert
3sudo apt install git-lfs # for UTMOS
4conda create -y -n py310 -c pytorch -c nvidia -c conda-forge python=3.10.18 pip=24.0 faiss-gpu=1.11.0
5conda activate py310
6pip install -r requirements/requirements.txt
7sh scripts/setup.sh1import torchaudio
2from src.flow_matching import FlowMatchingWithBigVGan
3from src.s5hubert import S5HubertForSyllableDiscovery
4wav_path = "/path/to/wav"
5# download pretrained models from hugging face hub
6encoder = S5HubertForSyllableDiscovery.from_pretrained("ryota-komatsu/s5-hubert", device_map="cuda")
7decoder = FlowMatchingWithBigVGan.from_pretrained("ryota-komatsu/s5-hubert-decoder", device_map="cuda")
8# load a waveform
9waveform, sr = torchaudio.load(wav_path)
10waveform = torchaudio.functional.resample(waveform, sr, 16000)
11# encode a waveform into syllabic units
12outputs = encoder(waveform.to(encoder.device))
13# syllabic units
14units = outputs[0]["units"] # [3950, 67, ..., 503]
15units = units.unsqueeze(0)
16# unit-to-speech synthesis
17audio_values = decoder(units)