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.94k stars 4.64k forks source link

KeyError: 'prefix5' when running rasa_core #2234

Closed sherinmannambeth closed 5 years ago

sherinmannambeth commented 6 years ago
**Rasa Core version**:0.9.6 **Python version**: Python 3.6.1 :: Anaconda 4.4.0 (64-bit) **Operating system** (windows, osx, ...): Windows 8.1 **Issue**: C:\Users\1807\Desktop\rasa_git\rasa_core\examples\restaurantbot>python -m rasa_core.run -d models/dialogue -u models/nlu/default/model_20180619-044555 2018-06-19 07:28:54 WARNING py.warnings - C:\Users\1807\Anaconda3\lib\site-packages\h5py\__init__.py:34 : FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is depreca ted. In future, it will be treated as `np.float64 == np.dtype(float).type`. from ._conv import register_converters as _register_converters Using TensorFlow backend. 2018-06-19 07:29:16 WARNING py.warnings - C:\Users\1807\Anaconda3\lib\site-packages\sklearn\base.py:311 : UserWarning: Trying to unpickle estimator LabelEncoder from version 0.18.1 when using version 0.19.1. T his might lead to breaking code or invalid results. Use at your own risk. UserWarning) 2018-06-19 07:29:16 WARNING py.warnings - C:\Users\1807\Anaconda3\lib\site-packages\sklearn\base.py:311 : UserWarning: Trying to unpickle estimator SVC from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk. UserWarning) 2018-06-19 07:29:16 WARNING py.warnings - C:\Users\1807\Anaconda3\lib\site-packages\sklearn\base.py:311 : UserWarning: Trying to unpickle estimator GridSearchCV from version 0.18.1 when using version 0.19.1. T his might lead to breaking code or invalid results. Use at your own risk. UserWarning) Bot loaded. Type a message and press enter: hi Traceback (most recent call last): File "C:\Users\1807\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\1807\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\run.py", line 171, in cmdline_args.credentials) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\run.py", line 153, in main agent.handle_channel(input_channel) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\agent.py", line 160, in handle_channel processor.handle_channel(input_channel) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\processor.py", line 61, in handle_channel input_channel.start_sync_listening(self.handle_message) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\channels\console.py", line 52, in start_sync_ listening self._record_messages(message_handler) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\channels\console.py", line 45, in _record_mes sages self.sender_id)) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\processor.py", line 83, in handle_message self._handle_message_with_tracker(message, tracker) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\processor.py", line 223, in _handle_message_w ith_tracker parse_data = self._parse_message(message) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\processor.py", line 212, in _parse_message parse_data = self.interpreter.parse(message.text) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_core\interpreter.py", line 232, in parse return self.interpreter.parse(text) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_nlu\model.py", line 340, in parse component.process(message, **self.context) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 126, in process extracted = self.add_extractor_name(self.extract_entities(message)) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 145, in extract_entities features = self._sentence_to_features(text_data) File "C:\Users\1807\Anaconda3\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 361, in _sentence_to_features value = self.function_dict[feature](word) KeyError: 'prefix5' **Content of domain file** (if used & relevant): ``` action_factory: null action_names: - utter_greet - utter_goodbye - utter_default - utter_ack_dosearch - utter_ack_findalternatives - utter_ack_makereservation - utter_ask_cuisine - utter_ask_howcanhelp - utter_ask_location - utter_ask_moreupdates - utter_ask_numpeople - utter_ask_price - utter_on_it - action_search_restaurants - action_suggest actions: - utter_greet - utter_goodbye - utter_default - utter_ack_dosearch - utter_ack_findalternatives - utter_ack_makereservation - utter_ask_cuisine - utter_ask_howcanhelp - utter_ask_location - utter_ask_moreupdates - utter_ask_numpeople - utter_ask_price - utter_on_it - bot.ActionSearchRestaurants - bot.ActionSuggest config: store_entities_as_slots: true entities: - location - info - people - price - cuisine intents: - greet - affirm - deny - inform - thankyou - request_info slots: cuisine: initial_value: null type: rasa_core.slots.TextSlot info: initial_value: null type: rasa_core.slots.TextSlot location: initial_value: null type: rasa_core.slots.TextSlot matches: initial_value: null type: rasa_core.slots.UnfeaturizedSlot people: initial_value: null type: rasa_core.slots.TextSlot price: initial_value: null type: rasa_core.slots.TextSlot templates: utter_ack_dosearch: - text: ok let me see what I can find utter_ack_findalternatives: - text: ok let me see what else there is utter_ack_makereservation: - buttons: - payload: thank you title: thank you text: ok making a reservation utter_ask_cuisine: - text: what kind of cuisine would you like? utter_ask_howcanhelp: - text: how can I help you? utter_ask_location: - text: where? utter_ask_moreupdates: - text: if you'd like to modify anything else, please tell me what utter_ask_numpeople: - text: for how many people? utter_ask_price: - buttons: - payload: cheap title: cheap - payload: expensive title: expensive text: in which price range? utter_default: - text: default message utter_goodbye: - text: goodbye :( - text: Bye-bye utter_greet: - text: hey there! utter_on_it: - text: I'm on it topics: [] ```
tmbo commented 6 years ago

