This repository has been archived by the owner on Aug 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1510 from RasaHQ/update_examples
Update examples
- Loading branch information
Showing
11 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
policies: | ||
- name: KerasPolicy | ||
epochs: 200 | ||
batch_size: 50 | ||
max_training_samples: 300 | ||
- name: FallbackPolicy | ||
- name: MemoizationPolicy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
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 import train, utils | ||
|
||
if __name__ == '__main__': | ||
utils.configure_colored_logging(loglevel="INFO") | ||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
training_data_file = 'data/stories.md' | ||
model_path = 'models/dialogue' | ||
|
||
agent = Agent("domain.yml", | ||
policies=[MemoizationPolicy(), KerasPolicy()]) | ||
def train_dialogue(domain_file='domain.yml', | ||
stories_file='data/stories.md', | ||
model_path='models/dialogue', | ||
policy_config='policy_config.yml'): | ||
return train.train_dialogue_model(domain_file=domain_file, | ||
stories_file=stories_file, | ||
output_path=model_path, | ||
policy_config=policy_config, | ||
kwargs={'augmentation_factor': 50, | ||
'validation_split': 0.2} | ||
) | ||
|
||
training_data = agent.load_data(training_data_file) | ||
|
||
agent.train( | ||
training_data, | ||
augmentation_factor=50, | ||
epochs=500, | ||
batch_size=10, | ||
validation_split=0.2 | ||
) | ||
if __name__ == '__main__': | ||
train_dialogue() | ||
|
||
agent.persist(model_path) | ||
utils.configure_colored_logging(loglevel="INFO") | ||
logger.info("This example does not include NLU data." | ||
"Please specify the desired intent with a preceding '/', e.g." | ||
"'/greet' .") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
user: "your_bot_user" | ||
password: "you_bot_pass" | ||
server_url: "localhost:3000" | ||
ssl: false | ||
rocketchat: | ||
user: "your_bot_user" | ||
password: "you_bot_pass" | ||
server_url: "localhost:3000" | ||
ssl: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters