Exemple #1
0
def set_test_core_arguments(parser: argparse.ArgumentParser):
    core_arguments = parser.add_argument_group("Core Test arguments")
    add_test_core_arguments(core_arguments)
    add_stories_param(core_arguments, "test")
    add_url_param(core_arguments)

    add_test_core_model_param(parser)
Exemple #2
0
def add_test_core_argument_group(parser: Union[argparse.ArgumentParser,
                                               argparse._ActionsContainer]):
    add_stories_param(parser, "test")
    parser.add_argument("--max-stories",
                        type=int,
                        help="Maximum number of stories to test on.")
    parser.add_argument(
        "--output",
        type=str,
        default="results",
        help="Output path for any files created during the evaluation.",
    )
    parser.add_argument(
        "--e2e",
        "--end-to-end",
        action="store_true",
        help="Run an end-to-end evaluation for combined action and "
        "intent prediction. Requires a story file in end-to-end "
        "format.",
    )
    add_endpoint_param(parser)
    parser.add_argument(
        "--fail-on-prediction-errors",
        action="store_true",
        help="If a prediction error is encountered, an exception "
        "is thrown. This can be used to validate stories during "
        "tests, e.g. on travis.",
    )
    parser.add_argument(
        "--url",
        type=str,
        help="If supplied, downloads a story file from a URL and "
        "trains on it. Fetches the data by sending a GET request "
        "to the supplied URL.",
    )
Exemple #3
0
def set_interactive_core_arguments(parser: argparse.ArgumentParser) -> None:
    add_model_param(parser, model_name="Rasa Core", default=None)
    add_stories_param(parser)

    _add_common_params(parser)
    _add_training_arguments(parser)
    add_port_argument(parser)
Exemple #4
0
def set_test_arguments(parser):
    add_model_param(parser, add_positional_arg=False)

    core_arguments = parser.add_argument_group("Core Test arguments")
    add_test_core_arguments(core_arguments)
    add_stories_param(core_arguments, "test")
    add_url_param(core_arguments)

    nlu_arguments = parser.add_argument_group("NLU Test arguments")
    add_test_nlu_arguments(nlu_arguments)
Exemple #5
0
def add_test_core_argument_group(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    include_e2e_argument: bool = False,
) -> None:
    add_stories_param(parser, "test")
    parser.add_argument(
        "--max-stories", type=int, help="Maximum number of stories to test on."
    )
    add_out_param(
        parser,
        default=DEFAULT_RESULTS_PATH,
        help_text="Output path for any files created during the evaluation.",
    )
    if include_e2e_argument:
        parser.add_argument(
            "--e2e",
            "--end-to-end",
            action="store_true",
            help="Run an end-to-end evaluation for combined action and "
            "intent prediction. Requires a story file in end-to-end "
            "format.",
        )
    add_endpoint_param(
        parser, help_text="Configuration file for the connectors as a yml file."
    )
    parser.add_argument(
        "--fail-on-prediction-errors",
        action="store_true",
        help="If a prediction error is encountered, an exception "
        "is thrown. This can be used to validate stories during "
        "tests, e.g. on travis.",
    )
    parser.add_argument(
        "--url",
        type=str,
        help="If supplied, downloads a story file from a URL and "
        "trains on it. Fetches the data by sending a GET request "
        "to the supplied URL.",
    )
    parser.add_argument(
        "--evaluate-model-directory",
        default=False,
        action="store_true",
        help="Should be set to evaluate models trained via "
        "'rasa train core --config <config-1> <config-2>'. "
        "All models in the provided directory are evaluated "
        "and compared against each other.",
    )
    add_no_plot_param(parser)
    add_errors_success_params(parser)
Exemple #6
0
def _add_core_arguments(parser: Union[argparse.ArgumentParser,
                                      argparse._ActionsContainer]):
    from rasa.cli.arguments.test import add_evaluation_arguments

    add_evaluation_arguments(parser)
    add_stories_param(parser, "test")

    parser.add_argument(
        "--url",
        type=str,
        help="If supplied, downloads a story file from a URL and "
        "trains on it. Fetches the data by sending a GET request "
        "to the supplied URL.",
    )
Exemple #7
0
def set_interactive_core_arguments(parser: argparse.ArgumentParser):
    add_model_param(parser)
    add_config_param(parser)
    add_domain_param(parser)
    add_stories_param(parser)
    add_out_param(parser)

    add_augmentation_param(parser)
    add_debug_plots_param(parser)
    add_dump_stories_param(parser)

    add_skip_visualization_param(parser)

    add_server_arguments(parser)
