Warning: This document is for an old version of Rasa Platform. The latest version is 0.17.1.

Training your ML Models Locally

Train Locally from a Rasa Platform Instance

If you would like to test test out a new NLU model, or just tweak some training parameters on your local machine, you have the option to retrieve the data straight from the running Rasa Platform instance. This lets you avoid having multiple copies of the same dataset which are difficult to keep in sync.

How do I do that?

The training process is similar to the one outlined in the Rasa NLU docs on training. Here, instead of specifying a local path to the training data with --data, you can use the data URL of your Rasa Platform instance with the --url parameter. Under the hood, Rasa NLU logs into the Rasa Platform, fetches the training data, temporarily saves it to a local file, and uses that for training.

If your Rasa Platform runs under https://platform-example.com, the URL you’re going to use is https://platform-example.com/api/default/data.json?api_token=<TOKEN>. Replace <TOKEN> with your personal API token. You can find your API token in the Platform under the NLU Training/Training Data tab (along with the command shown below). Have a look at the example below:

$ python -m rasa_nlu.train \
    --config sample_configs/config_spacy.yml \
    --url https://platform-example.com/api/default/data.json?api_token=<TOKEN> \
    --path projects


If you want to reproduce the Platform results, copy the config from the Model config page, save it to a .yml file and use that with the --config option.

Upload an NLU model to Rasa Platform

If you have trained a model locally and would like to try it out on Rasa Platform, you can simply create a zip file and send it to your Platform API. Enter the directory of your trained model, for example with cd models/nlu/default/model``models/dialogue and create a zip file called my_nlu_model.zip with

$ zip -r my_nlu_model.zip *

The next step is to send the model to Rasa Platform. If your Platform runs at https://platform-example.com/, the command looks like this:

$ curl -F "model=@my_nlu_model.zip" -H "filename: my_nlu_model.zip" https://platform-example.com/api/models/default/nlu?api_token=<TOKEN>


You can specify the filename in the filename header as in the example above. Everything before .zip will show up as your model name. If you don’t provide the filename header, the name of the file will be used.

The <TOKEN> is available in the NLU Training/Training Data tab in the command to pull data. If the upload is successful, your model will show up in the NLU model overview, where you can assign tags to it or mark it as active.