Trying to get started! nlu_model problem

Hello. I am completly new in this Topic. I was trying to get started with the Rasa Stack with the Video: YouTube . Sadly there have been changes in the nlu_model.py file. I tryed the old Version as seen in the Video such as the new one. Sadly it won’t work for me.

This is my nlu_model.py file: from rasa_nlu.training_data import load_data

from rasa_nlu import config

from rasa_nlu.model import Trainer

def train_nlu(data, config, model_dir):

training_data = load_data(data)

trainer = Trainer(config.load(configs))

trainer.train(training_data)

model_directory = trainer.persist(model_dir, fixed_model_name = ‘weathernlu’)

if name == ‘main’:

train_nlu(’./data/data.json’, ‘config_spacy.json’, ‘./models/nlu’)

and this is my Shell Output: C:\Users\Yannic\Documents\Waetherbot>python nlu_model.py Traceback (most recent call last): File “nlu_model.py”, line 12, in train_nlu(’./data/data.json’, ‘config_spacy.json’, ‘./models/nlu’) File “nlu_model.py”, line 7, in train_nlu trainer = Trainer(config.load(configs)) AttributeError: ‘str’ object has no attribute ‘load’

I really hope i can get some help.

config is a module imported from rasa_nlu , however you are shadowing it with the parameter config in the function. I think you meant to name your function parameter configs .

from rasa_nlu.training_data import load_data from rasa_nlu import config from rasa_nlu.model import Trainer

def train_nlu(data, configs, model_dir): training_data = load_data(data) trainer = Trainer(config.load(configs)) trainer.train(training_data) model_directory = trainer.persist(model_dir, fixed_model_name = ‘weathernlu’)

if name == ‘main’: train_nlu(‘./data/data.json’, ‘config_spacy.json’, ‘./models/nlu’) This is the solution i got . Credits to DobromirM

Thanks for posting the solution to your problem as well!