def parse_args(parser):
    """
    Parse commandline arguments.
    """
    parser.add_argument('--tacotron2-checkpoint', type=str,
                        help='full path to the generator checkpoint file')
    parser.add_argument('-b', '--batch-size', default=32, type=int)
    parser.add_argument('--log-file', type=str, default='nvlog.json',
                        help='Filename for logging')
    # Mel extraction
    parser.add_argument('-d', '--dataset-path', type=str,
                        default='./', help='Path to dataset')
    parser.add_argument('--wav-text-filelist', required=True,
                        type=str, help='Path to file with audio paths and text')
    parser.add_argument('--text-cleaners', nargs='*',
                        default=['english_cleaners'], type=str,
                        help='Type of text cleaners for input text')
    parser.add_argument('--max-wav-value', default=32768.0, type=float,
                        help='Maximum audiowave value')
    parser.add_argument('--sampling-rate', default=22050, type=int,
                        help='Sampling rate')
    parser.add_argument('--filter-length', default=1024, type=int,
                        help='Filter length')
    parser.add_argument('--hop-length', default=256, type=int,
                        help='Hop (stride) length')
    parser.add_argument('--win-length', default=1024, type=int,
                        help='Window length')
    parser.add_argument('--mel-fmin', default=0.0, type=float,
                        help='Minimum mel frequency')
    parser.add_argument('--mel-fmax', default=8000.0, type=float,
                        help='Maximum mel frequency')
    # Duration extraction
    parser.add_argument('--extract-mels', action='store_true',
                        help='Calculate spectrograms from .wav files')
    parser.add_argument('--extract-mels-teacher', action='store_true',
                        help='Extract Taco-generated mel-spectrograms for KD')
    parser.add_argument('--extract-durations', action='store_true',
                        help='Extract char durations from attention matrices')
    parser.add_argument('--extract-attentions', action='store_true',
                        help='Extract full attention matrices')
    parser.add_argument('--extract-pitch-mel', action='store_true',
                        help='Extract pitch')
    parser.add_argument('--extract-pitch-char', action='store_true',
                        help='Extract pitch averaged over input characters')
    parser.add_argument('--extract-pitch-trichar', action='store_true',
                        help='Extract pitch averaged over input characters')
    parser.add_argument('--train-mode', action='store_true',
                        help='Run the model in .train() mode')
    parser.add_argument('--cuda', action='store_true',
                        help='Extract mels on a GPU using CUDA')
    return parser