Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add e2e docs #7512

Merged
merged 101 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
f556f9a
change TED default params
Ghostvv Dec 10, 2020
03b97d5
Update docs/docs/training-data-format.mdx
Ghostvv Dec 10, 2020
e7a401f
Update docs/docs/training-data-format.mdx
Ghostvv Dec 10, 2020
61e471d
Update docs/docs/training-data-format.mdx
Ghostvv Dec 10, 2020
343c006
update docs phrases
Ghostvv Dec 10, 2020
de86f23
break long line
Ghostvv Dec 10, 2020
e70a4a0
add changelog
Ghostvv Dec 10, 2020
2977825
add deprecation config for dense dimension
Ghostvv Dec 10, 2020
99d3208
Merge branch 'e2e' into e2e-docs
Ghostvv Dec 10, 2020
98f03fe
fix new config parameters
Ghostvv Dec 10, 2020
f09e37f
add comments for config params
Ghostvv Dec 10, 2020
6f40343
fix docstrings
Ghostvv Dec 10, 2020
909b2db
update comments
Ghostvv Dec 10, 2020
0eecb10
update migration guide with new ted parameters
Ghostvv Dec 10, 2020
4ccd1a1
update changelog
Ghostvv Dec 10, 2020
4f4ac6b
a lot of bug fixes regarding updating config
Ghostvv Dec 10, 2020
10b2036
fix updating config dict again
Ghostvv Dec 11, 2020
fb4eca7
Update docs/docs/training-data-format.mdx
Ghostvv Dec 11, 2020
bc2f5e3
remove new-old config param descriptions
Ghostvv Dec 11, 2020
e0633ee
Merge branch 'e2e-docs' of https://github.com/RasaHQ/rasa into e2e-docs
Ghostvv Dec 11, 2020
d8c2297
remove else
Ghostvv Dec 11, 2020
d2f3088
add docstring
Ghostvv Dec 11, 2020
08d49dd
update changelog
Ghostvv Dec 11, 2020
5b0d50a
Update docs/docs/stories.mdx
Ghostvv Dec 11, 2020
27c42f1
Update docs/docs/stories.mdx
Ghostvv Dec 11, 2020
542b403
Update docs/docs/training-data-format.mdx
Ghostvv Dec 11, 2020
3867f45
Update docs/docs/training-data-format.mdx
Ghostvv Dec 11, 2020
a1c9004
update stories.mdx
Ghostvv Dec 11, 2020
cc4380d
update training-data-format.mdx
Ghostvv Dec 11, 2020
36e53e6
substitute we with you
Ghostvv Dec 11, 2020
35aa6f0
don't include e2e in the stories example
Ghostvv Dec 11, 2020
2bafb9b
make list
Ghostvv Dec 11, 2020
88c54de
remove required
Ghostvv Dec 11, 2020
a5105c5
merge e2e
Ghostvv Dec 11, 2020
25b4fde
add migration guide for domain changes
wochinge Dec 11, 2020
97214a5
mention explicitly
Ghostvv Dec 11, 2020
cb89f36
Merge branch 'e2e-docs' of https://github.com/RasaHQ/rasa into e2e-docs
Ghostvv Dec 11, 2020
1aa7ce5
fix import
Ghostvv Dec 11, 2020
7c928fe
add link to ted policy
Ghostvv Dec 11, 2020
d19777a
add docstrings
Ghostvv Dec 11, 2020
18ea94b
fix updating config
Ghostvv Dec 11, 2020
091b246
move e2e into separate paragraph
Ghostvv Dec 14, 2020
91d112a
add blank line back
Ghostvv Dec 14, 2020
10eb13a
add increased train time note
Ghostvv Dec 14, 2020
c7d61ba
Update docs/docs/migration-guide.mdx
Ghostvv Dec 15, 2020
ab6e196
Update docs/docs/migration-guide.mdx
Ghostvv Dec 15, 2020
8be77a5
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
2397816
remove the link to the training data format page
Ghostvv Dec 15, 2020
bab28c6
remove the line'
Ghostvv Dec 15, 2020
e1f06a2
remove the line
Ghostvv Dec 15, 2020
ed70b01
break long line
Ghostvv Dec 15, 2020
662a183
Update changelog/7496.improvement.md
Ghostvv Dec 15, 2020
213cdb5
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
ff1a99e
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
ff936fe
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
6af1c87
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
02bd138
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
3d2c033
Update docs/docs/migration-guide.mdx
Ghostvv Dec 15, 2020
fccecf0
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
e0e5246
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
e4d5d9d
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
51cff11
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
22c050d
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
0b508b8
Update docs/docs/migration-guide.mdx
Ghostvv Dec 15, 2020
53bd1f0
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
2bf401a
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
d360f3b
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
2aabef9
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
d8aa78a
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
f803e17
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
09d5df8
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
4a6a29e
Update docs/docs/policies.mdx
Ghostvv Dec 15, 2020
4aa7e87
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
607528b
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
8e6dcac
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
a1b7d2f
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
00efdc6
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
2464968
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
4df90c7
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
3585e11
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
73839d5
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
c36745e
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
94052de
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
20d34ff
Update docs/docs/training-data-format.mdx
Ghostvv Dec 15, 2020
998ed42
Update docs/docs/migration-guide.mdx
Ghostvv Dec 15, 2020
ad5d313
add example to migration guide
Ghostvv Dec 15, 2020
6475f4b
remove notes
Ghostvv Dec 15, 2020
6dfe4bc
rename changelog to feature
Ghostvv Dec 15, 2020
b7e7c34
Update docs/docs/stories.mdx
Ghostvv Dec 15, 2020
d4d024f
expand explanation
Ghostvv Dec 15, 2020
6d18fea
update examples in docs to have the same topic as e2ebot
Ghostvv Dec 15, 2020
d3aadd3
copy ted description from diet
Ghostvv Dec 15, 2020
379ac86
update parameter description
Ghostvv Dec 15, 2020
b747396
fix overriding default config
Ghostvv Dec 15, 2020
0c2e20d
merge e2e
Ghostvv Dec 15, 2020
68fcd71
Update docs/docs/training-data-format.mdx
Ghostvv Dec 16, 2020
6bfdfb5
Update docs/docs/training-data-format.mdx
Ghostvv Dec 16, 2020
aafda9f
add actions to doc stories
Ghostvv Dec 16, 2020
be265b3
Merge branch 'e2e-docs' of https://github.com/RasaHQ/rasa into e2e-docs
Ghostvv Dec 16, 2020
78db38c
update story
Ghostvv Dec 16, 2020
b226995
more details in error message
m-vdb Dec 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ However, additional parameters exist that can be adapted.
+=================================+==================+==============================================================+
| hidden_layers_sizes | text: [] | Hidden layer sizes for layers before the embedding layers |
| | label: [] | for user messages and labels. The number of hidden layers is |
| | | equal to the length of the corresponding. |
| | | equal to the length of the corresponding list. |
+---------------------------------+------------------+--------------------------------------------------------------+
| share_hidden_layers | False | Whether to share the hidden layer weights between user |
| | | messages and labels. |
Expand Down
267 changes: 154 additions & 113 deletions docs/docs/policies.mdx

