none
hello.. can someone please help me with this error..? RRS feed

  • Question

  • #######cmd

    (myenv) C:\Users\Aditya Singh\Documents\weatherbot>python nlu_model.py C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\rasa_nlu\extractors\entity_synonyms.py:85: UserWarning: Failed to load synonyms file from './models/nlu/default/weathernlu\entity_synonyms.json' "".format(entity_synonyms_file)) Traceback (most recent call last): File "nlu_model.py", line 18, in <module> run_nlu() File "nlu_model.py", line 14, in run_nlu print(interpreter.parse(u"The weather condition in Italy")) File "C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\rasa_nlu\model.py", line 357, in parse component.process(message, **self.context) File "C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\rasa_nlu\classifiers\sklearn_intent_classifier.py", line 181, in process intents = self.transform_labels_num2str(intent_ids) File "C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\rasa_nlu\classifiers\sklearn_intent_classifier.py", line 115, in transform_labels_num2str return self.le.inverse_transform(y) File "C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\sklearn\preprocessing\label.py", line 273, in inverse_transform y = column_or_1d(y, warn=True) File "C:\Users\Aditya Singh\AppData\Local\conda\conda\envs\myenv\lib\site-packages\sklearn\utils\validation.py", line 788, in column_or_1d raise ValueError("bad input shape {0}".format(shape)) ValueError: bad input shape (1, 3)


    #nlu_model.py

    from rasa_nlu.training_data import load_data from rasa_nlu import config from rasa_nlu.model import Trainer from rasa_nlu.model import Metadata, Interpreter def train_nlu(data, configs, model_dir): training_data = load_data(data) trainer = Trainer(config.load(configs)) trainer.train(training_data) model_directory = trainer.persist(model_dir, fixed_model_name = 'weathernlu') def run_nlu(): interpreter = Interpreter.load('./models/nlu/default/weathernlu') print(interpreter.parse(u"The weather condition in Italy")) if __name__ == '__main__': #train_nlu('./data/data.json', 'config_spacy.json', './models/nlu') run_nlu()

    data.json
    {
      "rasa_nlu_data": {
        "common_examples": [
          {
            "text": "Hello",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "goodbye",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "What's the weather in noida at the moment?",
            "intent": "inform",
            "entities": [
              {
                "start": 22,
                "end": 28,
                "value": "noida",
                "entity": "location"
              }
            ]
          },
    	  {
            "text": "hey",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "hello",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "hi",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "heya",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "howdy",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "hey there",
            "intent": "greet",
            "entities": []
          },
          {
            "text": "bye",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "goodbye",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "bye bye",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "see ya",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "see you later",
            "intent": "goodbye",
            "entities": []
          },
          {
            "text": "What's the weather today?",
            "intent": "inform",
            "entities": []
          },
          {
            "text": "What's the weather in London today?",
            "intent": "inform",
            "entities": [
              {
                "start": 22,
                "end": 28,
                "value": "London",
                "entity": "location"
              }
            ]
          },
          {
            "text": "Show me what's the weather in Paris",
            "intent": "inform",
            "entities": [
              {
                "start": 30,
                "end": 35,
                "value": "Paris",
                "entity": "location"
              }
            ]
          },
          {
            "text": "I wonder what is the weather in Vilnius right now?",
            "intent": "inform",
            "entities": [
              {
                "start": 32,
                "end": 39,
                "value": "Vilnius",
                "entity": "location"
              }
            ]
          },
          {
            "text": "what is the weather?",
            "intent": "inform",
            "entities": []
          },
          {
            "text": "Tell me the weather",
            "intent": "inform",
            "entities": []
          },
          {
            "text": "Is the weather nice in Barcelona today?",
            "intent": "inform",
            "entities": [
              {
                "start": 23,
                "end": 32,
                "value": "Barcelona",
                "entity": "location"
              }
            ]
          },
          {
            "text": "I am going to London today and I wonder what is the weather out there?",
            "intent": "inform",
            "entities": [
              {
                "start": 14,
                "end": 20,
                "value": "London",
                "entity": "location"
              }
            ]
          },
          {
            "text": "I am planning my trip to Amsterdam. What is the weather out there?",
            "intent": "inform",
            "entities": [
              {
                "start": 25,
                "end": 34,
                "value": "Amsterdam",
                "entity": "location"
              }
            ]
          },
          {
            "text": "Show me the weather in Dublin, please",
            "intent": "inform",
            "entities": [
              {
                "start": 23,
                "end": 29,
                "value": "Dublin",
                "entity": "location"
              }
            ]
          },
          {
            "text": "in London",
            "intent": "inform",
            "entities": [
              {
                "start": 3,
                "end": 9,
                "value": "London",
                "entity": "location"
              }
            ]
          },
          {
            "text": "Lithuania",
            "intent": "inform",
            "entities": [
              {
                "start": 0,
                "end": 9,
                "value": "Lithuania",
                "entity": "location"
              }
            ]
          },
          {
            "text": "Oh, sorry, in Italy",
            "intent": "inform",
            "entities": [
              {
                "start": 14,
                "end": 19,
                "value": "Italy",
                "entity": "location"
              }
            ]
          },
          {
            "text": "Tell me the weather in Vilnius",
            "intent": "inform",
            "entities": [
              {
                "start": 23,
                "end": 30,
                "value": "Vilnius",
                "entity": "location"
              }
            ]
          },
          {
            "text": "The weather condition in Italy",
            "intent": "inform",
            "entities": [
              {
                "start": 25,
                "end": 30,
                "value": "Italy",
                "entity": "location"
              }
            ]
          }
        ]
      }
    }

    Tuesday, October 30, 2018 5:26 PM

All replies

  • Hi,

    Can you please share what product you are using and if there any document you are referring to? Thanks a lot!

    Regards,

    Yutong

    Tuesday, October 30, 2018 6:11 PM
    Moderator
  • hi,

    I am using anaconda navigator command prompt in windows 10.
    I Have created files "data.json"  under     ./data/data.json

    and  nlu_model.py
    when I run this nlu_model.py file I get this error


    raise ValueError("bad input shape {0}".format(shape))
    ValueError: bad input shape (1, 3)


    there is one more file

    in the main folder

     config_spacy.json


    #config_spacy.json

    { "pipeline":"spacy_sklearn", "path":"./models/nlu", "data":"./data/data.json" }







    • Edited by aditya7 Tuesday, October 30, 2018 6:53 PM
    Tuesday, October 30, 2018 6:43 PM
    • I am trying to make a weather bot but getting errors mentioned above
    • Edited by aditya7 Tuesday, October 30, 2018 6:55 PM
    Tuesday, October 30, 2018 6:55 PM
  • Have you find any solution of this??

    Saturday, October 19, 2019 10:26 AM