# Metadata not found when using Rasa NLU from Python

**URL:** <https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909>\
**Category:** Rasa Open Source\
**Created:** [June 22, 2019, 7:29am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909 "2019-06-22T07:29:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![atilio](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@atilio](https://forum.rasa.com/u/atilio)\
**Post date:** [June 22, 2019, 7:29am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/1 "2019-06-22T07:29:00Z")

</div>

Hi there.

I’m trying to load a model using Python 3.7 and Rasa 1.1.4 in the following way:

> ```
> from rasa.nlu.model import Interpreter
> interpreter = Interpreter.load("./models/generic")
> 
> ```

The following error happens:

> ```
> FileNotFoundError:
> [Errno 2] No such file or directory: './models/generic/metadata.json'
> 
> ```

The model has been trained with the following command:

> ```
> rasa train nlu --config config.yml
> --nlu data/generic.md
> --out models
> --fixed-model-name generic/model
> 
> ```

Which only produces the following file, no metadata file has been generated:

> ```
> models/generic/model.tar.gz
> 
> ```

What is the best step forward? Generate the metadata file, load the model differently?

Thanks

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 24, 2019, 5:06am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/2 "2019-06-24T05:06:24Z")

</div>

Hi @atilio

@erohmensing correct me if I am wrong here, but the Interpreter tries to load the model with a deprecated style. Before Rasa 1.0, a model was separated by Core and NLU hence the metadata.json was placed inside the coresponding folder.

I already expressed the suspicion that the pogrammatical code is not up to date in that area but I am not quite sure.

Regards

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [June 24, 2019, 11:56am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/3 "2019-06-24T11:56:17Z")

</div>

Hm, I think what’s wrong here is that you’re not pointing to the model correctly: You’re training to the output folder/tar `models/generic/model` but then trying to load from `models/generic`. The metadata should be in there inside the tar file, it’s essentially a zipped dir. But I’m not 100% sure about how `Interpreter.load()` is getting the files. Can you try

```auto
interpreter = Interpreter.load("./models/generic/model")

```

---

<div class="post-metadata">

**Author:** ![atilio](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@atilio](https://forum.rasa.com/u/atilio)\
**Post date:** [June 25, 2019, 2:49am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/4 "2019-06-25T02:49:56Z")

</div>

Hi Julian, there used to be a programmatical example to load the model on previous versions of Rasa. These instructions worked ok by then, training the model using command line tools and loading the model with a snippet of Python.

I’m now using the latest for both, command line tools and Python snippet, but the latest is a guess since there is no longer a programmatical example in the docs.

I’m also not sure as I’m not a Python programmer, but taking a look at rasa/nlu/model.py suggests I’m doing the right thing.

---

<div class="post-metadata">

**Author:** ![atilio](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@atilio](https://forum.rasa.com/u/atilio)\
**Post date:** [June 25, 2019, 2:52am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/5 "2019-06-25T02:52:57Z")

</div>

Hi @erohmensing, I’ve tried many ways but they all result in the same error. `Interpreter.load()` always considers the input parameter to be a folder, even if I specify a file.

For example, all of these behave in the same way:

`Interpreter.load("./models/generic")`

`Interpreter.load("./models/generic/model")`

`Interpreter.load("./models/generic/model.tar.gz")`

When a folder is specified the error is about not finding `metadata.json`. When a file is specified the error is about the path not being a folder.

---

<div class="post-metadata">

**Author:** ![atilio](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@atilio](https://forum.rasa.com/u/atilio)\
**Post date:** [June 25, 2019, 3:02am UTC](https://forum.rasa.com/t/metadata-not-found-when-using-rasa-nlu-from-python/11909/6 "2019-06-25T03:02:04Z")

</div>

I’ve found a way to make it work, which is by extracting all of the files from `model.tar.gz`. For example:

`Interpreter.load("./models/generic")`

If I only extract `metadata.json` it fails due to other files being required, which are mentioned in `metadata.json`.

Based on your comment @erohmensing, apparently folders and `tar.gz` files are no longer interchangeable when loading a model.
