conditional required args for train and distribute.py

pull/10/head
Eren Golge 2019-10-31 14:13:15 +01:00
parent 06798c7b9b
commit 9b6021318d
2 changed files with 11 additions and 8 deletions

View File

@ -128,8 +128,9 @@ def main():
parser.add_argument( parser.add_argument(
'--continue_path', '--continue_path',
type=str, type=str,
help='Training output folder to conitnue training. Use to continue a training.', help='Training output folder to continue training. Use to continue a training. If it is used, "config_path" is ignored.',
default='') default='',
required=True)
parser.add_argument( parser.add_argument(
'--restore_path', '--restore_path',
type=str, type=str,
@ -138,7 +139,8 @@ def main():
parser.add_argument( parser.add_argument(
'--config_path', '--config_path',
type=str, type=str,
help='path to config file for training', help='Path to config file for training.',
required='--continue_path' not in sys.argv
) )
args = parser.parse_args() args = parser.parse_args()

View File

@ -647,8 +647,9 @@ if __name__ == '__main__':
parser.add_argument( parser.add_argument(
'--continue_path', '--continue_path',
type=str, type=str,
help='Training output folder to conitnue training. Use to continue a training.', help='Training output folder to continue training. Use to continue a training. If it is used, "config_path" is ignored.',
default='') default='',
required=True)
parser.add_argument( parser.add_argument(
'--restore_path', '--restore_path',
type=str, type=str,
@ -658,6 +659,7 @@ if __name__ == '__main__':
'--config_path', '--config_path',
type=str, type=str,
help='Path to config file for training.', help='Path to config file for training.',
required='--continue_path' not in sys.argv
) )
parser.add_argument('--debug', parser.add_argument('--debug',
type=bool, type=bool,
@ -688,9 +690,8 @@ if __name__ == '__main__':
c = load_config(args.config_path) c = load_config(args.config_path)
_ = os.path.dirname(os.path.realpath(__file__)) _ = os.path.dirname(os.path.realpath(__file__))
if args.continue_path != '': OUT_PATH = args.continue_path
OUT_PATH = create_experiment_folder(args.continue_path, c.run_name, args.debug) if args.continue_path == '':
else:
OUT_PATH = create_experiment_folder(c.output_path, c.run_name, args.debug) OUT_PATH = create_experiment_folder(c.output_path, c.run_name, args.debug)
AUDIO_PATH = os.path.join(OUT_PATH, 'test_audios') AUDIO_PATH = os.path.join(OUT_PATH, 'test_audios')