We can use the command rasa train to train a Rasa model that combines a Rasa NLU and a Rasa Core model. If we use the command rasa train nlu and rasa train core to train nlu model and core model separately, how to combine those models into one model?
Many thanks.
If you train your NLU and Core model separately, you will have two tar.gz files. You need to unpack them and combine them manually:
Unpack the NLU tar.gz model file. Inside the unpacked folder you will find a nlu folder and a fingerprint.json
Unpack the Core tar.gz model file. Inside the unpacked folder you will find a core folder and a fingerprint.json
Create a new folder combined-model (name it as you like)
Move the nlu and the core folder inside the new folder combined-model
Combine the fingerprint.json files - you need to update the domain, messages, and stories key. Move the combined file also into the new folder combined-model
Zip the new folder combined-model, so that you have a combined-model.tar.gz file
You can use combined-model.tar.gz as combined Rasa model.
there is a problem in 2.x with combining models that were trained separately right now. If nlu exists, rasa core will use its components to featurize intent and action labels.
So when you call rasa train core there is no nlu model, and it creates one-hot features for labels, however, when you combine the models during prediction time, nlu interpreter will exist, and rasa core featurization will be different.
We’re working on the solution to make sure that core featurizer persist the information how they were trained and behave appropriately during prediction
I wonder the same but as I can see @Tanja post, it’s much harder and much more time consuming work than I initially though. I am currently working on a project where rasa train nlu consumes ~ 1 hour and rasa train core consumes ~ 3 minutes. By doing changes just on Core part of my project, I’m forced to unnecessarily waste ~ 1 hour on every single training via rasa train command. It would be AMAZING, if all these @Tanja steps were automatically done by new CLI command rasa train merge or something like this OR if you make a command rasa run to be able to automatically handle these 2 model files by default and if it would be necessary, I have to specify path to NLU and Core model files by rasa run --model-core models/core.tar.gz --model-nlu models/nlu.tar.gz or something like this.