-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_all.py
54 lines (42 loc) · 1.59 KB
/
run_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import argparse
import logging
import rasa.core.run
from rasa.core.channels.console import CmdlineInput
from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.core.tracker_store import MongoTrackerStore
from rasa.core.training import interactive
from rasa.core.utils import EndpointConfig
logger = logging.getLogger(__name__)
def run(serve_forever=True):
interpreter = RasaNLUInterpreter("models/nlu")
agent = Agent.load("models/dialogue", interpreter=interpreter)
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
if serve_forever:
agent.handle_channels([CmdlineInput()])
return agent
def interactive_learning(serve_forever=True):
import logging
from rasa.core import utils, train
logger = logging.getLogger(__name__)
return train(domain_file="domain.yml",
output_path="model/dialogue",
policy_config = "config_nlu.yml",
kwargs={"batch_size": 50,
"epochs": 200,
"max_training_samples": 300
},
training_resource='data/stories.md')
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="debug log for development and production"
)
parser.add_argument("-d", "--debug", help="Set the logging level")
args = parser.parse_args()
if args == "debug":
logging.DEBUG = True
else:
logging.DEBUG = False
run()
# agent = interactive_learning()
# interactive.run_interactive_learning('data/stories.md')