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.65k stars 4.6k forks source link

Training error #94

Closed yogeshhk closed 7 years ago

yogeshhk commented 7 years ago

I am doing restaurants tutorial mentioned at http://rasa-nlu.readthedocs.io/en/latest/tutorial.html#section-tutorial

Doing it spacy_sklearn way

Downloaded spacy and all the models

I had scikit-learn installed, which was 0.18

I had data/demo-rasa.json so mentioned it in the config.json and not demo-restaurants.json

When I fiired following command: python -m rasa_nlu.train -c config.json

I got error:

ImportError: cannot import name check_arrays

Thinking that its a scikit version issue (ref: http://stackoverflow.com/questions/29596237/import-check-arrays-from-sklearn) I installed 0.17.1 which gave following error:

ImportError: No module named model_selection

I am stuck now.. not sure what to do next...any hints?

amn41 commented 7 years ago

Hi @yogeshhk - we're using scikit-learn 0.18.1 - can you tell me exactly which line throws the importerror?

yogeshhk commented 7 years ago

Traceback (most recent call last): File "C:\Users\kulkarni\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.2.3262.win-x86_64\lib\runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "C:\Users\kulkarni\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.2.3262.win-x86_64\lib\runpy.py", line 72, in _run_code exec code in run_globals File "build\bdist.win-amd64\egg\rasa_nlu\train.py", line 65, in File "build\bdist.win-amd64\egg\rasa_nlu\train.py", line 54, in do_train File "build\bdist.win-amd64\egg\rasa_nlu\train.py", line 31, in create_trainer

File "build\bdist.win-amd64\egg\rasa_nlu\trainers\spacy_sklearn_trainer.py", line 8, in File "build\bdist.win-amd64\egg\rasa_nlu\classifiers\sklearn_intent_classifier.py", line 1, in File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\model_selection__init.py", line 1, in from ._split import BaseCrossValidator File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\model_selection_split.py", line 36, in from ..gaussian_process.kernels import Kernel as GPKernel File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\gaussian_process__init.py", line 13, in from .gpr import GaussianProcessRegressor File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\gaussian_process\gpr.py", line 15, in from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\gaussian_process\kernels.py", line 30, in from ..metrics.pairwise import pairwise_kernels File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\metrics\init.py", line 33, in from . import cluster File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\metrics\cluster\init__.py", line 23, in from .bicluster import consensus_score File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\metrics\cluster\bicluster\init__.py", line 1, in from .bicluster_metrics import consensus_score File "c:\users\kulkarni\appdata\local\enthought\canopy\user\lib\site-packages\sklearn\metrics\cluster\bicluster\bicluster_metrics.py", line 6, in from sklearn.utils.validation import check_arrays ImportError: cannot import name check_arrays

amn41 commented 7 years ago

my best guess is there is something up with your installation. I'm not familiar with the canopy distribution, but my advice would be to do a fresh install, with scikit-learn 0.18.1. Then open up a python interpreter, and run from sklearn import model_selection and see if that throws the same error.

yogeshhk commented 7 years ago

Thanks for the suggestion. I removed the Canopy distribution. Installed Minicoda 2 and then compilation seems to be fine. I could train the model and added it to the config.json I ran the server by

python -m rasa_nlu.server -c config.json

Then fired the test command from another window:

curl -XPOST localhost:5000/parse -d '{"q":"I am looking for Chinese food"}' | python -mjson.tool

It said:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 35 0 0 100 35 0 149 --:--:-- --:--:-- --:--:-- 149 No JSON object could be decoded

I tried another test. In browser I pasted:

http://localhost:5000/parse?q=I am looking for Chinese food

It gave:

{"text": "I am looking for Chinese food", "intent": "restaurant_search", "entities": []}

I did not get the correct reply as:

{
  "intent" : "restaurant_search",
  "entities" : [
    {
      "start": 8,
      "end": 15,
      "value": "chinese",
      "entity": "cuisine"
    }
  ]
}

What could have gone wrong?

There was exception on server side. Traceback is:

Exception happened during processing of request from ('127.0.0.1', 49833) Traceback (most recent call last): File "C:\Users\kulkarni\Miniconda2\lib\SocketServer.py", line 290, in _handle_request_noblock self.process_request(request, client_address) File "C:\Users\kulkarni\Miniconda2\lib\SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "C:\Users\kulkarni\Miniconda2\lib\SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "build\bdist.win-amd64\egg\rasa_nlu\server.py", line 76, in File "build\bdist.win-amd64\egg\rasa_nlu\server.py", line 160, in init File "C:\Users\kulkarni\Miniconda2\lib\SocketServer.py", line 652, in init self.handle() File "C:\Users\kulkarni\Miniconda2\lib\BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "C:\Users\kulkarni\Miniconda2\lib\BaseHTTPServer.py", line 328, in handle_one_request method() File "build\bdist.win-amd64\egg\rasa_nlu\server.py", line 201, in do_POST File "C:\Users\kulkarni\Miniconda2\lib\json__init__.py", line 339, in loads return _default_decoder.decode(s) File "C:\Users\kulkarni\Miniconda2\lib\json\decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\kulkarni\Miniconda2\lib\json\decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

My Model training_data.json does have entry like:

      {
        "text": "show me chinese restaurants", 
        "intent": "restaurant_search", 
        "entities": [
          {
            "start": 8, 
            "end": 15, 
            "value": "chinese", 
            "entity": "cuisine"
          }
        ]
      }, 

I thought it would pick up entities, but did not. Any clues?

amn41 commented 7 years ago

The example data provided is really just a toy example to show how to use rasa, & doesn't provide enough examples for the spacy NER model to pick up chinese as an entity. I'll add a comment about that to the docs :)

Regarding the issue with your curl POST, my best guess is that the windows version of cURL doesn't automatically encode the json data for you. I would suggest doing the request with Postman or a similar API testing tool (or just the python requests package

amn41 commented 7 years ago

closing this now. If you are certain the HTTP request is valid & there's an issue on rasa's side, please re-open.