RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.88k stars 4.63k forks source link

json or yml format for config rasa training #2447

Closed e8180kimo closed 5 years ago

e8180kimo commented 6 years ago
**Rasa Core version**: 0.10.4 **Python version**: 3.7 **Operating system** (windows, osx, ...): osx **Issue**: I am following a tutorial to build my rasa bot on my local webserver [tutorial](https://www.analyticsvidhya.com/blog/2018/01/faq-chatbots-the-future-of-information-searching/) This tutorial is using `json` format for the `config` file. However, my config is `yml` format. To build rasa onto a web server, do I have to use the json format? --if so, is there an easy way to convert my yml to json? Does rasa_nlu.server only support json? This is my config.yml: ``` language: "en" pipeline: - name: "nlp_spacy" - name: "tokenizer_spacy" - name: "ner_crf" - name: "intent_featurizer_count_vectors" - name: "intent_classifier_tensorflow_embedding" ```
amn41 commented 6 years ago

As of 0.12 we separated out model configuration from server configuration, and model config is always in yaml (as you have it here). See the changelog

you can pass arguments to the server (like what port to listen on) via command line arguments, see here

e8180kimo commented 6 years ago

@amn41 I've trained rasa nlu. But there is no project in my folder My trained mode folder is like this:

--Models
----nlu
------default
--------current
----current
------dialogue

But when I run the server using python -m rasa_nlu.server -c config_spacy.yml --path /models and curl -XPOST localhost:5000/parse -d '{"q":"motivation"}' , it returns:

{
  "intent": {
    "name": null,
    "confidence": 1.0
  },
  "entities": [],
  "text": "motivation",
  "project": "default",
  "model": "fallback"

This is incorrect though.

amn41 commented 6 years ago

try with python -m rasa_nlu.server -c config_spacy.yml --path ./Models/nlu and then

curl -XPOST localhost:5000/parse?model=current -d '{"q":"motivation"}'

e8180kimo commented 6 years ago

@amn41 it returns { "error": "Unable to initialize persistor" }

On the server side:

2018-08-29 10:12:24-0700 [-] RuntimeError: Unable to initialize persistor
2018-08-29 10:12:24-0700 [-] "127.0.0.1" - - [29/Aug/2018:17:12:24 +0000] "GET /parse?q=motivation HTTP/1.1" 500 47 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
2018-08-29 10:13:09-0700 [-] 2018-08-29 10:13:09 WARNING  rasa_nlu.project  - Using default interpreter, couldn't fetch model: Unable to initialize persistor
2018-08-29 10:13:09-0700 [-] 2018-08-29 10:13:09 ERROR    __main__  - Unable to initialize persistor
2018-08-29 10:13:09-0700 [-] Traceback (most recent call last):
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/server.py", line 238, in parse
2018-08-29 10:13:09-0700 [-]     self.data_router.parse, data))
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/twisted/python/threadpool.py", line 250, in inContext
2018-08-29 10:13:09-0700 [-]     result = inContext.theWork()
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
2018-08-29 10:13:09-0700 [-]     inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
2018-08-29 10:13:09-0700 [-]     return self.currentContext().callWithContext(ctx, func, *args, **kw)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
2018-08-29 10:13:09-0700 [-]     return func(*args,**kw)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/data_router.py", line 249, in parse
2018-08-29 10:13:09-0700 [-]     model)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 119, in parse
2018-08-29 10:13:09-0700 [-]     interpreter = self._interpreter_for_model(model_name)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 197, in _interpreter_for_model
2018-08-29 10:13:09-0700 [-]     metadata = self._read_model_metadata(model_name)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 212, in _read_model_metadata
2018-08-29 10:13:09-0700 [-]     self._load_model_from_cloud(model_name, path)
2018-08-29 10:13:09-0700 [-]   File "/Users/wisionlearning/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 251, in _load_model_from_cloud
2018-08-29 10:13:09-0700 [-]     raise RuntimeError("Unable to initialize persistor")
2018-08-29 10:13:09-0700 [-] RuntimeError: Unable to initialize persistor
2018-08-29 10:13:09-0700 [-] "127.0.0.1" - - [29/Aug/2018:17:13:09 +0000] "POST /parse?model=current HTTP/1.1" 500 47 "-" "curl/7.60.0"
2018-08-29 10:13:24-0700 [-] Timing out client: IPv4Address(type='TCP', host='127.0.0.1', port=51392)
venky14 commented 6 years ago