This looks like you are trying to load a rasa NLU from an older version with a newer version. Retraining the NLU model should fix this issue.

sherinmannambeth commented 6 years ago

@tmbo This error comes when I give the rasa_core.run command This error gets solved when I remove the 'prefix5' from metadata.json file in trained nlu model(which I dont think is the solution)

akelad commented 6 years ago

yes, it's an NLU issue though. Have you tried retraining?

sherinmannambeth commented 6 years ago

@akelad Yes, but still the same issue persists.

beartell commented 6 years ago

very interesting. I came accross with the same issue.

  1. git clone master branch of rasa-nlu
  2. pip install -r requirements....
  3. train model with the data directory of the cloned rasa-nlu
  4. python 3.6
akelad commented 6 years ago

@sherinmannambeth @xentnex have you managed to solve this issue in the meantime?

ranjan-sumit commented 6 years ago

I am still facing the issue.

Bot loaded. Type a message and press enter: Hello

Traceback (most recent call last):
  File "train_online.py", line 50, in <module>
    run_weather_online(nlu_interpreter)
  File "train_online.py", line 42, in run_weather_online
    max_training_samples=300)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\agent.py", line 300, in train_online
    input_channel)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\policies\online_trainer.py", line 76, in run_online_training
    input_channel if input_channel else ConsoleInputChannel())
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\agent.py", line 160, in handle_channel
    processor.handle_channel(input_channel)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\processor.py", line 61, in handle_channel
    input_channel.start_sync_listening(self.handle_message)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\channels\console.py", line 52, in start_sync_listening
    self._record_messages(message_handler)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\channels\console.py", line 45, in _record_messages
    self.sender_id))
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\processor.py", line 83, in handle_message
    self._handle_message_with_tracker(message, tracker)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\processor.py", line 223, in _handle_message_with_tracker
    parse_data = self._parse_message(message)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\processor.py", line 212, in _parse_message
    parse_data = self.interpreter.parse(message.text)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core\interpreter.py", line 232, in parse
    return self.interpreter.parse(text)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\model.py", line 340, in parse
    component.process(message, **self.context)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 126, in process
    extracted = self.add_extractor_name(self.extract_entities(message))
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 145, in extract_entities
    features = self._sentence_to_features(text_data)
  File "C:\Users\sumit\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\extractors\crf_entity_extractor.py", line 361, in _sentence_to_features
    value = self.function_dict[feature](word)
KeyError: 'prefix5'

Please help with this

tmbo commented 6 years ago

@ranjan-sumit can you please share the contents of your models persisted metadata.json?

himanshuteotia commented 5 years ago

I am also getting the same error Traceback (most recent call last): File "/home/himnashu/anaconda3/envs/RASA_NEW/bin/rasa", line 8, in <module> sys.exit(main()) File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/__main__.py", line 76, in main cmdline_arguments.func(cmdline_arguments) File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/cli/train.py", line 76, in train kwargs=extract_additional_arguments(args), File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/train.py", line 45, in train kwargs=kwargs, File "uvloop/loop.pyx", line 1417, in uvloop.loop.Loop.run_until_complete File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/train.py", line 96, in train_async kwargs, File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/train.py", line 182, in _train_async_internal kwargs=kwargs, File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/train.py", line 231, in _do_training persist_nlu_training_data=persist_nlu_training_data, File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/train.py", line 459, in _train_nlu_with_validated_data persist_nlu_training_data=persist_nlu_training_data, File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/train.py", line 80, in train interpreter = trainer.train(training_data, **kwargs) File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/model.py", line 195, in train updates = component.train(working_data, self.config, **context) File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/extractors/crf_entity_extractor.py", line 156, in train self._train_model(dataset) File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/extractors/crf_entity_extractor.py", line 663, in _train_model X_train = [self._sentence_to_features(sent) for sent in df_train] File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/extractors/crf_entity_extractor.py", line 663, in <listcomp> X_train = [self._sentence_to_features(sent) for sent in df_train] File "/home/himnashu/anaconda3/envs/RASA_NEW/lib/python3.6/site-packages/rasa/nlu/extractors/crf_entity_extractor.py", line 481, in _sentence_to_features value = self.function_dict[feature](word) KeyError: 'word3'