Exemple #8
0
def set_train_core_arguments(parser: argparse.ArgumentParser):
    add_stories_param(parser)
    add_domain_param(parser)
    add_core_config_param(parser)
    add_out_param(parser, help_text="Directory where your models should be stored.")

    add_augmentation_param(parser)
    add_debug_plots_param(parser)
    add_dump_stories_param(parser)

    add_force_param(parser)

    add_model_name_param(parser)

    compare_arguments = parser.add_argument_group("Comparison Arguments")
    add_compare_params(compare_arguments)
Exemple #9
0
def set_train_core_arguments(parser: argparse.ArgumentParser):
    add_stories_param(parser)
    add_domain_param(parser)
    add_core_config_param(parser)
    add_out_param(parser)

    add_augmentation_param(parser)
    add_debug_plots_param(parser)
    add_dump_stories_param(parser)

    add_force_param(parser)

    add_model_name_param(parser)
    add_compress_param(parser)

    compare_arguments = parser.add_argument_group("Comparison Arguments")
    add_compare_params(compare_arguments)
Exemple #10
0
def set_train_core_arguments(parser: argparse.ArgumentParser) -> None:
    """Specifies CLI arguments for `rasa train core`."""
    add_stories_param(parser)
    add_domain_param(parser)
    _add_core_config_param(parser)
    add_out_param(parser,
                  help_text="Directory where your models should be stored.")

    add_augmentation_param(parser)
    add_debug_plots_param(parser)

    add_force_param(parser)

    _add_model_name_param(parser)

    compare_arguments = parser.add_argument_group("Comparison Arguments")
    _add_compare_params(compare_arguments)
    add_finetune_params(parser)
Exemple #11
0
def set_interactive_core_arguments(parser: argparse.ArgumentParser):
    add_model_param(parser, model_name="Rasa Core", default=None)
    add_stories_param(parser)

    add_skip_visualization_param(parser)

    add_endpoint_param(
        parser,
        help_text=
        "Configuration file for the model server and the connectors as a yml file.",
    )

    train_arguments = parser.add_argument_group("Train Arguments")
    add_config_param(train_arguments)
    add_domain_param(train_arguments)
    add_out_param(train_arguments)
    add_augmentation_param(train_arguments)
    add_debug_plots_param(train_arguments)
    add_dump_stories_param(train_arguments)
Exemple #12
0
def set_visualize_stories_arguments(parser: argparse.ArgumentParser):
    add_domain_param(parser)
    add_stories_param(parser)
    add_config_param(parser)

    add_out_param(
        parser,
        default="graph.html",
        help_text="Filename of the output path, e.g. 'graph.html'.",
    )

    parser.add_argument(
        "--max-history",
        default=2,
        type=int,
        help="Max history to consider when merging paths in the output graph.",
    )

    add_nlu_data_param(
        parser,
        default=None,
        help_text="File or folder containing your NLU data, "
        "used to insert example messages into the graph.",
    )
Exemple #13
0
def add_subparser(subparsers: argparse._SubParsersAction,
                  parents: List[argparse.ArgumentParser]):
    import rasa.cli.arguments.train as core_cli

    train_parser = subparsers.add_parser("train", help="Train the Rasa bot")

    train_subparsers = train_parser.add_subparsers()
    train_core_parser = train_subparsers.add_parser(
        "core",
        conflict_handler="resolve",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        help="Train Rasa Core",
    )
    train_core_parser.set_defaults(func=train_core)

    train_nlu_parser = train_subparsers.add_parser(
        "nlu",
        parents=parents,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        help="Train Rasa NLU",
    )
    train_nlu_parser.set_defaults(func=train_nlu)

    for p in [train_parser, train_core_parser, train_nlu_parser]:
        add_general_arguments(p)

    for p in [train_core_parser, train_parser]:
        add_domain_param(p)
        core_cli.add_general_args(p)
    add_stories_param(train_core_parser)
    _add_core_compare_arguments(train_core_parser)

    add_nlu_data_param(train_nlu_parser)

    add_joint_parser_arguments(train_parser)
    train_parser.set_defaults(func=train)
Exemple #14
0
def set_show_stories_arguments(parser: argparse.ArgumentParser):
    add_domain_param(parser)
    add_stories_param(parser)
    add_config_param(parser)

    add_visualization_arguments(parser)
Exemple #15
0
def add_core_visualization_params(parser: argparse.ArgumentParser):
    from rasa.cli.arguments.visualization import add_visualization_arguments

    add_visualization_arguments(parser)
    add_domain_param(parser)
    add_stories_param(parser)