Rasa: No such file : models/nlu/default/current/metadata.json

Created on 15 May 2018  路  8Comments  路  Source: RasaHQ/rasa

Rasa Core version:

I have issues with pip and pip3 at the moment which impede me to find my Rasa Core version :

mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot/models/current$ pip list | grep rasa_core
Traceback (most recent call last):
  File "/home/mike/.local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal
mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot/models/current$ pip3 list | grep rasa_core
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Python version:

Python 3.5.2

Operating system: Linux

Issue:

I am at the very last step of the tutorial. I wanted to launch the bot but it didn't found the model metadata :

mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot$ python3 -m rasa_core.run -d models/dialogue -u models/nlu/default/current
/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. 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-05-15 17:23:11.209630: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rasa_nlu/model.py", line 56, in load
    with io.open(metadata_file, encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'models/nlu/default/current/metadata.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/run.py", line 151, in <module>
    cmdline_args.credentials)
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/run.py", line 130, in main
    agent = Agent.load(model_directory, nlu_model)
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/agent.py", line 62, in load
    _interpreter = NaturalLanguageInterpreter.create(interpreter)
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/interpreter.py", line 31, in create
    return RasaNLUInterpreter(model_directory=obj)
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/interpreter.py", line 219, in __init__
    self._load_interpreter()
  File "/usr/local/lib/python3.5/dist-packages/rasa_core/interpreter.py", line 238, in _load_interpreter
    os.environ))
  File "/usr/local/lib/python3.5/dist-packages/rasa_nlu/model.py", line 228, in load
    model_metadata = Metadata.load(model_dir)
  File "/usr/local/lib/python3.5/dist-packages/rasa_nlu/model.py", line 62, in load
    "from '{}'. {}".format(abspath, e))
rasa_nlu.model.InvalidProjectError: Failed to load model metadata from '/home/mike/Programing/Rasa_tutorial/moodbot/models/nlu/default/current/metadata.json'. [Errno 2] No such file or directory: 'models/nlu/default/current/metadata.json'
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7fb058161400>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 712, in __del__
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/c_api_util.py", line 31, in __init__
TypeError: 'NoneType' object is not callable

Content of domain file (if used & relevant):
domain.yml :

intents:
  - greet
  - goodbye
  - mood_affirm
  - mood_deny
  - mood_great
  - mood_unhappy

actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye

templates:
  utter_greet:
  - text: "Hey! How are you?"
    buttons:
    - title: "great"
      payload: "great"
    - title: "super sad"
      payload: "super sad"

  utter_cheer_up:
  - text: "Here is something to cheer you up:"
    image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_did_that_help:
  - text: "Did that help you?"

  utter_happy:
  - text: "Great carry on!"

  utter_goodbye:
  - text: "Bye"

Most helpful comment

@antoinecomp about why you didn't have that models/current/nlu folder:
to train the nlu model we use:

python -m rasa_nlu.train -c nlu_config.yml --data data/nlu_data.md -o models
--fixed_model_name nlu --project current --verbose

If you'd just copy pasted the above then maybe it wouldn't work since the options starting from
--fixed_model_name would be left out, and wouldnt report an error either. So make sure you've got that covered.

All 8 comments

How does the project structure within models/nlu/ look?

There is no /moodbot/models/nlu folder in my /moodbot/models folder. Are you talking about /moodbot/rasa_nlu ?

one step of the tutorial is
python -m rasa_nlu.train -c nlu_model_config.json --fixed_model_name current
which will train you a model and persist it to that folder. BUT this only works with Rasa NLU <= 0.11 (not withh 0.12, for the new NLU you'd need to use rasa core master).

Did you run above training command? If so please run python -c "import rasa_nlu; print rasa_nlu.__version__" to echo your rasa nlu version.

Ho, god, I do have 0.12.3. I'm going to search for the rasa core master. Do I have to do pip install rasa-core==0.9.0a3 ? I remember hearing there were problem while downloading it.

I just ran the command and I had this error message hosted here.

I did the command you gave, but don't one have to specify the data with -d data/*.md ?

Maybe I shall precise I had to use a virtualenv to cope with permission issues in order to install rasa-core. Maybe, according to this answer, would it be possible to install the package to the user folder:
python -m pip install --user rasa-core==0.9.0a3

Yet I still have the same error message that I had above

The problem is I don't have anything named /nlu in /models

mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot2/models$ ls
dialogue

which means I think it don't search in the good nlu model to run which is, to my mind /rasa_nlu I donwloaded before :

mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot2$ ls
data  domain.yml  envMoodbot2  models  nlu_model_config.json  rasa_nlu

So I looked for such a metadata.json file in it :

mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot2$ find rasa_nlu -name "metadata.json"
rasa_nlu/test_models/test_model_mitie/model_20170628-002704/metadata.json
rasa_nlu/test_models/test_model_mitie_sklearn/model_20170628-002712/metadata.json
rasa_nlu/test_models/test_model_spacy_sklearn/model_20170628-002705/metadata.json

Yet, when I tried it it told me :

(envMoodbot2) mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot2$ python -m rasa_core.run -d models/dialogue -u rasa_nlu/test_models/test_model_spacy_sklearn/model_20170628-002705/
/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. 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-05-17 10:45:01.482924: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/run.py", line 169, in <module>
    cmdline_args.credentials)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/run.py", line 148, in main
    agent = Agent.load(model_directory, nlu_model)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/agent.py", line 62, in load
    _interpreter = NaturalLanguageInterpreter.create(interpreter)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/interpreter.py", line 31, in create
    return RasaNLUInterpreter(model_directory=obj)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/interpreter.py", line 221, in __init__
    self._load_interpreter()
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_core/interpreter.py", line 237, in _load_interpreter
    self.interpreter = Interpreter.load(self.model_directory)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_nlu/model.py", line 272, in load
    Interpreter.ensure_model_compatibility(model_metadata)
  File "/home/mike/Programing/Rasa_tutorial/moodbot2/envMoodbot2/lib/python3.5/site-packages/rasa_nlu/model.py", line 264, in ensure_model_compatibility
    "".format(model_version, rasa_nlu.__version__))
rasa_nlu.model.UnsupportedModelError: The model version is to old to be loaded by this Rasa NLU instance. Either retrain the model, or run withan older version. Model version: 0.9.0a4 Instance version: 0.12.3

Yet this is another issue. I am thinking about closing this one and opening a new one if retraining don't work as far as I don't know how to change my model version.

ok seems you've opened a new issue so i'll close this

@antoinecomp about why you didn't have that models/current/nlu folder:
to train the nlu model we use:

python -m rasa_nlu.train -c nlu_config.yml --data data/nlu_data.md -o models
--fixed_model_name nlu --project current --verbose

If you'd just copy pasted the above then maybe it wouldn't work since the options starting from
--fixed_model_name would be left out, and wouldnt report an error either. So make sure you've got that covered.

Thanks @N1KN1M

Was this page helpful?
0 / 5 - 0 ratings