def validate_args(args):
    """
    Checks that the passed commandline arguments are valid

    Args:
        args: argparse arguments
    """
    if args.continue_training and args.overwrite:
        raise ValueError(
            'Cannot both continue training and overwrite the previous training session. Remove the --overwrite flag if trying to continue a previous training session.'
            )
    if args.train_images_per_epoch <= 0:
        raise ValueError('train_images_per_epoch must be a positive integer')
    if args.val_images_per_epoch <= 0:
        raise ValueError(
            'val_images_per_epoch must be a positive integer. Use --no_val instead.'
            )
    if args.force_GPU and args.num_GPUs != 1:
        raise ValueError('Should not specify both --force_GPU and --num_GPUs')
    if args.num_GPUs < 0:
        raise ValueError('num_GPUs must be a positive integer')
