-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Reset current_fx properties on lightning module in teardown #7247
Conversation
Hello @ananthsub! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-28 18:27:27 UTC |
Codecov Report
@@ Coverage Diff @@
## master #7247 +/- ##
=======================================
- Coverage 91% 85% -6%
=======================================
Files 199 199
Lines 12783 13342 +559
=======================================
- Hits 11662 11331 -331
- Misses 1121 2011 +890 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch !
tests/trainer/test_trainer.py
Outdated
assert model._current_fx_name == "", f"_current_fx_name not reset after fit: {model._current_fx_name}" | ||
assert model._current_hook_fx_name is None, f"_current_hook_fx_name not reset after fit: {model._current_hook_fx_name}" | ||
assert model._current_dataloader_idx is None, f"_current_dataloader_idx not reset after fit: {model._current_dataloader_idx}" | ||
trainer.test(model) | ||
assert model._current_fx_name == "", f"_current_fx_name not reset after test: {model._current_fx_name}" | ||
assert model._current_hook_fx_name is None, f"_current_hook_fx_name not reset after test: {model._current_hook_fx_name}" | ||
assert model._current_dataloader_idx is None, f"_current_dataloader_idx not reset after test: {model._current_dataloader_idx}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Borda I ran yapf and pre-commit on this file but it looks like they didn't take effect based on the failing test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases where yapf
fails or produces bad output, I usually run black -S -l120
and then yapf
to fix it.
The output was: dd6cf9d
tests/trainer/test_trainer.py
Outdated
assert model._current_fx_name == "", f"_current_fx_name not reset after fit: {model._current_fx_name}" | ||
assert model._current_hook_fx_name is None, f"_current_hook_fx_name not reset after fit: {model._current_hook_fx_name}" | ||
assert model._current_dataloader_idx is None, f"_current_dataloader_idx not reset after fit: {model._current_dataloader_idx}" | ||
trainer.test(model) | ||
assert model._current_fx_name == "", f"_current_fx_name not reset after test: {model._current_fx_name}" | ||
assert model._current_hook_fx_name is None, f"_current_hook_fx_name not reset after test: {model._current_hook_fx_name}" | ||
assert model._current_dataloader_idx is None, f"_current_dataloader_idx not reset after test: {model._current_dataloader_idx}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases where yapf
fails or produces bad output, I usually run black -S -l120
and then yapf
to fix it.
The output was: dd6cf9d
What does this PR do?
This isn't an issue with master, but it's extra precaution that these fields are reset before control returns back to the caller
Fixes #<issue_number>
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