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

rasa train --dry-run #7397

Merged
merged 29 commits into from
Dec 10, 2020
Merged

rasa train --dry-run #7397

merged 29 commits into from
Dec 10, 2020

Conversation

alwx
Copy link
Contributor

@alwx alwx commented Nov 27, 2020

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)

@alwx alwx changed the base branch from master to rasa-train-fingerprint November 27, 2020 14:19
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.

looks good 👍

rasa/train.py Outdated Show resolved Hide resolved
rasa/train.py Outdated Show resolved Hide resolved
@alwx alwx marked this pull request as ready for review December 1, 2020 15:32
@alwx alwx changed the base branch from rasa-train-fingerprint to master December 1, 2020 15:32
@alwx alwx changed the base branch from master to rasa-train-fingerprint December 1, 2020 15:32
@alwx alwx requested review from wochinge and joejuzl December 1, 2020 15:54
@alwx
Copy link
Contributor Author

alwx commented Dec 1, 2020

Going to add one more test to it, but in general it's done and ready to be reviewed.

@alwx alwx requested a review from a team as a code owner December 2, 2020 10:28
@alwx alwx changed the base branch from rasa-train-fingerprint to master December 2, 2020 10:28
@alwx alwx changed the title rasa train --dry-run rasa train --dry-run Dec 2, 2020
rasa/train.py Outdated
code, texts = dry_run_result(fingerprint_comparison)
for text in texts:
print_warning(text) if code > 0 else print_success(text)
sys.exit(code)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a real PITA, but I wonder if the code should be passed up to rasa/cli/train.py and exiting handled there? Just as rasa/cli/ where we tend to handle things like this.
WDYT?

Copy link
Contributor Author

@alwx alwx Dec 2, 2020

Choose a reason for hiding this comment

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

It's definitely not a PITA, and might actually be a good idea :)
However, not sure if I have time to check it today — and in this case I'd be able to update it only in a week.

rasa/train.py Outdated Show resolved Hide resolved
assert not any([s for s in printed_output if "No training required." in s])
assert (
(
output.ret & CODE_CORE_NEEDS_TO_BE_RETRAINED
Copy link
Contributor

Choose a reason for hiding this comment

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

this is pretty cool. Is this a conventional way of handling shell exit codes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, afaik the standard exit code is 0 for success and any number from 1 to 255 for anything else.
I thought that it might be a good idea to just use bit masks to encode all the information we need because we have 4 booleans in FingerprintComparisonResult (which gives us 2^4 possible results).

@TyDunn TyDunn added this to the 2.2 Rasa Open Source milestone Dec 7, 2020
rasa/cli/arguments/train.py Outdated Show resolved Hide resolved
action="store_true",
help="If enabled, not actual training will be performed. Instead, "
"it will be determined whether a model should be re-trained "
"and this information will be printed as an output.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we explain the different exit codes?

rasa/train.py Outdated Show resolved Hide resolved
tests/cli/test_rasa_train.py Show resolved Hide resolved
@alwx alwx requested review from joejuzl and wochinge December 9, 2020 14:38
rasa/cli/arguments/train.py Outdated Show resolved Hide resolved
rasa/cli/arguments/train.py Outdated Show resolved Hide resolved
"and this information will be printed as the output. The return "
"code is a 4-bit bitmask that can also be used to determine what exactly needs "
"to be retrained:\n"
"- 0b0001 means Core needs to be retrained\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just tell them the integer which the bitmask translates to. No need to refresh their knowledge on binary numbers 😂

rasa/train.py Outdated Show resolved Hide resolved
rasa/train.py Show resolved Hide resolved
tests/cli/test_rasa_train.py Outdated Show resolved Hide resolved
tests/cli/test_rasa_train.py Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
Add `rasa train --dry-run` command that allows to check if training needs to be performed
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency it might be an idea to also add this to rasa train core & rasa train nlu, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, we can do that but I think it makes very little sense.
In addition, the results of rasa train core --dry-run will be different and will basically be just answering a question of "does the core model need to be retrained?" in this case.

But I don't have a strong opinion on that — on one hand, I understand your argument about the consistency (however, in this case we might also consider adding --force argument to rasa train nlu) but on the other hand I don't understand what problem does it solve and how it can be useful :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I was wondering the same 👍 Let's not cover them then.

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.

Please check the comment with the 🚨

@@ -0,0 +1,2 @@
Add `rasa train --dry-run` command that allows to check if training needs to be performed
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I was wondering the same 👍 Let's not cover them then.

rasa/train.py Outdated Show resolved Hide resolved
rasa/train.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.

🚀

@rasabot
Copy link
Collaborator

rasabot commented Dec 10, 2020

Could not update branch. Most likely this is due to a merge conflict. Please update the branch manually and fix any issues.

� Conflicts:
�	rasa/server.py
�	rasa/train.py
�	tests/conftest.py
�	tests/test_server.py
@rasabot rasabot merged commit ba3c313 into master Dec 10, 2020
@rasabot rasabot deleted the rasa-dry-run branch December 10, 2020 20: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.

None yet

5 participants