Skip to content

Instantly share code, notes, and snippets.

@imohitmayank
Last active March 23, 2021 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imohitmayank/0c363d0db3c5fe643ad367daad00d0cf to your computer and use it in GitHub Desktop.
Save imohitmayank/0c363d0db3c5fe643ad367daad00d0cf to your computer and use it in GitHub Desktop.
rasa_starter/train_nlu.py
# Imports
#-----------
# rasa nlu
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config
from rasa_nlu.model import Metadata, Interpreter
# Functions
#------------
def train (data, config_file, model_dir):
training_data = load_data(data)
trainer = Trainer(config.load(config_file))
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name = 'chat')
# Training
#------------
train('data/nlu_train.md', 'nlu_config.yml', 'models/nlu')
@sandeepthetechie
Copy link

the train() function which is being called is not being closed. which will lead to an error.

@imohitmayank
Copy link
Author

@sandeepthetechie thnx for pointing it out. Modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment