Exemplo n.º 1
0
def main():
    print('initializing preprocessing..')
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--base_dir', default='data'
    )  ### because runing from current folder, need to move out before loading data
    parser.add_argument(
        '--hparams',
        default='',  ## modified hparams if neccessary
        help=
        'Hyperparameter overrides as a comma-separated list of name=value pairs'
    )
    parser.add_argument('--dataset', default='')  #audio data folder to be used
    parser.add_argument('--language', default='en_US')
    parser.add_argument('--voice', default='female')
    parser.add_argument('--reader', default='mary_ann')
    parser.add_argument('--merge_books', default='False')
    parser.add_argument('--book', default='northandsouth')
    parser.add_argument('--output', default='Tacotron_input'
                        )  #output folder - which holds Tacotron training data
    parser.add_argument(
        '--n_jobs', type=int,
        default=cpu_count())  #number of cpu use for multiprocessing
    args = parser.parse_args()
    modified_hp = hparams.parse(args.hparams)
    assert args.merge_books in ('False', 'True'
                                )  # add contrain to merge_book param
    run_preprocess(args, modified_hp)
def main():
    print('initializing preprocessing..')
    parser = argparse.ArgumentParser()
    parser.add_argument('--base_dir', default='')
    parser.add_argument(
        '--hparams',
        default='',
        help=
        'Hyperparameter overrides as a comma-separated list of name=value pairs'
    )
    parser.add_argument('--input_dir', default='Train_data/1-kss/wavs')
    parser.add_argument('--output', default='tacotron_output/gta/')
    parser.add_argument('--n_jobs', type=int, default=cpu_count())
    args = parser.parse_args()

    modified_hp = hparams.parse(args.hparams)

    run_preprocess(args, modified_hp)
			print(' ===== {}'.format(folder))
		return data_folders


def run_preprocess(args, hparams):
	input_folders = get_data(args, hparams)
	output_folder = os.path.join(args.base_dir, args.output)
	preprocess(args, input_folders, output_folder, hparams)


def get_arguments():
	print('initializing preprocessing..')
	parser = argparse.ArgumentParser()
	parser.add_argument('--base_dir',
						default='')  ### because runing from current folder, need to move out before loading data
	parser.add_argument('--hparams', default='',  ## modified hparams if neccessary
						help='Hyperparameter overrides as a comma-separated list of name=value pairs')
	parser.add_argument('--dataset', default='Train_data')  # audio data folder to be used
	parser.add_argument('--output', default='Tacotron_input')  # output folder - which holds Tacotron training data
	parser.add_argument('--n_jobs', type=int, default=cpu_count())  # number of cpu use for multiprocessing
	args = parser.parse_args()
	return args


if __name__ == '__main__':
	args = get_arguments()
	modified_hp = hparams.parse(args.hparams)
	run_preprocess(args, modified_hp)


Exemplo n.º 4
0
    Get desire sentences from sentences.txt. If the file is empty, then load sentences from hparams.
    :param hparams: holds alternative sentences.
    :return: sentences list
    '''
    with open('sentences.txt', 'rb') as f:
        sentences = list(map(lambda l: l.decode("utf-8")[:-1], f.readlines()))
    if len(sentences) != 0:
        return sentences
    else:
        sentences = hparams.sentences
        return sentences


if __name__ == '__main__':
    args = get_arguments()
    modified_hparams = hparams.parse(
        args.hparams)  ### update hyperparam using args.hparams variables
    if args.mode == 'synthesize':
        out_dir = tacotron_synthesize(args, modified_hparams, args.checkpoint)

    elif args.mode == 'inference':
        sentences = get_sentences(
            modified_hparams
        )  ### get sentences from sentences.txt file (or in hparams)
        inference_dir = tacotron_inference(args, modified_hparams,
                                           args.checkpoint, sentences)
        ### join audio files into one file
        if hparams.join_output_audio:
            inference_dir = inference_dir.replace('map.txt', '').strip()
            from natsort import natsorted
            import glob
            os.makedirs(inference_dir + '/joined/', exist_ok=True)