-
Notifications
You must be signed in to change notification settings - Fork 13
/
train_init.py
29 lines (22 loc) · 901 Bytes
/
train_init.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
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.featurizers import (MaxHistoryTrackerFeaturizer, BinarySingleStateFeaturizer)
if __name__ == '__main__':
logging.basicConfig(level='INFO')
training_data_file = './data/stories.md'
model_path = './models/dialogue'
featurizer = MaxHistoryTrackerFeaturizer(BinarySingleStateFeaturizer(), max_history=5)
agent = Agent('restaurant_domain.yml', policies = [MemoizationPolicy(max_history = 4), KerasPolicy(featurizer)])
agent.train(
training_data_file,
augmentation_factor = 50,
#max_history = 4,
epochs = 500,
batch_size = 30,
validation_split = 0.2)
agent.persist(model_path)