Rasa Core version:0.13.0
Python version: Python 3.6.8
Operating system (windows, osx, ...): Ubuntu 16.04 LTS
Issue: rasa_nlu and rasa_core training error :-
INFO:rasa_nlu.training_data.loading:Training data format of nlu.md is md
INFO:rasa_nlu.training_data.training_data:Training data stats:
- intent examples: 188 (15 distinct intents)
- Found intents: 'about_OPP', 'city_name', 'OPP_Phones_Price', 'goodbye', 'CustomerCare_info', 'provide_founder', 'brand_info', 'mood_deny', 'greet', 'model_name_lookout', 'Official_Website', 'CEO_info', 'mood_affirm', 'Service_Center_OR_Factory', 'Opp_store_location'
- entity examples: 99 (7 distinct entities)
- found entities: 'workshop_location', 'shop_location', 'web_address', 'model', 'information', 'customer_location', 'PERSON'
DEBUG:rasa_nlu.training_data.training_data:Validating training data...
Traceback (most recent call last):
File "bot_enhancement_updated.py", line 53, in
trainer = Trainer(config.load('config_mitie_sklearn.yml'))
File "/home/arghya/anaconda3/envs/myenv/lib/python3.6/site-packages/rasa_core/config.py", line 22, in load
return PolicyEnsemble.from_dict(config_data)
File "/home/arghya/anaconda3/envs/myenv/lib/python3.6/site-packages/rasa_core/policies/ensemble.py", line 222, in from_dict
raise InvalidPolicyConfig("You didn't define any policies. "
rasa_core.policies.ensemble.InvalidPolicyConfig: You didn't define any policies. Please define them under 'policies:' in your policy configuration file.
Content of policy.yml
'''yaml
policies:
'''yaml
language: "en"
pipeline:
bot logic for rasa_nlu and rasa_core training :-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import warnings
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Interpreter, Trainer
from rasa_nlu import config
from rasa_nlu.training_data.loading import load_data_from_endpoint
from rasa_nlu.utils import EndpointConfig, read_endpoints
import rasa_core
from rasa_core import config, cli
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.run import AvailableEndpoints
from rasa_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy
from rasa_core.interpreter import NaturalLanguageInterpreter
from rasa_core.domain import Domain
from rasa_core.utils import EndpointConfig
from rasa_core.run import serve_application
from rasa_core.tracker_store import RedisTrackerStore
from rasa_core.tracker_store import MongoTrackerStore
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
warnings.filterwarnings('ignore')
##training nlu
global_fallback = FallbackPolicy(fallback_action_name='utter_unclear',
core_threshold=0.3,
nlu_threshold=0.8)
training_data = load_data('nlu.md')
trainer = Trainer(config.load('config_mitie_sklearn.yml'))
interpreter = trainer.train(training_data)
global_model_directory = trainer.persist('./models/nlu',
fixed_model_name='current')
domain = Domain.load('domain.yml')
global_db_mg = MongoTrackerStore(
domain,
host='mongodb://localhost:27017',
db='rasa',
username=None,
password=None,
collection='conversations',
event_broker=None,
)
def train_dialogue(
domain='domain.yml',
model_path='models/dialogue',
training_data_file='stories.md',
endpoints=AvailableEndpoints(),
policy_config=None,
):
policies = config.load('policy.yml')
nlu_interpreter = global_model_directory
endpoints = '/home/arghya/rasa_test/data/place_finder/endpoints.yml'
agent = Agent(
domain=domain,
policies=policies,
interpreter=nlu_interpreter,
generator=None,
tracker_store=global_db_mg,
action_endpoint=endpoints,
fingerprint=None,
)
data = agent.load_data(training_data_file)
agent.train(data, epochs=400, batch_size=50, validation_split=0.2)
agent.persist(model_path)
return agent
if __name__ == '__main__':
agent = train_dialogue()
rasa_core.run.serve_application(agent, channel='cmdline')
events = global_db_mg.retrieve('default').as_dialogue().events
for event in events:
print(event.as_story_string())
Content of domain file (if used & relevant):
The issue is with the training logic since policy.yml is available and configured and I am able to run rasa_nlu and rasa_core training using
1)python3 -m rasa_nlu.train -c config_mitie_sklearn.yml --fixed_model_name current --data nlu.md -o models --project nlu --verbose
2)python3 -m rasa_core.train -d domain.yml -s stories.md -c policy.yml --debug -o models/dialogue.
I have just upated the rasa_core version to 0.13.0 and not able to figure out how to pass the policy.yml for training.
Expert guidance is much appreciated.
Thanks for raising this issue, @erohmensing will get back to you about it soon.
Hi! What seems to be happening here is that when you call
trainer = Trainer(config.load('config_mitie_sklearn.yml'))
it's pulling config.load() from core, not nlu. This is because you have from rasa_nlu import config but this is overwritten by from rasa_core import config, cli. I think the easiest fix here would be to rename one of them, for example from rasa_nlu import config as nlu_config (and then use this name when you call the load function)
Hi @erohmensing , corrected the logical flaw.Thanks for the help.
Most helpful comment
Hi! What seems to be happening here is that when you call
it's pulling
config.load()from core, not nlu. This is because you havefrom rasa_nlu import configbut this is overwritten byfrom rasa_core import config, cli. I think the easiest fix here would be to rename one of them, for examplefrom rasa_nlu import config as nlu_config(and then use this name when you call the load function)