Hi everyone - I wanted to make a little something to avoid going through terminal history / copying and pasting the commands to train nlu model, train core, and run the bot every time. I wrote a little bash script to make it more convenient! I figured I’d share it on here for anyone else who is looking for a little convenience boost.
This was much easier than trying to create a python file to do a similar thing. Feel free to adjust the actual training command parameters to your specific needs. I also added some color options for fun too. Enjoy!
#!/bin/bash
GREEN='\033[0;32m' #green color
BLUE='\033[0;34m' #blue color
CYAN='\033[0;36m' #cyan color
PURPLE='\033[0;35m' #purple color
NC='\033[0m' #no color
RED='\033[0;31m' # red color
echo -e "${BLUE}Hi there! What would you like to do? Please enter one of the following numbers.${NC}
1. train nlu
2. train core
3. run bot"
read input
if [[ $input == "1" || $input == "1" ]]; then
python -m rasa_nlu.train -c config.yml --data data/nlu_data -o models --fixed_model_name nlu_model --project current --verbose
elif [[ $input == "2" || $input == "2" ]]; then
python -m rasa_core.train -d domain.yml -s data/stories -o models/current/dialogue --epochs 300
elif [[ $input == "3" || $input == "3" ]]; then
python -m rasa_core.run -d models/current/dialogue -u models/current/nlu_model
else
echo -e "${RED}Error${NC}: invalid entry. Please run ./bot again and select 1, 2, or 3."
fi
Just navigate to your directory, type the command below, and thats it!
./bot