How to train nlu on latest master, with the new 'rasa' entrypoint

Hello!

With The Big Refactor, how does one train the core and nlu model?

For the simple greet bot example, this command-line works:

python -m rasa train core -s projects/stories.md -d projects/domain.yml -o ./models --config projects/core_config.yml

but this doesn’t work: python -m rasa train -o ./models -c projects/nlu_config.yml -vv --domain projects/domain.yml --data projects/nlu.md nlu

because --data argument seems to be ignored.

@Tanja seems to be the last person to commit into rasa/rasa/cli/train.py at master · RasaHQ/rasa · GitHub

Could you give an example of a command-line to train the NLU model?

Thanks, Alexis

Hi @alexissmirnov,

to specify the nlu data you need to use the -u argument. To see all available arguments run rasa train nlu --help.

Example:

python -m rasa train nlu -o ./models -c projects/nlu_config.yml --domain projects/domain.yml --u projects/nlu.md -vv

Thank you! Works.

How would one run the rasa shell with both core and NLU models?

python -m rasa shell -h doesn’t seem to mention it, and

python -m rasa shell -m ./models/core-20190425-090315.tar.gz only loads the core model

python -m rasa shell -m ./models/core-20190425-090315.tar.gz ./models/nlu-20190425-115717.tar.gz seems to only load the NLU model

You have to train a stack model via rasa train (no core or nlu arg) – then rasa shell will load and run the trained full model.

Ok, but how would I pass the stories.md and nlu.md files into rasa train command line? When i run:

python -m rasa train -o ./models/ -c ./projects/nlu_config.yml -d ./projects/domain.yml --data ./projects/stories.md -u ./projects/nlu.md

without core or nlu arguments, it returns

rasa train: error: invalid choice: './projects/nlu.md' (choose from 'core', 'nlu')

Can you put both files in a data folder and pass that to the data flag? I can’t check at the moment but I think both go to the -data argument, with no -u argument. You’ll also want a combined (policies and pipeline) config for the config flag.

Yes I can put both stories.md an nlu.md into -d argument like so:

python -m rasa train -o ./models -c ./projects/config.yml -d ./projects/domain.yml --data ./projects/nlu.md ./projects/stories.md

But i get this log message:

2019-04-25 12:36:08 WARNING  rasa.core.training.generator  - There is no starting story block in the training data. All your story blocks start with some checkpoint. There should be at least one story block that starts without any checkpoint.
2019-04-25 12:36:08 INFO     rasa.core.policies.ensemble  - Skipped training, because there are no training samples.

And then later

2019-04-25 12:36:09 WARNING  rasa.nlu.classifiers.sklearn_intent_classifier  - Can not train an intent classifier. Need at least 2 different classes. Skipping training of intent classifier.

The model is indeed being written out, but shell won’t start when this model is provided via -m argument

And what happens if you put them both into a folder together and pass the folder? You shouldn’t have to include python -m either

That seems to work – this is what I found in /rasa/examples/moodbot and that works

Awesome, then you get it running successfully with shell?

Yes! In /rasa/examples/moodbot :
training works: python -m rasa train -d domain.yml -c config.yml -o models shell works: python -m rasa shell -m models

So defaults work, but I guess the that’s where the issue is with the --data argument taking multiple models

As a side note @erohmensing do I need to restart the shell every time I train a model, or is RASA smart enough to use the new model without a restart to rasa shell?

rasa shell starts a server, so any new changes after the server runs won’t get updated. You’ll have to restart the shell to get any new changes including a newly trained model. This isn’t really a question of it being “smart enough”, it’s about your currently running server not breaking when you change things.