snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.9k stars 513 forks source link

unexpected model_version in nlu_engine #735

Closed ollyhayes closed 5 years ago

ollyhayes commented 5 years ago

Hi,

I've been setting up a raspberry-pi with snips by following these instructions: https://docs.snips.ai/getting-started/quick-start-raspberry-pi

When I speak I can see by monitoring mqtt that the hotword is detected but no intents are being detected. I ran sam status and see that snips-nlu is not running, which I think is the reason for that:

$ sam status

Connected to device 192.168.0.7

OS version ................... Raspbian GNU/Linux 8 (jessie)
Installed assistant .......... assistant
Language ..................... en
Hotword ...................... hey_snips
ASR engine ................... snips
Status ....................... Live

Service status:

snips-analytics .............. 0.58.3 (not running)
snips-asr .................... 0.58.3 (running)
snips-audio-server ........... 0.58.3 (running)
snips-dialogue ............... 0.58.3 (running)
snips-hotword ................ 0.58.3 (running)
snips-nlu .................... 0.58.3 (not running)
snips-skill-server ........... 0.58.3 (running)
snips-tts .................... 0.58.3 (running)

I checked the logs and it looks like there is some version mismatch, snips-nlu is expecting 0.16.0, but the version in the assistant I generated on https://console.snips.ai has version 0.17.0:

$ journactl -u snips-nlu
Dec 28 19:58:47 raspberrypi systemd[1]: Started Snips NLU.
Dec 28 19:58:47 raspberrypi snips-nlu[2940]: INFO:snips_nlu_hermes: loading model at path "/usr/share/snips/assistant/nlu_engine"
Dec 28 19:58:47 raspberrypi snips-nlu[2940]: ERROR:snips_nlu       : Unable to read file '/usr/share/snips/assistant/nlu_engine/nlu_engine.json'
Dec 28 19:58:47 raspberrypi snips-nlu[2940]: -> caused by: Expected model version 0.16.0 but found 0.17.0
Dec 28 19:58:47 raspberrypi systemd[1]: snips-nlu.service: main process exited, code=exited, status=1/FAILURE
Dec 28 19:58:47 raspberrypi systemd[1]: Unit snips-nlu.service entered failed state.

This is the contents of /usr/share/snips/assistant/nlu_engine/nlu_engine.json:

{
  "builtin_entity_parser": "builtin_entity_parser", 
  "config": {
    "intent_parsers_configs": [
      {
        "max_pattern_length": 1000, 
        "max_queries": 100, 
        "unit_name": "deterministic_intent_parser"
      }, 
      {
        "intent_classifier_config": {
          "data_augmentation_config": {
            "add_builtin_entities_examples": false, 
            "min_utterances": 20, 
            "noise_factor": 5, 
            "unknown_word_prob": 0.2, 
            "unknown_words_replacement_string": "unknownword"
          }, 
          "featurizer_config": {
            "pvalue_threshold": 0.4, 
            "sublinear_tf": false, 
            "use_stemming": false, 
            "word_clusters_name": null
          }, 
          "random_seed": null, 
          "unit_name": "log_reg_intent_classifier"
        }, 
        "slot_filler_config": {
          "crf_args": {
            "algorithm": "lbfgs", 
            "c1": 0.1, 
            "c2": 0.1
          }, 
          "data_augmentation_config": {
            "add_builtin_entities_examples": false, 
            "capitalization_ratio": 0, 
            "min_utterances": 200
          }, 
          "feature_factory_configs": [
            {
              "args": {
                "common_words_gazetteer_name": "top_10000_words_stemmed", 
                "n": 1, 
                "use_stemming": true
              }, 
              "factory_name": "ngram", 
              "offsets": [
                -2, 
                -1, 
                0, 
                1, 
                2
              ]
            }, 
            {
              "args": {
                "common_words_gazetteer_name": "top_10000_words_stemmed", 
                "n": 2, 
                "use_stemming": true
              }, 
              "factory_name": "ngram", 
              "offsets": [
                -2, 
                1
              ]
            }, 
            {
              "args": {}, 
              "factory_name": "is_digit", 
              "offsets": [
                -1, 
                0, 
                1
              ]
            }, 
            {
              "args": {}, 
              "factory_name": "is_first", 
              "offsets": [
                -2, 
                -1, 
                0
              ]
            }, 
            {
              "args": {}, 
              "factory_name": "is_last", 
              "offsets": [
                0, 
                1, 
                2
              ]
            }, 
            {
              "args": {
                "tagging_scheme_code": 2, 
                "use_stemming": true
              }, 
              "drop_out": 0.1, 
              "factory_name": "entity_match", 
              "offsets": [
                -2, 
                -1, 
                0
              ]
            }, 
            {
              "args": {
                "tagging_scheme_code": 1
              }, 
              "factory_name": "builtin_entity_match", 
              "offsets": [
                -2, 
                -1, 
                0
              ]
            }, 
            {
              "args": {
                "cluster_name": "brown_clusters", 
                "use_stemming": false
              }, 
              "factory_name": "word_cluster", 
              "offsets": [
                -2, 
                -1, 
                0, 
                1
              ]
            }
          ], 
          "random_seed": null, 
          "tagging_scheme": 1, 
          "unit_name": "crf_slot_filler"
        }, 
        "unit_name": "probabilistic_intent_parser"
      }
    ], 
    "unit_name": "nlu_engine"
  }, 
  "custom_entity_parser": "custom_entity_parser", 
  "dataset_metadata": {
    "entities": {
      "color": {
        "automatically_extensible": false
      }, 
      "house_room": {
        "automatically_extensible": false
      }, 
      "philips_scene": {
        "automatically_extensible": false
      }
    }, 
    "language_code": "en", 
    "slot_name_mappings": {
      "setBrightness": {
        "house_room": "house_room", 
        "percent": "snips/percentage"
      }, 
      "setColor": {
        "color": "color", 
        "house_room": "house_room"
      }, 
      "setScene": {
        "house_room": "house_room", 
        "scene": "philips_scene"
      }, 
      "shiftDown": {
        "house_room": "house_room", 
        "percent": "snips/percentage"
      }, 
      "shiftUp": {
        "house_room": "house_room", 
        "percent": "snips/percentage"
      }, 
      "turnOff": {
        "house_room": "house_room"
      }, 
      "turnOn": {
        "house_room": "house_room"
      }
    }
  }, 
  "intent_parsers": [
    "deterministic_intent_parser", 
    "probabilistic_intent_parser"
  ], 
  "model_version": "0.17.0", 
  "training_package_version": "0.17.4", 
  "unit_name": "nlu_engine"
}

I have tried running sam update and sam update-assistant but it does not help. I can't find anywhere to select a version number on https://console.snips.ai/, so I'm not really sure how to make this work now.

adrienball commented 5 years ago

Hi @ollyhayes , This problem is related to the Snips Platform, and not directly Snips NLU. You should probably ask your question on the dedicated forum --> https://forum.snips.ai/

Having said this, as the error suggests, the problem comes from the fact that your version of the snips platform is outdated. Normally, this should be fixed by running sam update platform (cf https://docs.snips.ai/additional-resources/release-notes#updating-the-platform). Cheers

ollyhayes commented 5 years ago

Ah sorry, didn't realise there was a forum, I'll use that in the future. Thanks for you're help, I'll try it out later.