これは公式のコード実装ですか?抹茶TTS [ICASSP 2024]。
提案しますか?条件フローマッチング(整流フローと同様)を使用してオードベースの音声合成を高速化する非自動性神経TTSへの新しいアプローチである抹茶TTS。私たちの方法:
詳細については、デモページをご覧ください。ICASSP2024ペーパーをご覧ください。
事前に訓練されたモデルは、CLIまたはグレードインターフェイスで自動的にダウンロードされます。
あなたも試すことができますか? HuggingfaceのブラウザのMatcha-TT?スペース。
conda create -n matcha-tts python=3.10 -y
conda activate matcha-tts
pip install matcha-ttsソースから
pip install git+https://github.com/shivammehta25/Matcha-TTS.git
cd Matcha-TTS
pip install -e . # This will download the required models
matcha-tts --text " <INPUT TEXT> "または
matcha-tts-appまたはJupyterノートブックのOpen synthesis.ipynb
matcha-tts --text " <INPUT TEXT> "matcha-tts --file < PATH TO FILE >matcha-tts --file < PATH TO FILE > --batched追加の引数
matcha-tts --text " <INPUT TEXT> " --speaking_rate 1.0matcha-tts --text " <INPUT TEXT> " --temperature 0.667matcha-tts --text " <INPUT TEXT> " --steps 10LJスピーチでトレーニングをしていると仮定しましょう
ここからデータセットをダウンロードし、 data/LJSpeech-1.1に抽出し、ファイルリストを準備して、nvidiaタコトロン2リポジトリのセットアップで項目5のような抽出されたデータを指すように準備します。
CLONEをクローンして、抹茶TTSリポジトリを入力します
git clone https://github.com/shivammehta25/Matcha-TTS.git
cd Matcha-TTSpip install -e .configs/data/ljspeech.yamlと変更に移動します train_filelist_path : data/filelists/ljs_audio_text_train_filelist.txt
valid_filelist_path : data/filelists/ljs_audio_text_val_filelist.txtmatcha-data-stats -i ljspeech.yaml
# Output:
#{ ' mel_mean ' : -5.53662231756592, ' mel_std ' : 2.1161014277038574}これらの値をconfigs/data/ljspeech.yaml data_statisticsキーで更新します。
data_statistics: # Computed for ljspeech dataset
mel_mean: -5.536622
mel_std: 2.116101電車の道と検証フィルリストに。
make train-ljspeechまたは
python matcha/train.py experiment=ljspeechpython matcha/train.py experiment=ljspeech_min_memorypython matcha/train.py experiment=ljspeech trainer.devices=[0,1]matcha-tts --text " <INPUT TEXT> " --checkpoint_path < PATH TO CHECKPOINT > ONNXエクスポートと推論サポートを実装してくれた @Mush42に感謝します。
抹茶チェックポイントをONNXにエクスポートし、エクスポートされたONNXグラフで推論を実行することができます。
チェックポイントをONNXにエクスポートするには、最初にONNXをでインストールします
pip install onnx次に、以下を実行します。
python3 -m matcha.onnx.export matcha.ckpt model.onnx --n-timesteps 5オプションで、ONNX輸出業者はVoCoder-NameおよびVocoder-Checkpointの引数を受け入れます。これにより、ボコーダーをエクスポートグラフに埋め込み、1回の実行(エンドツーエンドTTSシステムと同様)で波形を生成できます。
n_timesteps 、モデル入力ではなく、ハイパーパラメーターとして扱われることに注意してください。これは、輸出中に(推論中ではない)中に指定する必要があることを意味します。指定されていない場合、 n_timestepsは5に設定されています。
重要:今のところ、 scaled_product_attentionオペレーターは古いバージョンではエクスポートできないため、トーチ> = 2.1.0がエクスポートに必要です。最終バージョンがリリースされるまで、モデルをエクスポートしたい人は、トーチ> = 2.1.0を手動でインストールする必要があります。
エクスポートされたモデルに推論を実行するには、最初にonnxruntimeを使用してインストールします
pip install onnxruntime
pip install onnxruntime-gpu # for GPU inference次に、以下を使用します。
python3 -m matcha.onnx.infer model.onnx --text " hey " --output-dir ./outputs合成パラメーターを制御することもできます。
python3 -m matcha.onnx.infer model.onnx --text " hey " --output-dir ./outputs --temperature 0.4 --speaking_rate 0.9 --spk 0 GPUで推論を実行するには、 onnxruntime-gpuパッケージを必ずインストールしてから、 --gpu推論コマンドに渡してください。
python3 -m matcha.onnx.infer model.onnx --text " hey " --output-dir ./outputs --gpu抹茶のみをONNXにエクスポートした場合、これによりMel-Spectrogramはグラフとして出力ディレクトリにnumpyアレイとして記述されます。エクスポートされたグラフにボコーダーを埋め込んだ場合、これにより.wavオーディオファイルが出力ディレクトリに書き込みます。
抹茶のみをONNXにエクスポートし、完全なTTSパイプラインを実行する場合は、 ONNX形式でボコーダーモデルへのパスを渡すことができます。
python3 -m matcha.onnx.infer model.onnx --text " hey " --output-dir ./outputs --vocoder hifigan.small.onnxこれにより、 .wavオーディオファイルが出力ディレクトリに書き込みます。
データセットがとして構成されている場合
data/
└── LJSpeech-1.1
├── metadata.csv
├── README
├── test.txt
├── train.txt
├── val.txt
└── wavs次
python matcha/utils/get_durations_from_trained_model.py -i dataset_yaml -c < checkpoint >例:
python matcha/utils/get_durations_from_trained_model.py -i ljspeech.yaml -c matcha_ljspeech.ckptまたは単に:
matcha-tts-get-durations -i ljspeech.yaml -c matcha_ljspeech.ckptDataSetConfigでは、負荷期間をオンにします。例: ljspeech.yaml
load_durations: True
または、configs/experiment/ljspeech_from_durations.yamlの例を参照してください
私たちのコードを使用する場合、またはこの作業が役立つ場合は、私たちの論文を引用してください。
@inproceedings{mehta2024matcha,
title={Matcha-{TTS}: A fast {TTS} architecture with conditional flow matching},
author={Mehta, Shivam and Tu, Ruibo and Beskow, Jonas and Sz{'e}kely, {'E}va and Henter, Gustav Eje},
booktitle={Proc. ICASSP},
year={2024}
}
このコードはLightning-Hydra-Templateを使用しているため、それに付随するすべての力があります。
認めたい他のソースコード: