Itzik Gili
Itzik Gili

Reputation: 324

Rasa NLU failing to classify intent

I'm running rasa-nlu on a docker container. trying to train it on my data and then performing requests to the http server, which always result as follow:

"intent": { "confidence": 1.0, "name": "None" }

I'm running a config file as follows:

{
  "name": null,
  "pipeline": "mitie",
  "language": "en",
  "num_threads": 4,
  "max_training_processes": 1,
  "path": "./models",
  "response_log": "logs",
  "config": "config.json",
  "log_level": "INFO",
  "port": 5000,
  "data": "./data/test/demo-rasa.json",
  "emulate": null,
  "log_file": null,
  "mitie_file": "./data/total_word_feature_extractor.dat",
  "spacy_model_name": null,
  "server_model_dirs": null,
  "token": null,
  "cors_origins": [],
  "aws_endpoint_url": null,
  "max_number_of_ngrams": 7,
  "duckling_dimensions": null,
  "entity_crf_BILOU_flag": true,
  "entity_crf_features": [
    ["low", "title", "upper", "pos", "pos2"],
    ["bias", "low", "word3", "word2", "upper", "title", "digit", "pos", "pos2", "p
attern"],
    ["low", "title", "upper", "pos", "pos2"]]
}
  1. What's the reason for that behaviour?

  2. The models folder contains the trained model inside another nested folder, is it ok?

Thanks.

Upvotes: 0

Views: 1761

Answers (3)

Kunal Mukherjee
Kunal Mukherjee

Reputation: 5853

There are some issues with MITIE Pipeline on Windows :( , training on MITIE takes a lot of time and spaCy trains the model very quickly. (2-3 minutes depending on your Processor and RAM).

Here's how I resolved it:

[Note: I am using Python 3.6.3 x64 Anaconda and Windows 8.1 O.S]

Install the following packages in this order:

  1. Spacy Machine Learning Package: pip install -U spacy
  2. Spacy English Language Model: python -m spacy download en
  3. Scikit Package: pip install -U scikit-learn
  4. Numpy package for mathematical calculations: pip install -U numpy
  5. Scipy Package: pip install -U scipy
  6. Sklearn Package for Intent Recognition: pip install -U sklearn-crfsuite
  7. NER Duckling for better Entity Recognition with Spacy: pip install -U duckling
  8. RASA NLU: pip install -U rasa_nlu==0.10.4

Now, in RASA v0.10.4 they use Twisted Asynchronous server which is not WSGI compatible. (More information on this here.)

Now make the config file as follows:

{
    "project": "Travel",
    "pipeline": "spacy_sklearn",
    "language": "en",
    "num_threads": 1,
    "max_training_processes": 1,
    "path": "C:\\Users\\Kunal\\Desktop\\RASA\\models",
    "response_log": "C:\\Users\\Kunal\\Desktop\\RASA\\log",
    "config": "C:\\Users\\Kunal\\Desktop\\RASA\\config_spacy.json",
    "log_level": "INFO",
    "port": 5000,
    "data": "C:\\Users\\Kunal\\Desktop\\RASA\\data\\FlightBotFinal.json",
    "emulate": "luis",
    "spacy_model_name": "en",
    "token": null,
    "cors_origins": ["*"],
    "aws_endpoint_url": null
  }

Now run the server, like the following template:

http://localhost:5000/parse?q=&project=

You will get a JSON response something like this, like the LUISResult class of BotFramework C#.

enter image description here

Upvotes: 0

Caleb Keller
Caleb Keller

Reputation: 2161

I already saw your GitHub issue, thanks for providing a bit more information here. You're still leaving a lot of details about the Docker container ambiguous.

I and a few others got a pull request merged into the rasa repo available here on Docker Hub. There are several different builds now available and the basic usage instructions can be found below or on the main repo README.

General Docker Usage Instructions

For the time being though, follow the below steps:

docker run -p 5000:5000 rasa/rasa_nlu:latest-mitie

The demo data should be loaded already able to be parsed against using the below command:

curl 'http://localhost:5000/parse?q=hello'

Trying to troubleshoot your specific problem

As for your specific install and why it is failing, my guess is that your trained data either isn't there or is a name that rasa doesn't expect. Run this command to see what models are available:

curl 'http://locahost:5000/status'

your response should be something like:

{
  "trainings_queued" : 0,
  "training_workers" : 1,
  "available_models" : [
    "test_model"
  ]
}

If you have a model listed under available_models you can load/parse it with the below command replacing test_model with your model name.

curl 'http://localhost:5000/parse?q=hello&model=test_model'

Upvotes: 3

Itzik Gili
Itzik Gili

Reputation: 324

Actually, I found that using Mitie always fails, thus, the model wasn't getting updated. Thanks for the info though.

Using Mitie-Sklearn fixed the issue.

Thank you.

Upvotes: 0

Related Questions