Command Line Interface

Cheat Sheet

Command Effect
rasa init Creates a new project with example training data, actions, and config files.
rasa train Trains a model using your NLU data and stories, saves trained model in ./models.
rasa interactive Starts an interactive learning session to create new training data by chatting to your assistant.
rasa shell Loads your trained model and lets you talk to your assistant on the command line.
rasa run Starts a server with your trained model.
rasa run actions Starts an action server using the Rasa SDK.
rasa visualize Generates a visual representation of your stories.
rasa test Tests a trained Rasa model on any files starting with test_.
rasa data split nlu Performs a 80/20 split of your NLU training data.
rasa data convert Converts training data between different formats.
rasa data validate Checks the domain, NLU and conversation data for inconsistencies.
rasa export Exports conversations from a tracker store to an event broker.
rasa x Launches Rasa X in local mode.
rasa -h Shows all available commands.

rasa init

This command sets up a complete assistant for you with some example training data:

rasa init

It creates the following files:

.
├── actions
│   ├── __init__.py
│   └── actions.py
├── config.yml
├── credentials.yml
├── data
│   ├── nlu.yml
│   └── stories.yml
├── domain.yml
├── endpoints.yml
├── models
│   └── <timestamp>.tar.gz
└── tests
    └── test_stories.yml

It will ask you if you want to train an initial model using this data. If you answer no, the models directory will be empty.

rasa train

The following command trains a Rasa Open Source model:

rasa train

If you have existing models in your directory (under models/ by default), only the parts of your model that have changed will be re-trained. For example, if you edit your NLU training data and nothing else, only the NLU part will be trained.

If you want to train an NLU or dialogue model individually, you can run rasa train nlu or rasa train core. If you provide training data only for one one of these, rasa train will fall back to one of these commands by default.

rasa train will store the trained model in the directory defined by --out, models/ by default. The name of the model by default is <timestamp>.tar.gz. If you want to name your model differently, you can specify the name using the --fixed-model-name flag.

The following arguments can be used to configure the training process:

usage: rasa train [-h] [-v] [-vv] [--quiet] [--data DATA [DATA ...]]
                  [-c CONFIG] [-d DOMAIN] [--out OUT] [--dry-run]
                  [--augmentation AUGMENTATION] [--debug-plots]
                  [--num-threads NUM_THREADS]
                  [--fixed-model-name FIXED_MODEL_NAME] [--persist-nlu-data]
                  [--force] [--finetune [FINETUNE]]
                  [--epoch-fraction EPOCH_FRACTION] {core,nlu} ...

Incremental training

New in 2.2

This feature is experimental. We introduce experimental features to get feedback from our community, so we encourage you to try it out! However, the functionality might be changed or removed in the future.

In order to improve the performance of an assistant, it's helpful to practice CDD and add new training examples based on how your users have talked to your assistant. You can use rasa train --finetune to initialize the pipeline with an already trained model and further finetune it on the new training dataset that includes the additional training examples. This will help reduce the training time of the new model.

By default, the command picks up the latest model in the models/ directory. If you have a specific model which you want to improve, you may specify the path to this by running rasa train --finetune <path to model to finetune>. Finetuning a model usually requires fewer epochs to train machine learning components like DIETClassifier, ResponseSelector and TEDPolicy compared to training from scratch. Either use a model configuration for finetuning which defines fewer epochs than before or use the flag --epoch-fraction. --epoch-fraction will use a fraction of the epochs specified for each machine learning component in the model configuration file. For example, if DIETClassifier is configured to use 100 epochs, specifying --epoch-fraction 0.5 will only use 50 epochs for finetuning.

You can also finetune an NLU-only or dialogue management-only model by using rasa train nlu --finetune and rasa train core --finetune respectively.

rasa interactive

You can use Rasa X in local mode to do interactive learning in a UI, check out the docs for more details.

If you'd rather use the command line, you can start an interactive learning session by running:

rasa interactive

This will first train a model and then start an interactive shell session. You can then correct your assistants predictions as you talk to it.

rasa shell

You can use Rasa X in local mode to talk to your assistant in a UI. Check out the Rasa X docs for more details.

If you'd rather use the command line, you can start a chat session by running:

rasa shell

By default this will load up the latest trained model. You can specify a different model to be loaded by using the --model flag.