Rasa NLU model loading takes significant amount of time

Hi,

I am using rasa nlu alone for my usecase. I am training the rasa model using rasa.nlu.model.Trainer and loading the model using rasa.nlu.model.Interpreter . I have 5+ different nlu models.

I have below issues,

  1. Model loading takes nearly 35 to 40 secs. So for 5 models, its 200 secs. I would like to load model faster.
  2. So, i planned to dump using pickle. And tried to load. In that case i am getting the following error.

TypeError: can’t pickle _thread.RLock objects

i am using Rasa 1.5.3.

Any help would be highly appreciated. Thanks in advance

@seenimhd are you loading all the models in one server? And how big are your models?

Hi @akelad,

Thank you for the reply

are you loading all the models in one server?

Yea, I am trying to.

And how big are your models

Each model will have 2 to 3 intents with 10 to 15 examples each.

Rasa isn’t designed to load multiple models at one time though, each model should have a different server running. Right, I suspect you’re maybe using spacy in your pipeline? That takes a little longer to load. However, is the loading time a big issue? Because that should only need to be done once on startup

1 Like

Yea, we are using spacy. We are using flask framework, which doesn’t hold rasa model in global level. Anyway, thanks for the reply.

Why can’t able to dump the rasa nlu model?

What do you mean by dump the model?

I am trying to dump the rasa.nlu.model.Interpreter as serialised object using pickle/joblib.

This is how our models are persisted anyways. For example: rasa/sklearn_intent_classifier.py at master · RasaHQ/rasa · GitHub