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

remove _warn_and_correct_transformer_size funct #10819

Closed

Conversation

emysdias
Copy link
Contributor

@emysdias emysdias commented Feb 6, 2022

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)

@emysdias emysdias requested review from a team and kedz and removed request for a team February 6, 2022 21:21
@CLAassistant
Copy link

CLAassistant commented Feb 6, 2022

CLA assistant check
All committers have signed the CLA.

@emysdias emysdias force-pushed the remove_warn_and_correct_transformer_size branch from d2b52a9 to 402ee76 Compare February 6, 2022 21:26
@emysdias emysdias marked this pull request as draft February 6, 2022 22:07
@emysdias emysdias marked this pull request as ready for review February 8, 2022 01:06
@emysdias emysdias marked this pull request as draft February 8, 2022 02:37
@emysdias emysdias force-pushed the remove_warn_and_correct_transformer_size branch from 7e77db2 to db5d282 Compare February 9, 2022 01:05
Co-authored-by: Washington <[email protected]>
@emysdias emysdias force-pushed the remove_warn_and_correct_transformer_size branch from db5d282 to 9db1876 Compare February 9, 2022 01:25
emysdias and others added 2 commits February 8, 2022 23:18
@emysdias emysdias marked this pull request as ready for review February 9, 2022 03:31
@emysdias
Copy link
Contributor Author

emysdias commented Feb 9, 2022

@jupyterjazz can you check later please? And I don't know why codeclimate failed if I didn't change these files :(

@jupyterjazz jupyterjazz requested review from jupyterjazz and removed request for kedz February 9, 2022 06:41
Copy link
Contributor

@jupyterjazz jupyterjazz left a comment

Choose a reason for hiding this comment

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

Good job 🚀 I'm not sure why codeclimate is failing. I'll look at it later, but before that we still need to change few things:

  • Add a changelog file. You can see how it's done here.
  • Update PR description and link the original issue there
  • After all these changes are done, we can work on a better testing.

@@ -414,7 +393,7 @@ def _check_config_params_when_transformer_enabled(self) -> None:
f"({self.retrieval_intent})" if self.retrieval_intent else ""
)
self._warn_about_transformer_and_hidden_layers_enabled(selector_name)
self._warn_and_correct_transformer_size(selector_name)
self.component_config[TRANSFORMER_SIZE] = DEFAULT_TRANSFORMER_SIZE
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this line here as the actual correction happens in _get_transformer_dimensions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for your suggestion, but when I delete this line, I get 1 failed test
Captura de tela de 2022-02-09 23-37-26
t

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and 4 errors in def test_sets_integer_transformer_size_when_needed, like this:
Captura de tela de 2022-02-09 23-54-16
Captura de tela de 2022-02-09 23-54-04
Captura de tela de 2022-02-09 23-53-56
Captura de tela de 2022-02-09 23-37-26

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 aware of the error. Tests fail because we don't modify self.component_config anymore so it keeps the old value. However this line still should be removed because correction happens in _get_transformer_dimensions. We just need to come up with a different way of testing it. You can experiment a bit if you want to figure this out yourself, but if you find yourself stuck just ping me and I'll give you some insights.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, thanks for the suggestions!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jupyterjazz I'm stuck hahaha I'm trying to do this issue with a friend, it was our first issue in Rasa, so we don't know how to fix this tests :(

Comment on lines 815 to 822
f"`{TRANSFORMER_SIZE}` is set to "
f"`{transformer_layers}` for "
f"{attribute}, but a positive size is required when using "
f"`{NUM_TRANSFORMER_LAYERS} > 0`. {attribute} will proceed, using "
f"`{TRANSFORMER_SIZE}={DEFAULT_TRANSFORMER_SIZE}`. "
f"Alternatively, specify a different value in the component's config.",
category=UserWarning,
)
Copy link
Contributor

@jupyterjazz jupyterjazz Feb 9, 2022

Choose a reason for hiding this comment

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

_get_transformer_dimensions can be called by three components ResponseSelector, DIETClassifier and TEDPolicy. Since we don't know which one is calling (although correction would only happen inside ResponseSelector because others have positive TRANSFORMER_SIZE by default) we should change the warning message.

Suggested change
f"`{TRANSFORMER_SIZE}` is set to "
f"`{transformer_layers}` for "
f"{attribute}, but a positive size is required when using "
f"`{NUM_TRANSFORMER_LAYERS} > 0`. {attribute} will proceed, using "
f"`{TRANSFORMER_SIZE}={DEFAULT_TRANSFORMER_SIZE}`. "
f"Alternatively, specify a different value in the component's config.",
category=UserWarning,
)
f"`{TRANSFORMER_SIZE}` is set to "
f"`{transformer_units}`, "
f"but a positive size is required when using "
f"`{NUM_TRANSFORMER_LAYERS} > 0`. We will proceed, using "
f"`{TRANSFORMER_SIZE}={DEFAULT_TRANSFORMER_SIZE}`. "
f"Alternatively, specify a different value in the component's config.",
category=UserWarning,
)

This way it's a bit non-specific but still understandable.

CHANGELOG.mdx Outdated
Comment on lines 26 to 28
### Miscellaneous internal changes
- [#10712](https://github.com/RasaHQ/rasa/issues/10712): remove _warn_and_correct_transformer_size function as it's not needed anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't directly edit CHANGELOG.mdx. Here's one example of a changelog file:
Screenshot from 2022-02-10 18-12-12
Please follow the instructions given here and create a similar file.

@@ -414,7 +393,7 @@ def _check_config_params_when_transformer_enabled(self) -> None:
f"({self.retrieval_intent})" if self.retrieval_intent else ""
)
self._warn_about_transformer_and_hidden_layers_enabled(selector_name)
self._warn_and_correct_transformer_size(selector_name)
self.component_config[TRANSFORMER_SIZE] = DEFAULT_TRANSFORMER_SIZE
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 aware of the error. Tests fail because we don't modify self.component_config anymore so it keeps the old value. However this line still should be removed because correction happens in _get_transformer_dimensions. We just need to come up with a different way of testing it. You can experiment a bit if you want to figure this out yourself, but if you find yourself stuck just ping me and I'll give you some insights.

@emysdias
Copy link
Contributor Author

Just to let you know that I'm going to go back with this PR and @WashingtonBispo is going to help too

@losterloh
Copy link
Contributor

hey @emysdias , is this still relevant / are you still planning on working on this? 🙂

@emysdias
Copy link
Contributor Author

emysdias commented Jun 1, 2022

hey @emysdias , is this still relevant / are you still planning on working on this? slightly_smiling_face

I dont know, I got no answer anymore and not going to work on this anymore

@m-vdb
Copy link
Collaborator

m-vdb commented May 25, 2023

Hi there! Thanks for your contribution. As the PR has been stale for a while, I'm closing it. Please feel free to reopen an issue / PR if the problem still occurs on latest rasa versions.

@m-vdb m-vdb closed this May 25, 2023
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.

5 participants