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

Adapted memoization policies for graph #9383

Merged
merged 49 commits into from
Sep 2, 2021

Conversation

twerkmeister
Copy link
Contributor

@twerkmeister twerkmeister commented Aug 17, 2021

Proposed changes:

important context: https://www.notion.so/rasa/Migrating-policies-to-the-new-model-architecture-819812d37d784e4d98347d74ea4844fc#369e558d39b74a5096081a0408c23665
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)

@twerkmeister twerkmeister marked this pull request as ready for review August 18, 2021 08:59
@twerkmeister twerkmeister requested review from a team, koernerfelicia and wochinge and removed request for a team August 18, 2021 08:59
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

Can we please also adapt the unit tests to the new GraphComponent versions of the policy? 🙌🏻

rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/memoization.py Show resolved Hide resolved
@twerkmeister twerkmeister requested a review from a team as a code owner August 18, 2021 13:36
rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
@wochinge
Copy link
Contributor

@twerkmeister Can we please also adapt the unit tests to the new GraphComponent versions of the policies? 🙌🏻

@twerkmeister
Copy link
Contributor Author

  1. Adjusted the unit tests
  2. Adjusted the load function to not load the config from disc, but didn't remove it entirely

@twerkmeister
Copy link
Contributor Author

should also fix #5786

rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
@@ -123,6 +126,7 @@ def __init__(
featurizer: Optional[TrackerFeaturizer] = None,
) -> None:
"""Constructs a new Policy object."""
self.config = config
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Suggested change
self.config = config
self._config = 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.

alright

Copy link
Contributor

Choose a reason for hiding this comment

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

@twerkmeister Seems this is still open?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes indeed, I didn't do it here because it would mean another 100+ line changes because it would ripple through all the policies. In Ted policy alone there are like 50 accesses to self.config. Let's do it in a focused, separate PR just after this to not clutter this one here?

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good 👍🏻

rasa/core/policies/policy.py Outdated Show resolved Hide resolved
rasa/core/policies/policy.py Outdated Show resolved Hide resolved
rasa/core/policies/ted_policy.py Show resolved Hide resolved
tests/core/test_policies.py Outdated Show resolved Hide resolved
tests/core/test_policies.py Show resolved Hide resolved
tests/core/test_policies.py Outdated Show resolved Hide resolved
tests/core/test_policies.py Outdated Show resolved Hide resolved
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.

Nice job 👍 especially with all the tests 🚀
Just a couple of small suggestions.

rasa/core/policies/memoization.py Outdated Show resolved Hide resolved
rasa/core/policies/policy.py Outdated Show resolved Hide resolved
rasa/core/policies/policy.py Show resolved Hide resolved
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.

🚀 🚀 🚀

@twerkmeister twerkmeister enabled auto-merge (squash) August 30, 2021 15:16
@twerkmeister twerkmeister enabled auto-merge (squash) August 31, 2021 07:16
@twerkmeister twerkmeister merged commit c0d2447 into main Sep 2, 2021
@twerkmeister twerkmeister deleted the 9344-memoization-graph-component branch September 2, 2021 12:35
aeshky added a commit that referenced this pull request Sep 6, 2021
…https://github.com/RasaHQ/rasa into 3.0-architecture-revamp/9330/NLUTrainingDataProvider

* '3.0-architecture-revamp/9330/NLUTrainingDataProvider' of https://github.com/RasaHQ/rasa:
  Ignore assessed vulnerabilities
  Adapted memoization policies for graph (#9383)
ErickGiffoni pushed a commit to FGA-GCES/rasa that referenced this pull request Sep 9, 2021
* Adapted memoization policies for graph

* Not persisting config anymore for graph policy components

* adjusted unit testing for memoization graph component

* Removed max history hack in ted policy

* Making sure policy config is used for initializing featurizers if necessary

* Added policy priority to ted policy default config

* Simplified policy test suites

* Persisting policy by default when training

* Only carrying over max_history from policy to featurizer for MaxHistoryTrackerFeaturizers

* Turned load fail logging to warning from info

* Removed compatibility code for old policy component types

* Removed metadata and persist abstract methods from policy class

* Joined all memoization policy tests

* Fixed delorean code
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.

Adapt MemoizationPolicy and AugmentedMemoizationPolicy to new GraphComponent interface
4 participants