Hello everyone
I am trying to create a chatbot with the help of Sumit Raj’s book building chatbots with python. I’m a masterstudent and need to build a chatbot for my masterthesis. Right now I’m facing two problems with the horoscope bot I want to reconstruct. In his train_initialyze.py file with the following code:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.policies.sklearn_policy import SklearnPolicy
if __name__ == '__main__':
utils.configure_colored_logging(loglevel="DEBUG")
training_data_file = './data/stories.md'
model_path = './models/dialogue'
agent = Agent("horoscope_domain.yml",
policies=[MemoizationPolicy(), KerasPolicy()])
training_data = agent.load_data(training_data_file)
agent.train(
training_data,
augmentation_factor=50,
epochs=500,
batch_size=10,
validation_split=0.2
)
agent.persist(model_path)
Here I get the following error code: “Passing policy configuration parameters to agent.train(...)
is not supported anymore. Specify parameters directly in the policy configuration instead.”
But I don’t how to write a policy configuration with the above input.
But the more severe error that prevents me from moving on is located in the train_online.py:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from rasa_core import utils, train
from rasa_core.training import online
from rasa_core.interpreter import NaturalLanguageInterpreter
logger = logging.getLogger(__name__)
def train_agent(interpreter):
return train.train_dialog_model(domain_file="horoscope_domain.yml",
stories_file="data/stories.md",
output_path="models/dialog",
nlu_model_path=interpreter,
endpoints="endpoints.yml",
max_history=2,
kwargs={"batch_size": 50,
"epochs": 200,
"max_training_samples": 300
})
if __name__ == '__main__':
utils.configure_colored_logging(loglevel="DEBUG")
nlu_model_path = "./models/nlu/default/horoscopebot"
interpreter = NaturalLanguageInterpreter.create(nlu_model_path)
agent = train_agent(interpreter)
online.serve_agent(agent)
Here the following error code is displayed: " from rasa_core.training import online ImportError: cannot import name ‘online’ from ‘rasa_core.training’ (C:\Users\tobia\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa_core\training_init_.py)"
Can somebody tell me, how to get rid of these errors? Help would be highly appreciated.
I’m using the following versions:
spacy==2.2.3 rasa-core==0.14.5 rasa-core-sdk==0.11.0 rasa-nlu==0.15.1 tensorflow==1.13.2 tensorflow-estimator==1.13.0 and python 3.7.6
Thank you for your help!!