2020-02-26 21:03:51 +08:00
|
|
|
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2020-02-13 14:48:21 +08:00
|
|
|
import argparse
|
|
|
|
|
2020-02-26 21:03:51 +08:00
|
|
|
|
2020-02-13 14:48:21 +08:00
|
|
|
def add_config_options_to_parser(parser):
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--config_path',
|
|
|
|
type=str,
|
2020-03-18 17:49:32 +08:00
|
|
|
default='configs/train_transformer.yaml',
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the yaml config file path.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--batch_size', type=int, default=32, help="batch size for training.")
|
|
|
|
parser.add_argument(
|
|
|
|
'--epochs',
|
|
|
|
type=int,
|
|
|
|
default=10000,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the number of epoch for training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--lr',
|
|
|
|
type=float,
|
|
|
|
default=0.001,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the learning rate for training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--save_step',
|
|
|
|
type=int,
|
|
|
|
default=500,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="checkpointing interval during training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--image_step',
|
|
|
|
type=int,
|
|
|
|
default=2000,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="attention image interval during training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--max_len',
|
|
|
|
type=int,
|
|
|
|
default=400,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="The max length of audio when synthsis.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--transformer_step',
|
|
|
|
type=int,
|
|
|
|
default=160000,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="Global step to restore checkpoint of transformer.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--vocoder_step',
|
|
|
|
type=int,
|
|
|
|
default=90000,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="Global step to restore checkpoint of postnet.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--use_gpu',
|
|
|
|
type=int,
|
|
|
|
default=1,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="use gpu or not during training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--use_data_parallel',
|
|
|
|
type=int,
|
|
|
|
default=0,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="use data parallel or not during training.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--stop_token',
|
|
|
|
type=int,
|
|
|
|
default=0,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="use stop token loss in network or not.")
|
|
|
|
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--data_path',
|
|
|
|
type=str,
|
|
|
|
default='./dataset/LJSpeech-1.1',
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the path of dataset.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--checkpoint_path',
|
|
|
|
type=str,
|
|
|
|
default=None,
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the path to load checkpoint or pretrain model.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--save_path',
|
|
|
|
type=str,
|
|
|
|
default='./checkpoint',
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the path to save checkpoint.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--log_dir',
|
|
|
|
type=str,
|
|
|
|
default='./log',
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the directory to save tensorboard log.")
|
2020-02-26 21:03:51 +08:00
|
|
|
parser.add_argument(
|
|
|
|
'--sample_path',
|
|
|
|
type=str,
|
|
|
|
default='./sample',
|
2020-02-13 14:48:21 +08:00
|
|
|
help="the directory to save audio sample in synthesis.")
|