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 support for different recipes #10641

Merged
merged 79 commits into from
Feb 2, 2022
Merged

Conversation

tayfun
Copy link
Contributor

@tayfun tayfun commented Jan 6, 2022

Fixes #10473

Proposed changes:

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@tayfun
Copy link
Contributor Author

tayfun commented Jan 11, 2022

After removing autoconfigure module, following rename was done:

get_configuration => auto_configure
_auto_configure => complete_config

model_config = recipe.graph_config_for_recipe(
config, cli_par, training_type=training_type, is_finetuning=is_finetuning,
)
return model_config
Copy link
Contributor Author

@tayfun tayfun Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing tests to fail because shared is not supposed to import anything from outside (ie. recipes).

rasa.shared.utils.io.write_yaml(invalid, config_file)

with pytest.raises(YamlValidationException):
TrainingDataImporter.load_from_config(str(config_file))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test moved to tests/graph_components/validators/test_default_recipe_validator.py as auto-config is dependent on recipe and not importer.


config = autoconfig.get_configuration(str(config_file))

assert config == {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has been removed because importers will return empty dict without going through auto-config now on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other tests in this file have been moved to tests/engine/recipes/test_default_recipe.py because auto-config is recipe business.

@tayfun tayfun requested review from joejuzl and wochinge January 31, 2022 13:04
Support other recipe types.

This pull request also adds support for graph recipes, see details at
https://rasa.com/docs/rasa/model-configuration check Graph Recipes section.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can use an anchor link to go directly to that section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a new page not an anchor and I can't link to it because it's not live yet, docs check fails with dead link :D

We now support graph recipes in addition to the default recipe. What graph recipes provide is more powerful control over how execution graph schemas are built.
:::tip Default Recipe or Graph Recipe?

You will probably only need graph recipes if you're running ML experiments or ablation studies on an existing model. We recommend starting with the default recipe and for many applications that will be all that's needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ablation studies" feels a bit specific? (I had to google it 😁 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used the exact wording from @rctatman actually and I had to google it too :D I think it is good because it has the effect of warning against using graph recipes if the user is not too advanced.

docs/docs/graph-recipe.mdx Outdated Show resolved Hide resolved
if training_type == TrainingType.NLU:
core_target = None
else:
core_target = config.get("core_target", "select_prediction")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to fail fast rather than have a default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more inclined towards "fail-safe" rather than "fail-fast" but @ka-bu had a similar opinion on another line where if config file changes between Rasa reading it and auto-configuring that we should fail instead of warning the user. She has a comment on this pull request. I feel defensive programming is better here as this is also the default target for default recipe? We could also add a warning log as a sort of a trade off? Otherwise I can also fail it :) Not too strong on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just thinking from a user perspective:

  1. User decides to create a new graph recipe config.
  2. They forget to add the targets
  3. They get an error saying that component select_prediction or RegexMessageHandler does not exist in the schema.
  4. They assume they are missing a required component, when actually the just need to configure the targets to fit their components.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code to raise with a message if targets are missing.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2022

🚀 A preview of the docs have been deployed at the following URL: https://10641--rasahq-docs-rasa-v2.netlify.app/docs/rasa

@tayfun tayfun requested a review from joejuzl February 2, 2022 14:58
@tayfun tayfun enabled auto-merge (squash) February 2, 2022 15:00
@tayfun tayfun requested a review from ka-bu February 2, 2022 15:00
Copy link
Contributor

@joejuzl joejuzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🚀

@tayfun tayfun merged commit 6339856 into main Feb 2, 2022
@tayfun tayfun deleted the tayfun/10473-support-other-recipes branch February 2, 2022 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support other recipes - starting with graph
7 participants