From 06612ce3055d483a9a347abe746551658ee0a43a Mon Sep 17 00:00:00 2001 From: erogol Date: Mon, 7 Dec 2020 15:57:34 +0100 Subject: [PATCH] test fixes --- TTS/bin/distribute_tts.py | 65 ----------------------------- TTS/tts/utils/generic_utils.py | 1 + tests/inputs/test_glow_tts.json | 2 + tests/inputs/test_train_config.json | 1 + tests/test_tacotron_train.sh | 5 +-- tests/test_tts_train.sh | 13 ------ 6 files changed, 6 insertions(+), 81 deletions(-) delete mode 100644 TTS/bin/distribute_tts.py delete mode 100755 tests/test_tts_train.sh diff --git a/TTS/bin/distribute_tts.py b/TTS/bin/distribute_tts.py deleted file mode 100644 index 470f6d1c..00000000 --- a/TTS/bin/distribute_tts.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import os -import sys -import pathlib -import time -import subprocess -import argparse -import torch - - -def main(): - """ - Call train.py as a new process and pass command arguments - """ - parser = argparse.ArgumentParser() - parser.add_argument( - '--continue_path', - type=str, - help='Training output folder to continue training. Use to continue a training. If it is used, "config_path" is ignored.', - default='', - required='--config_path' not in sys.argv) - parser.add_argument( - '--restore_path', - type=str, - help='Model file to be restored. Use to finetune a model.', - default='') - parser.add_argument( - '--config_path', - type=str, - help='Path to config file for training.', - required='--continue_path' not in sys.argv - ) - args = parser.parse_args() - - num_gpus = torch.cuda.device_count() - group_id = time.strftime("%Y_%m_%d-%H%M%S") - - # set arguments for train.py - folder_path = pathlib.Path(__file__).parent.absolute() - command = [os.path.join(folder_path, 'train_tts.py')] - command.append('--continue_path={}'.format(args.continue_path)) - command.append('--restore_path={}'.format(args.restore_path)) - command.append('--config_path={}'.format(args.config_path)) - command.append('--group_id=group_{}'.format(group_id)) - command.append('') - - # run processes - processes = [] - for i in range(num_gpus): - my_env = os.environ.copy() - my_env["PYTHON_EGG_CACHE"] = "/tmp/tmp{}".format(i) - command[-1] = '--rank={}'.format(i) - stdout = None if i == 0 else open(os.devnull, 'w') - p = subprocess.Popen(['python3'] + command, stdout=stdout, env=my_env) - processes.append(p) - print(command) - - for p in processes: - p.wait() - - -if __name__ == '__main__': - main() diff --git a/TTS/tts/utils/generic_utils.py b/TTS/tts/utils/generic_utils.py index 3a01f2a2..48b00fa5 100644 --- a/TTS/tts/utils/generic_utils.py +++ b/TTS/tts/utils/generic_utils.py @@ -248,6 +248,7 @@ def check_config_tts(c): check_argument('batch_group_size', c, restricted=True, val_type=int, min_val=0) check_argument('min_seq_len', c, restricted=True, val_type=int, min_val=0) check_argument('max_seq_len', c, restricted=True, val_type=int, min_val=10) + check_argument('compute_input_seq_cache', c, restricted=True, val_type=bool) # paths check_argument('output_path', c, restricted=True, val_type=str) diff --git a/tests/inputs/test_glow_tts.json b/tests/inputs/test_glow_tts.json index c1bc33fd..99f9eaf9 100644 --- a/tests/inputs/test_glow_tts.json +++ b/tests/inputs/test_glow_tts.json @@ -70,6 +70,7 @@ "eval_batch_size":1, "r": 1, // Number of decoder frames to predict per iteration. Set the initial values if gradual training is enabled. "loss_masking": true, // enable / disable loss masking against the sequence padding. + "data_dep_init_iter": 1, // VALIDATION "run_eval": true, @@ -105,6 +106,7 @@ "min_seq_len": 3, // DATASET-RELATED: minimum text length to use in training "max_seq_len": 500, // DATASET-RELATED: maximum text length "compute_f0": false, // compute f0 values in data-loader + "compute_input_seq_cache": true, // PATHS "output_path": "tests/train_outputs/", diff --git a/tests/inputs/test_train_config.json b/tests/inputs/test_train_config.json index 5b2dff2d..6be85314 100644 --- a/tests/inputs/test_train_config.json +++ b/tests/inputs/test_train_config.json @@ -132,6 +132,7 @@ "batch_group_size": 0, //Number of batches to shuffle after bucketing. "min_seq_len": 6, // DATASET-RELATED: minimum text length to use in training "max_seq_len": 153, // DATASET-RELATED: maximum text length + "compute_input_seq_cache": true, // PATHS "output_path": "tests/train_outputs/", diff --git a/tests/test_tacotron_train.sh b/tests/test_tacotron_train.sh index 8138fb75..9268ea96 100755 --- a/tests/test_tacotron_train.sh +++ b/tests/test_tacotron_train.sh @@ -1,14 +1,13 @@ #!/usr/bin/env bash - set -xe BASEDIR=$(dirname "$0") echo "$BASEDIR" # run training -CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tts.py --config_path $BASEDIR/inputs/test_train_config.json +CUDA_VISIBLE_DEVICES="" python TTS/bin/train_tacotron.py --config_path $BASEDIR/inputs/test_train_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_tts.py --continue_path $BASEDIR/train_outputs/$LATEST_FOLDER +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/test_tts_train.sh b/tests/test_tts_train.sh deleted file mode 100755 index 9268ea96..00000000 --- a/tests/test_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_tacotron.py --config_path $BASEDIR/inputs/test_train_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/