這是我們的ICASSP 2024紙張語音流的官方實現。

該倉庫在Linux上的Python 3.9上進行了測試。您可以使用Conda設置環境
# Install required packages
conda create -n vflow python==3.9 # or any name you like
conda activate vflow
pip install -r requirements.txt
# Then, set PATH
source path.sh # change the env name in it if you don't use "vflow"
# Install monotonic_align for MAS
cd model/monotonic_align
python setup.py build_ext --inplace請注意,為了避免安裝Torchdyn的麻煩,我們直接在torchdyn/在此處本地複制Torchdyn 1.0.6版本。
以下過程也可能需要在您的環境中進行bash和perl命令。
此存儲庫依賴於Kaldi風格的數據組織。所有數據說明文件均應在data/中的子目錄中放置。有關基本示例,請參見data/ljspeech/example 。在此示例中,需要以下純文本文件:
wav.scp :組織為utt /path/to/wav 。utts.list :每行都指定了話語。這可以通過cut -d ' ' -f 1 wav.scp > utts.list獲得。utt2spk :組織為utt spk_name 。text和phn_duration :指定音素序列和相應的整數持續時間(以框架為單位)。此外,還有一個data/ljspeech/phones.txt文件,用於指定所有手機及其詞典中的索引。對於LJSpeech,我們在線提供處理的文件。您可以下載並解壓縮到data/ljspeech/{train,val} 。如果您想在自己的數據集上訓練,則可能必須自己創建這些文件(或更改數據加載策略)。
在擁有這些清單文件後,請執行以下操作以提取MEL-SPECTROGRAM進行培訓:
bash extract_fbank.sh --stage 0 --stop_stage 2 --nj 16
# nj: number of parallel jobs.
# Have a look into the script if you need to change something
# Bash variables before "parse_options.sh" can be passed by CLI, e.g. "--key value".請注意,我們默認在此處使用16KHz數據。這將創建feats/fbank和feats/normed_fbank ,其中Kaldi風格的SCP和ARK文件存儲MEL-SPECTROGRAM數據。規範功能將用於培訓。
如果您想使用揚聲器-IDS(例如ljspeech,而不是使用預位的揚聲器嵌入者(例如XVECTORS)進行培訓,請運行:
make_utt2spk_id.py data/ljspeech/train/utt2spk data/ljspeech/val/utt2spk
# You can add more files in CLI. Will write utt2num_frames in the same directory to these files. 培訓的配置存儲在configs/中。這些YAML文件中將指定用於培訓和驗證集的數據表現和功能。如果您需要對自己的數據進行訓練,則需要在此更改雙引用的文件路徑。
然後,培訓由
python train.py -c configs/ ${your_yaml} -m ${model_name}
# e.g. python train.py -c configs/lj_16k_gt_dur.yaml -m lj_16k_gt_dur它將創建logs/${model_name}用於記錄和檢查點。
幾個註釋:
use_gt_dur設置為false以打開MAS算法。在這種情況下,最好將add_blank設置為true 。 在一定程度上訓練模型後,它可以準備好進行流動整流過程。流糾正需要使用訓練有素的模型生成數據,並使用(噪聲,數據)對再次訓練模型。由於此過程應始終涉及整個培訓數據集,因此建議在多個GPU上運行以進行並行解碼。我們提供了一個腳本來執行此操作:
# Set CUDA_VISIBLE_DEVICES, or the program will use all available GPUs.
python generate_for_reflow.py -c configs/ ${your_yaml} -m ${model_name}
--EMA --max-utt-num 100000000
--dataset train
--solver euler -t 10
--gt-dur
# --EMA specifies to load EMA checkpoint (latest)
# --max-utt-num sets the number of utterances to decode (in this case, arbitrarily high)
# --solver euler -t 10 specifies the solver and timesteps. Could be adaptive solvers like dopri5.
# --gt-dur forces the model to use ground truth duration for decoding.這將創建synthetic_wav/${model_name}/generate_for_reflow/train用於存儲。 noise.scp和feats.scp將存儲。解碼訓練集後,您還可以通過--dataset val設置驗證驗證。
然後,在新lj_16k_gt_dur_reflow.yaml yaml中指定這些feats.scp noise.scp路徑。
perform_reflow : true
...
data :
train :
feats_scp : " synthetic_wav/lj_16k_gt_dur/train/feats.scp "
noise_scp : " synthetic_wav/lj_16k_gt_dur/train/noise.scp "
...現在,它可以在反流中再次培訓,並在培訓中使用相同的腳本,但新的YAML配置文件。可以隨意將經過訓練的模型複製到新的日誌DIR進行恢復。同樣,可以在反流數據上更改模型結構並從頭開始訓練。
類似於“為反流生成數據”,模型推斷可以通過
python inference_dataset.py -c configs/ ${your_yaml} -m ${model_name} --EMA
--solver euler -t 10這將合成配置中驗證設置的MEL-SPECTROGRAM,並將其存儲在synthetic_wav/${model_name}/tts_gt_spk/feats.scp中。可以指定揚聲器,速度和溫度;請參閱tools.get_hparams_decode()函數以獲取完整的選項集。
然後可以在hifigan/ Directory中進行推理。請參閱那裡的讀書文件。
在開發過程中,提到以下存儲庫:
utils/中的大多數實用程序腳本。該存儲庫還包含一些實驗功能。
語音轉換。由於Glowtts可以通過歸一化流的解開屬性執行語音轉換,因此流量匹配也可以執行它是合理的。方法model.tts.GradTTS.voice_conversion進行了初步嘗試。
可能性估計。基於微分方程的生成模型具有通過瞬時變化公式來估計數據可能性的能力
實際上,積分被總和取代,而差異被技能 - hutchinson痕量估計器取代。請參閱《歌曲》中的附錄D.2。有關理論細節。我在model.tts.GradTTS.compute_likelihood中實現了此功能。
model.cfm.OTCFM中嘗試了此操作,儘管目前DOE的效果不佳。GradLogPEstimator2d配置指定估算器model.fm_net_type目前,還支持DIFFSINGER的估算儀體系結構。您可以添加更多,例如在Matcha-TTS中引入的。model.tts.GradTTS.forward現在支持對齊地圖的Beta二項式先驗;而且,如果需要,可以將變量MAS_target更改為其他東西,例如流量轉換的噪聲!如果有幫助,請隨時引用這項工作嗎?
@INPROCEEDINGS{guo2024voiceflow,
author={Guo, Yiwei and Du, Chenpeng and Ma, Ziyang and Chen, Xie and Yu, Kai},
booktitle={ICASSP 2024 - 2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
title={{VoiceFlow}: Efficient Text-To-Speech with Rectified Flow Matching},
year={2024},
volume={},
number={},
pages={11121-11125},
keywords={Signal processing algorithms;Signal processing;Acoustics;Mathematical models;Vectors;Trajectory;Speech processing;Text-to-speech;flow matching;rectified flow;efficiency;speed-quality tradeoff},
doi={10.1109/ICASSP48485.2024.10445948}
}