same error here

2018-09-11 11:36:49+0530 [-] 2018-09-11 11:36:49 WARNING  rasa_nlu.project  - Using default interpreter, couldn't fetch model: Unable to initialize persistor
2018-09-11 11:36:49+0530 [-] 2018-09-11 11:36:49 ERROR    __main__  - Unable to initialize persistor

In detail

Aech:~ priya$ python -m rasa_nlu.server -c ./r_nlu_tf/config.yml --path ./r_nlu_tf/models/nlu
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''.  Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied.  Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification.  Many valid certificate/hostname mappings may be rejected.
/Users/priya/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
  return f(*args, **kwds)
/Users/priya/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
2018-09-11 11:35:14+0530 [-] Log opened.
2018-09-11 11:35:14+0530 [-] Site starting on 5000
2018-09-11 11:35:14+0530 [-] Starting factory <twisted.web.server.Site object at 0x18152136d8>
2018-09-11 11:36:49+0530 [-] 2018-09-11 11:36:49 WARNING  rasa_nlu.project  - Using default interpreter, couldn't fetch model: Unable to initialize persistor
2018-09-11 11:36:49+0530 [-] 2018-09-11 11:36:49 ERROR    __main__  - Unable to initialize persistor
2018-09-11 11:36:49+0530 [-] Traceback (most recent call last):
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/server.py", line 238, in parse
2018-09-11 11:36:49+0530 [-]     self.data_router.parse, data))
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/twisted/python/threadpool.py", line 250, in inContext
2018-09-11 11:36:49+0530 [-]     result = inContext.theWork()
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
2018-09-11 11:36:49+0530 [-]     inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
2018-09-11 11:36:49+0530 [-]     return self.currentContext().callWithContext(ctx, func, *args, **kw)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
2018-09-11 11:36:49+0530 [-]     return func(*args,**kw)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/data_router.py", line 242, in parse
2018-09-11 11:36:49+0530 [-]     model)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 119, in parse
2018-09-11 11:36:49+0530 [-]     interpreter = self._interpreter_for_model(model_name)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 197, in _interpreter_for_model
2018-09-11 11:36:49+0530 [-]     metadata = self._read_model_metadata(model_name)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 212, in _read_model_metadata
2018-09-11 11:36:49+0530 [-]     self._load_model_from_cloud(model_name, path)
2018-09-11 11:36:49+0530 [-]   File "/Users/priya/anaconda3/lib/python3.6/site-packages/rasa_nlu/project.py", line 251, in _load_model_from_cloud
2018-09-11 11:36:49+0530 [-]     raise RuntimeError("Unable to initialize persistor")
2018-09-11 11:36:49+0530 [-] RuntimeError: Unable to initialize persistor
2018-09-11 11:36:49+0530 [-] "127.0.0.1" - - [11/Sep/2018:06:06:49 +0000] "POST /parse?model=current HTTP/1.1" 500 47 "-" "curl/7.58.0"
akelad commented 6 years ago

@amn41 can you please look into what's going wrong there?

amn41 commented 6 years ago

@venky14 does it work if you specify the project explicitly?

curl -XPOST 'localhost:5000/parse?model=current&project=nlu' -d '{"q":"motivation"}'

venky14 commented 6 years ago

Got this

Aech:~ priya$ curl -XPOST 'localhost:5000/parse?model=current&project=nlu' -d '{"q":"motivation"}'
{
  "error": "Unable to initialize persistor"
}

same as above error.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed due to inactivity. Please create a new issue if you need more help.