Beispiel #1
0
def main(args):
    utils.configure_colored_logging(args.loglevel)
    pre_load = args.pre_load

    _endpoints = read_endpoints(args.endpoints)

    router = DataRouter(args.path,
                        args.max_training_processes,
                        args.response_log,
                        args.emulate,
                        args.storage,
                        model_server=_endpoints.model,
                        wait_time_between_pulls=args.wait_time_between_pulls)
    if pre_load:
        logger.debug('Preloading....')
        if 'all' in pre_load:
            pre_load = router.project_store.keys()
        router._pre_load(pre_load)

    rasa = RasaNLU(router,
                   args.loglevel,
                   args.write,
                   args.num_threads,
                   get_token(cmdline_args.token),
                   args.cors,
                   default_config_path=args.config)

    logger.info('Started http server on port %s' % args.port)
    rasa.app.run('0.0.0.0', args.port)
Beispiel #2
0
def main(args):
    utils.configure_colored_logging(args.loglevel)
    pre_load = args.pre_load

    _endpoints = read_endpoints(args.endpoints)

    router = DataRouter(
        args.path,
        args.max_training_processes,
        args.response_log,
        args.emulate,
        args.storage,
        model_server=_endpoints.model,
        wait_time_between_pulls=args.wait_time_between_pulls
    )
    if pre_load:
        logger.debug('Preloading....')
        if 'all' in pre_load:
            pre_load = router.project_store.keys()
        router._pre_load(pre_load)

    rasa = RasaNLU(
        router,
        args.loglevel,
        args.write,
        args.num_threads,
        get_token(cmdline_args.token),
        args.cors,
        default_config_path=args.config
    )

    logger.info('Started http server on port %s' % args.port)
    rasa.app.run('0.0.0.0', args.port)
Beispiel #3
0
            )
            return simplejson.dumps(response)
        except Exception as e:
            request.setResponseCode(500)
            logger.exception(e)
            return simplejson.dumps({"error": "{}".format(e)})


if __name__ == '__main__':
    # Running as standalone python application
    cmdline_args = create_argument_parser().parse_args()

    utils.configure_colored_logging(cmdline_args.loglevel)
    pre_load = cmdline_args.pre_load

    _endpoints = read_endpoints(cmdline_args.endpoints)

    router = DataRouter(
            cmdline_args.path,
            cmdline_args.max_training_processes,
            cmdline_args.response_log,
            cmdline_args.emulate,
            cmdline_args.storage,
            model_server=_endpoints.model,
            wait_time_between_pulls=cmdline_args.wait_time_between_pulls
    )
    if pre_load:
        logger.debug('Preloading....')
        if 'all' in pre_load:
            pre_load = router.project_store.keys()
        router._pre_load(pre_load)
Beispiel #4
0
    interpreter = trainer.train(training_data, **kwargs)

    if path:
        persisted_path = trainer.persist(path, persistor, project,
                                         fixed_model_name)
    else:
        persisted_path = None

    return trainer, interpreter, persisted_path


if __name__ == '__main__':
    cmdline_args = create_argument_parser().parse_args()

    utils.configure_colored_logging(cmdline_args.loglevel)

    if cmdline_args.url:
        data_endpoint = EndpointConfig(cmdline_args.url)
    else:
        data_endpoint = read_endpoints(cmdline_args.endpoints).data

    do_train(config.load(cmdline_args.config),
             cmdline_args.data,
             cmdline_args.path,
             cmdline_args.project,
             cmdline_args.fixed_model_name,
             cmdline_args.storage,
             data_endpoint=data_endpoint,
             num_threads=cmdline_args.num_threads)
    logger.info("Finished training")
Beispiel #5
0
    if path:
        persisted_path = trainer.persist(path,
                                         persistor,
                                         project,
                                         fixed_model_name)
    else:
        persisted_path = None

    return trainer, interpreter, persisted_path


if __name__ == '__main__':
    cmdline_args = create_argument_parser().parse_args()

    utils.configure_colored_logging(cmdline_args.loglevel)

    if cmdline_args.url:
        data_endpoint = EndpointConfig(cmdline_args.url)
    else:
        data_endpoint = read_endpoints(cmdline_args.endpoints).data

    train(cmdline_args.config,
          cmdline_args.data,
          cmdline_args.path,
          cmdline_args.project,
          cmdline_args.fixed_model_name,
          cmdline_args.storage,
          training_data_endpoint=data_endpoint,
          num_threads=cmdline_args.num_threads)
    logger.info("Finished training")