diff --git a/TTS/bin/compute_statistics.py b/TTS/bin/compute_statistics.py index d87ecf95..b4ee6df7 100755 --- a/TTS/bin/compute_statistics.py +++ b/TTS/bin/compute_statistics.py @@ -12,7 +12,7 @@ from TTS.tts.datasets.preprocess import load_meta_data from TTS.utils.audio import AudioProcessor # from TTS.utils.io import load_config -from TTS.utils.config import load_config +from TTS.config import load_config def main(): diff --git a/tests/bash_tests/test_aligntts_train.sh b/tests/bash_tests/test_aligntts_train.sh deleted file mode 100755 index 38d46520..00000000 --- a/tests/bash_tests/test_aligntts_train.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -xe -BASEDIR=$(dirname "$0") -echo "$BASEDIR" -# run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_align_tts.py --config_path $BASEDIR/../inputs/test_align_tts.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_align_tts.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ diff --git a/tests/bash_tests/test_glow-tts_train.sh b/tests/bash_tests/test_glow-tts_train.sh deleted file mode 100755 index 04aef2ad..00000000 --- a/tests/bash_tests/test_glow-tts_train.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -xe -BASEDIR=$(dirname "$0") -echo "$BASEDIR" -# run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_glow_tts.py --config_path $BASEDIR/../inputs/test_glow_tts.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_glow_tts.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ diff --git a/tests/bash_tests/test_speedy_speech_train.sh b/tests/bash_tests/test_speedy_speech_train.sh deleted file mode 100755 index 2276034f..00000000 --- a/tests/bash_tests/test_speedy_speech_train.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -xe -BASEDIR=$(dirname "$0") -echo "$BASEDIR" -# run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_speedy_speech.py --config_path $BASEDIR/../inputs/test_speedy_speech.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_speedy_speech.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ diff --git a/tests/bash_tests/test_tacotron_train.sh b/tests/bash_tests/test_tacotron_train.sh deleted file mode 100755 index 4aacf69c..00000000 --- a/tests/bash_tests/test_tacotron_train.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -set -xe -BASEDIR=$(dirname "$0") -echo "$BASEDIR" - -# run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --config_path $BASEDIR/../inputs/test_tacotron_config.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ - -# run Tacotron bi-directional decoder -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --config_path $BASEDIR/../inputs/test_tacotron_bd_config.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ - -# Tacotron2 -# run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --config_path $BASEDIR/../inputs/test_tacotron2_config.json -# find the training folder -LATEST_FOLDER=$(ls $BASEDIR/../train_outputs/| sort | tail -1) -echo $LATEST_FOLDER -# continue the previous training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --continue_path $BASEDIR/../train_outputs/$LATEST_FOLDER -# remove all the outputs -rm -rf $BASEDIR/../train_outputs/ - diff --git a/tests/tts_tests/test_align_tts_train.py b/tests/tts_tests/test_align_tts_train.py new file mode 100644 index 00000000..aefc7dc3 --- /dev/null +++ b/tests/tts_tests/test_align_tts_train.py @@ -0,0 +1,48 @@ +import glob +import os +import shutil + +from tests import get_tests_output_path, run_cli +from TTS.tts.configs import AlignTTSConfig + +config_path = os.path.join(get_tests_output_path(), "test_model_config.json") +output_path = os.path.join(get_tests_output_path(), "train_outputs") + + +config = AlignTTSConfig( + batch_size=8, + eval_batch_size=8, + num_loader_workers=0, + num_val_loader_workers=0, + text_cleaner="english_cleaners", + use_phonemes=True, + phoneme_language="en-us", + phoneme_cache_path=os.path.join(get_tests_output_path(), "train_outputs/phoneme_cache/"), + run_eval=True, + test_delay_epochs=-1, + epochs=1, + print_step=1, + print_eval=True, +) +config.audio.do_trim_silence = True +config.audio.trim_db = 60 +config.save_json(config_path) + +# train the model for one epoch +command_train = ( + f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_align_tts.py --config_path {config_path} " + f"--coqpit.output_path {output_path} " + "--coqpit.datasets.0.name ljspeech " + "--coqpit.datasets.0.meta_file_train metadata.csv " + "--coqpit.datasets.0.meta_file_val metadata.csv " + "--coqpit.datasets.0.path tests/data/ljspeech " +) +run_cli(command_train) + +# Find latest folder +continue_path = max(glob.glob(os.path.join(output_path, "*/")), key=os.path.getmtime) + +# restore the model and continue training for one more epoch +command_train = f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_align_tts.py --continue_path {continue_path} " +run_cli(command_train) +shutil.rmtree(continue_path) diff --git a/tests/tts_tests/test_tacotron2_train.py b/tests/tts_tests/test_tacotron2_train.py new file mode 100644 index 00000000..2ac17502 --- /dev/null +++ b/tests/tts_tests/test_tacotron2_train.py @@ -0,0 +1,49 @@ +import glob +import os +import shutil + +from tests import get_tests_output_path, run_cli +from TTS.tts.configs import Tacotron2Config + +config_path = os.path.join(get_tests_output_path(), "test_model_config.json") +output_path = os.path.join(get_tests_output_path(), "train_outputs") + + +config = Tacotron2Config( + r=5, + batch_size=8, + eval_batch_size=8, + num_loader_workers=0, + num_val_loader_workers=0, + text_cleaner="english_cleaners", + use_phonemes=True, + phoneme_language="en-us", + phoneme_cache_path=os.path.join(get_tests_output_path(), "train_outputs/phoneme_cache/"), + run_eval=True, + test_delay_epochs=-1, + epochs=1, + print_step=1, + print_eval=True, +) +config.audio.do_trim_silence = True +config.audio.trim_db = 60 +config.save_json(config_path) + +# train the model for one epoch +command_train = ( + f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_tacotron.py --config_path {config_path} " + f"--coqpit.output_path {output_path} " + "--coqpit.datasets.0.name ljspeech " + "--coqpit.datasets.0.meta_file_train metadata.csv " + "--coqpit.datasets.0.meta_file_val metadata.csv " + "--coqpit.datasets.0.path tests/data/ljspeech " +) +run_cli(command_train) + +# Find latest folder +continue_path = max(glob.glob(os.path.join(output_path, "*/")), key=os.path.getmtime) + +# restore the model and continue training for one more epoch +command_train = f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_tacotron.py --continue_path {continue_path} " +run_cli(command_train) +shutil.rmtree(continue_path) diff --git a/tests/tts_tests/test_tacotron_train.py b/tests/tts_tests/test_tacotron_train.py new file mode 100644 index 00000000..b45e4a64 --- /dev/null +++ b/tests/tts_tests/test_tacotron_train.py @@ -0,0 +1,48 @@ +import glob +import os +import shutil + +from tests import get_tests_output_path, run_cli +from TTS.tts.configs import TacotronConfig + +config_path = os.path.join(get_tests_output_path(), "test_model_config.json") +output_path = os.path.join(get_tests_output_path(), "train_outputs") + + +config = TacotronConfig( + batch_size=8, + eval_batch_size=8, + num_loader_workers=0, + num_val_loader_workers=0, + text_cleaner="english_cleaners", + use_phonemes=True, + phoneme_language="en-us", + phoneme_cache_path=os.path.join(get_tests_output_path(), "train_outputs/phoneme_cache/"), + run_eval=True, + test_delay_epochs=-1, + epochs=1, + print_step=1, + print_eval=True, +) +config.audio.do_trim_silence = True +config.audio.trim_db = 60 +config.save_json(config_path) + +# train the model for one epoch +command_train = ( + f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_tacotron.py --config_path {config_path} " + f"--coqpit.output_path {output_path} " + "--coqpit.datasets.0.name ljspeech " + "--coqpit.datasets.0.meta_file_train metadata.csv " + "--coqpit.datasets.0.meta_file_val metadata.csv " + "--coqpit.datasets.0.path tests/data/ljspeech " +) +run_cli(command_train) + +# Find latest folder +continue_path = max(glob.glob(os.path.join(output_path, "*/")), key=os.path.getmtime) + +# restore the model and continue training for one more epoch +command_train = f"CUDA_VISIBLE_DEVICES='' python TTS/bin/train_tacotron.py --continue_path {continue_path} " +run_cli(command_train) +shutil.rmtree(continue_path)