Exemple #1
0
def create_argument_parser():
    import argparse
    parser = argparse.ArgumentParser(
        description='run a Rasa NLU model locally on the command line '
        'for manual testing')

    parser.add_argument('-m', '--model', required=True, help="path to model")

    utils.add_logging_option_arguments(parser, default=logging.INFO)

    return parser
Exemple #2
0
def create_argument_parser():
    parser = argparse.ArgumentParser(
        description='train a custom language parser')

    parser.add_argument('-o',
                        '--path',
                        default="models/nlu/",
                        help="Path where model files will be saved")

    group = parser.add_mutually_exclusive_group(required=True)

    group.add_argument('-d',
                       '--data',
                       default=None,
                       help="Location of the training data. For JSON and "
                       "markdown data, this can either be a single file "
                       "or a directory containing multiple training "
                       "data files.")

    group.add_argument('-u',
                       '--url',
                       default=None,
                       help="URL from which to retrieve training data.")

    parser.add_argument('-c',
                        '--config',
                        required=True,
                        help="Rasa NLU configuration file")

    parser.add_argument('-t',
                        '--num_threads',
                        default=1,
                        type=int,
                        help="Number of threads to use during model training")

    parser.add_argument('--project',
                        default=None,
                        help="Project this model belongs to.")

    parser.add_argument('--fixed_model_name',
                        help="If present, a model will always be persisted "
                        "in the specified directory instead of creating "
                        "a folder like 'model_20171020-160213'")

    parser.add_argument(
        '--storage',
        help='Set the remote location where models are stored. '
        'E.g. on AWS. If nothing is configured, the '
        'server will only serve the models that are '
        'on disk in the configured `path`.')

    utils.add_logging_option_arguments(parser)
    return parser
Exemple #3
0
def create_argument_parser():
    import argparse
    parser = argparse.ArgumentParser(
        description='evaluate a Rasa NLU pipeline with cross '
        'validation or on external data')

    parser.add_argument('-d',
                        '--data',
                        required=True,
                        help="file containing training/evaluation data")

    parser.add_argument('--mode',
                        default="evaluation",
                        help="evaluation|crossvalidation (evaluate "
                        "pretrained model or train model "
                        "by crossvalidation)")

    # todo: make the two different modes two subparsers
    parser.add_argument('-c',
                        '--config',
                        help="model configuration file (crossvalidation only)")

    parser.add_argument('-m',
                        '--model',
                        required=False,
                        help="path to model (evaluation only)")

    parser.add_argument('-f',
                        '--folds',
                        required=False,
                        default=10,
                        help="number of CV folds (crossvalidation only)")

    parser.add_argument('--errors',
                        required=False,
                        default="errors.json",
                        help="output path for the json with wrong predictions")

    parser.add_argument('--histogram',
                        required=False,
                        default="hist.png",
                        help="output path for the confidence histogram")

    parser.add_argument('--confmat',
                        required=False,
                        default="confmat.png",
                        help="output path for the confusion matrix plot")

    utils.add_logging_option_arguments(parser, default=logging.INFO)

    return parser
Exemple #4
0
def create_argument_parser():
    parser = argparse.ArgumentParser(description='parse incoming text')

    parser.add_argument('-e',
                        '--emulate',
                        choices=['wit', 'luis', 'dialogflow'],
                        help='which service to emulate (default: None i.e. use'
                        ' simple built in format)')
    parser.add_argument('-P',
                        '--port',
                        type=int,
                        default=5000,
                        help='port on which to run server')
    parser.add_argument(
        '--pre_load',
        nargs='+',
        default=[],
        help='Preload models into memory before starting the '
        'server. \nIf given `all` as input all the models '
        'will be loaded.\nElse you can specify a list of '
        'specific project names.\nEg: python -m '
        'rasa_nlu_gao.server --pre_load project1 --path projects '
        '-c config.yaml')
    parser.add_argument('-t',
                        '--token',
                        help="auth token. If set, reject requests which don't "
                        "provide this token as a query parameter")
    parser.add_argument('-w', '--write', help='file where logs will be saved')
    parser.add_argument('--path',
                        required=True,
                        help="working directory of the server. Models are"
                        "loaded from this directory and trained models "
                        "will be saved here.")
    parser.add_argument('--cors',
                        nargs="*",
                        help='List of domain patterns from where CORS '
                        '(cross-origin resource sharing) calls are '
                        'allowed. The default value is `[]` which '
                        'forbids all CORS requests.')

    parser.add_argument('--max_training_processes',
                        type=int,
                        default=1,
                        help='Number of processes used to handle training '
                        'requests. Increasing this value will have a '
                        'great impact on memory usage. It is '
                        'recommended to keep the default value.')
    parser.add_argument('--num_threads',
                        type=int,
                        default=1,
                        help='Number of parallel threads to use for '
                        'handling parse requests.')
    parser.add_argument('--response_log',
                        help='Directory where logs will be saved '
                        '(containing queries and responses).'
                        'If set to ``null`` logging will be disabled.')
    parser.add_argument(
        '--storage',
        help='Set the remote location where models are stored. '
        'E.g. on AWS. If nothing is configured, the '
        'server will only serve the models that are '
        'on disk in the configured `path`.')
    parser.add_argument('-c',
                        '--config',
                        help="Default model configuration file used for "
                        "training.")

    utils.add_logging_option_arguments(parser)

    return parser