Metadata not found when using Rasa NLU from Python

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:

[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/
               --out models
               --fixed-model-name generic/model

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


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


1 Like

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.


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

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

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/ suggests I’m doing the right thing.

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:




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.

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


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.

1 Like