| 37 | |
| 38 | |
| 39 | def get_arguments(): |
| 40 | def _str_to_bool(s): |
| 41 | """Convert string to bool (in argparse context).""" |
| 42 | if s.lower() not in ['true', 'false']: |
| 43 | raise ValueError('Argument needs to be a ' |
| 44 | 'boolean, got {}'.format(s)) |
| 45 | return {'true': True, 'false': False}[s.lower()] |
| 46 | |
| 47 | parser = argparse.ArgumentParser(description='WaveNet example network') |
| 48 | parser.add_argument('--batch_size', type=int, default=BATCH_SIZE, |
| 49 | help='How many wav files to process at once. Default: ' + str(BATCH_SIZE) + '.') |
| 50 | parser.add_argument('--data_dir', type=str, default=DATA_DIRECTORY, |
| 51 | help='The directory containing the VCTK corpus.') |
| 52 | parser.add_argument('--store_metadata', type=bool, default=METADATA, |
| 53 | help='Whether to store advanced debugging information ' |
| 54 | '(execution time, memory consumption) for use with ' |
| 55 | 'TensorBoard. Default: ' + str(METADATA) + '.') |
| 56 | parser.add_argument('--logdir', type=str, default=None, |
| 57 | help='Directory in which to store the logging ' |
| 58 | 'information for TensorBoard. ' |
| 59 | 'If the model already exists, it will restore ' |
| 60 | 'the state and will continue training. ' |
| 61 | 'Cannot use with --logdir_root and --restore_from.') |
| 62 | parser.add_argument('--logdir_root', type=str, default=None, |
| 63 | help='Root directory to place the logging ' |
| 64 | 'output and generated model. These are stored ' |
| 65 | 'under the dated subdirectory of --logdir_root. ' |
| 66 | 'Cannot use with --logdir.') |
| 67 | parser.add_argument('--restore_from', type=str, default=None, |
| 68 | help='Directory in which to restore the model from. ' |
| 69 | 'This creates the new model under the dated directory ' |
| 70 | 'in --logdir_root. ' |
| 71 | 'Cannot use with --logdir.') |
| 72 | parser.add_argument('--checkpoint_every', type=int, |
| 73 | default=CHECKPOINT_EVERY, |
| 74 | help='How many steps to save each checkpoint after. Default: ' + str(CHECKPOINT_EVERY) + '.') |
| 75 | parser.add_argument('--num_steps', type=int, default=NUM_STEPS, |
| 76 | help='Number of training steps. Default: ' + str(NUM_STEPS) + '.') |
| 77 | parser.add_argument('--learning_rate', type=float, default=LEARNING_RATE, |
| 78 | help='Learning rate for training. Default: ' + str(LEARNING_RATE) + '.') |
| 79 | parser.add_argument('--wavenet_params', type=str, default=WAVENET_PARAMS, |
| 80 | help='JSON file with the network parameters. Default: ' + WAVENET_PARAMS + '.') |
| 81 | parser.add_argument('--sample_size', type=int, default=SAMPLE_SIZE, |
| 82 | help='Concatenate and cut audio samples to this many ' |
| 83 | 'samples. Default: ' + str(SAMPLE_SIZE) + '.') |
| 84 | parser.add_argument('--l2_regularization_strength', type=float, |
| 85 | default=L2_REGULARIZATION_STRENGTH, |
| 86 | help='Coefficient in the L2 regularization. ' |
| 87 | 'Default: False') |
| 88 | parser.add_argument('--silence_threshold', type=float, |
| 89 | default=SILENCE_THRESHOLD, |
| 90 | help='Volume threshold below which to trim the start ' |
| 91 | 'and the end from the training set samples. Default: ' + str(SILENCE_THRESHOLD) + '.') |
| 92 | parser.add_argument('--optimizer', type=str, default='adam', |
| 93 | choices=optimizer_factory.keys(), |
| 94 | help='Select the optimizer specified by this option. Default: adam.') |
| 95 | parser.add_argument('--momentum', type=float, |
| 96 | default=MOMENTUM, help='Specify the momentum to be ' |