Skip to content

Commit

Permalink
Merge branch 'master' into online-learning-scrip
Browse files Browse the repository at this point in the history
improved online learning script
  • Loading branch information
tmbo committed Oct 23, 2017
1 parent a1425e3 commit 1760a40
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rasa_core/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

import argparse
import logging

from builtins import str

from rasa_core.agent import Agent
from rasa_core.channels.console import ConsoleInputChannel
from rasa_core.interpreter import RasaNLUInterpreter, RegexInterpreter
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy

Expand Down Expand Up @@ -54,8 +57,7 @@ def create_argument_parser():
parser.add_argument(
'--online',
default=False,
action='store_const',
const=True,
action='store_true',
help="enable online training")
parser.add_argument(
'--augmentation',
Expand All @@ -66,16 +68,13 @@ def create_argument_parser():


def train_dialogue_model(domain_file, stories_file, output_path,
online, nlu_model_path, kwargs):
use_online_learning, nlu_model_path, kwargs):
agent = Agent(domain_file, policies=[MemoizationPolicy(), KerasPolicy()])

if online:
from rasa_core.channels.console import ConsoleInputChannel
from rasa_core.interpreter import RasaNLUInterpreter
if use_online_learning:
if nlu_model_path:
agent.interpreter = RasaNLUInterpreter(nlu_model_path)
else:
from rasa_core.interpreter import RegexInterpreter
agent.interpreter = RegexInterpreter()
agent.train_online(
stories_file,
Expand Down

0 comments on commit 1760a40

Please sign in to comment.