Large diffs are not rendered by default.

38 changes: 30 additions & 8 deletions docs/docs/stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ Here's an example of a dialogue in the Rasa story format:
stories:
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
- story: collect restaurant booking info # name of the story - just for debugging
steps:
- intent: greet # user message with no entities
- action: utter_ask_howcanhelp
- intent: inform # user message with no entities
- intent: greet # user message with no entities
- action: utter_ask_howcanhelp # action that the bot should execute
- intent: inform # user message with entities
entities:
- location: "rome"
- price: "cheap"
- action: utter_on_it # action that the bot should execute
- bot: On it # actual text that bot can output
- action: utter_ask_cuisine
- intent: inform
entities:
- cuisine: "spanish"
- user: I would like [spanish](cuisine). # actual text that user input
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
- action: utter_ask_num_people
```

Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
### User Messages

While writing stories, you do not have to deal with the specific contents of
While writing stories, you have two options.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

1) You do not have to deal with the specific contents of
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
the messages that the users send. Instead, you can take advantage of the output
from the NLU pipeline, which lets you use just the combination of an intent and
entities to refer to all the possible messages the users can send to mean the
Expand All @@ -45,6 +45,19 @@ to predict the next action based on a *combination* of both the intent and
entities (you can, however, change this behavior using the
[use_entities](./domain.mdx#ignoring-entities-for-certain-intents) attribute).

2) You do not have to deal with the specific
intents of the messages that are extracted by the NLU pipeline. Instead, you can simply put
the text of the user message.
We call it end-to-end training because actual text is used for predictions.

:::caution
This feature is experimental.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
We introduce experimental features to get feedback from our community, so we encourage you to try it out!
However, the functionality might be changed or removed in the future.
If you have feedback (positive or negative) please share it with us on the [Rasa Forum](https://forum.rasa.com).

:::

Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
### Actions

All actions executed by the bot, including [responses](./responses.mdx) are listed
Expand All @@ -54,6 +67,15 @@ You can use a response from your domain as an action by listing it as one
in a story. Similarly, you can indicate that a story should call a custom action by including
the name of the custom action from the `actions` list in your domain.

You can also put bot utterance directly in the stories.

:::caution
This feature is experimental.
We introduce experimental features to get feedback from our community, so we encourage you to try it out!
However, the functionality might be changed or removed in the future.
If you have feedback (positive or negative) please share it with us on the [Rasa Forum](https://forum.rasa.com).

:::
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

### Events

Expand Down
84 changes: 74 additions & 10 deletions docs/docs/training-data-format.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -380,26 +380,26 @@ stories:

Each step can be one of the following:

- A [user message](#user-messages), represented by **intent** and **entities**.
- An [or statement](#or-statement), which includes two or more user messages under it
- A bot [action](#actions)
- A [form](#forms)
- A [slot was set](#slots) event
- A [checkpoint](#checkpoints), which connects the story to another story
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
- A [user message](#user-messages), represented by **intent**, **entities** or **user**.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
- An [or statement](#or-statement), which includes two or more user messages under it.
- A bot [action](#actions), represented by **action** or **bot**.
- A [form](#forms).
- A [slot was set](#slots) event.
- A [checkpoint](#checkpoints), which connects the story to another story.


#### User Messages

All user messages are specified with the `intent:`
key and an optional `entities:` key.
User messages are specified with the `intent:`
key and an optional `entities:` key or with `user:` key.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

While writing stories, you do not have to deal with the specific
If you use `intent:` key while writing stories, you do not have to deal with the specific
contents of the messages that the users send. Instead, you can take
advantage of the output from the NLU pipeline, which uses
a combination of an intent and entities to refer to all possible
messages the users can send with the same meaning.

User messages follow the format:
These user messages follow the format:

```yaml-rasa
stories:
Expand Down Expand Up @@ -428,6 +428,41 @@ policies learn to predict the next action based on a *combination* of
both the intent and entities (you can, however, change this behavior
using the [`use_entities`](#entities) attribute).

If you use `user:` key while writing stories, you do not have to deal with the specific
intents of the messages that are extracted by the NLU pipeline. Instead, you can simply put
the text of the user message.
We call it end-to-end training because actual text is used for predictions.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

:::caution
This feature is experimental.
We introduce experimental features to get feedback from our community, so we encourage you to try it out!
However, the functionality might be changed or removed in the future.
If you have feedback (positive or negative) please share it with us on the [Rasa Forum](https://forum.rasa.com).

:::

These end-to-end user messages follow the format:

```yaml-rasa
stories:
- story: user message structure
steps:
- user: the actual text of the user message # Required
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
```

In addition, you can add entity tags that will be extracted by end-to-end policy.
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
The syntax for entity tags is the same as in
[the entities in the NLU training data](./training-data-format.mdx#entities)
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
For example, to represent the sentence
`I want to check my credit balance`, where `credit` is an entity:
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

```yaml-rasa {4}
stories:
- story: story with entities
steps:
- user: I want to check my [credit](account_type) balance
- action: action_credit_account_balance
```

#### Actions

Expand Down Expand Up @@ -458,6 +493,35 @@ stories:
- action: action_store_feedback
```

If you want to put bot utterance directly in the stories, use `bot:` key followed by
the text that you want your bot to say
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved

:::caution
This feature is experimental.
We introduce experimental features to get feedback from our community, so we encourage you to try it out!
However, the functionality might be changed or removed in the future.
If you have feedback (positive or negative) please share it with us on the [Rasa Forum](https://forum.rasa.com).

:::

Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
```yaml-rasa {5}
stories:
- story: story with an end-to-end response
steps:
- intent: greet
- bot: Hello
```

You can also have full end-to-end story:

```yaml-rasa {4-5}
stories:
- story: full end-to-end story
steps:
- user: Hello
- bot: Hello
```

Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
#### Forms


Expand Down
12 changes: 6 additions & 6 deletions rasa/core/policies/ted_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ class TEDPolicy(Policy):
CONCAT_DIMENSION: {TEXT: 128, ACTION_TEXT: 128, f"{LABEL}_{ACTION_TEXT}": 128},
ENCODING_DIMENSION: 50,
# Number of units in sequence transformer
TRANSFORMER_SIZE: 128,
f"{SEQUENCE}_{TRANSFORMER_SIZE}": 128,
# Number of sequence transformer layers
NUM_TRANSFORMER_LAYERS: 1,
f"{SEQUENCE}_{NUM_TRANSFORMER_LAYERS}": 1,
# Number of units in dialogue transformer
f"{DIALOGUE}_{TRANSFORMER_SIZE}": 128,
# Number of dialogue transformer layers
Expand Down Expand Up @@ -233,7 +233,7 @@ class TEDPolicy(Policy):
# Dropout rate for embedding layers of label, e.g. action, features.
DROP_RATE_LABEL: 0.0,
# Dropout rate for attention.
DROP_RATE_ATTENTION: 0,
DROP_RATE_ATTENTION: 0.0,
# Sparsity of the weights in dense layers
WEIGHT_SPARSITY: 0.8,
# If 'True' apply dropout to sparse input tensors
Expand Down Expand Up @@ -312,7 +312,7 @@ def _load_params(self, **kwargs: Dict[Text, Any]) -> None:
self.config = copy.deepcopy(self.defaults)
self.config.update(kwargs)

self.config = train_utils.check_deprecated_options(self.config)
self.config = train_utils.check_core_deprecated_options(self.config)

self.config = train_utils.update_similarity_type(self.config)
self.config = train_utils.update_evaluation_parameters(self.config)
Expand Down Expand Up @@ -850,13 +850,13 @@ def _prepare_layers(self) -> None:
for name in self.data_signature.keys():
self._prepare_sparse_dense_layer_for(name, self.data_signature)
if name in SEQUENCE_FEATURES_TO_ENCODE:
self._prepare_sequence_layers(name)
self._prepare_sequence_layers(name, prefix=SEQUENCE)
self._prepare_encoding_layers(name)

for name in self.label_signature.keys():
self._prepare_sparse_dense_layer_for(name, self.label_signature)
if name in SEQUENCE_FEATURES_TO_ENCODE:
self._prepare_sequence_layers(name)
self._prepare_sequence_layers(name, prefix=SEQUENCE)
self._prepare_encoding_layers(name)

self._prepare_transformer_layer(
Expand Down
16 changes: 13 additions & 3 deletions rasa/utils/tensorflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,22 @@ def _prepare_input_layers(self, name: Text) -> None:
prefix="concat_layer",
)

def _prepare_sequence_layers(self, name: Text) -> None:
def _prepare_sequence_layers(
self, name: Text, prefix: Optional[Text] = None
) -> None:
self._prepare_input_layers(name)

if prefix:
size_key = f"{prefix}_{TRANSFORMER_SIZE}"
num_layers_key = f"{prefix}_{NUM_TRANSFORMER_LAYERS}"
else:
size_key = TRANSFORMER_SIZE
num_layers_key = NUM_TRANSFORMER_LAYERS

self._prepare_transformer_layer(
name,
self.config[NUM_TRANSFORMER_LAYERS],
self.config[TRANSFORMER_SIZE],
self.config[num_layers_key],
self.config[size_key],
self.config[DROP_RATE],
self.config[DROP_RATE_ATTENTION],
)
Expand Down
25 changes: 25 additions & 0 deletions rasa/utils/train_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
AUTO,
INNER,
COSINE,
TRANSFORMER_SIZE,
NUM_TRANSFORMER_LAYERS,
)
from rasa.core.constants import DIALOGUE

if TYPE_CHECKING:
from rasa.nlu.classifiers.diet_classifier import EntityTagSpec
Expand Down Expand Up @@ -192,6 +195,28 @@ def check_deprecated_options(config: Dict[Text, Any]) -> Dict[Text, Any]:
return config


def check_core_deprecated_options(config: Dict[Text, Any]) -> Dict[Text, Any]:
"""
If old model configuration parameters are present in the provided config, replace
them with the new parameters and log a warning.
Args:
config: model configuration

Returns: updated model configuration
"""

# note: call _replace_deprecated_option() here when there are options to deprecate

config = _replace_deprecated_option(
TRANSFORMER_SIZE, f"{DIALOGUE}_{TRANSFORMER_SIZE}", config
)
config = _replace_deprecated_option(
NUM_TRANSFORMER_LAYERS, f"{DIALOGUE}_{NUM_TRANSFORMER_LAYERS}", config
)

return config


def entity_label_to_tags(
model_predictions: Dict[Text, Any],
entity_tag_specs: List["EntityTagSpec"],
Expand Down