-
Notifications
You must be signed in to change notification settings - Fork 323
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
gradient verification callback #465
Conversation
Hello @awaelchli! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-01-18 08:36:55 UTC |
Codecov Report
@@ Coverage Diff @@
## master #465 +/- ##
===========================================
- Coverage 78.95% 26.10% -52.85%
===========================================
Files 105 107 +2
Lines 6121 6201 +80
===========================================
- Hits 4833 1619 -3214
- Misses 1288 4582 +3294
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
LGTM, just would be nice to have tests for uncovered lines...
c0d4f19
to
9f2adcd
Compare
@Borda ok, I will try to make it higher |
Thank you so much for implementing this! |
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.
@awaelchli I love this feature! I left some minor suggestions on typing and docs, so would you mind having a look at them? They should be resolved by clicking some buttons in your browser :]
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
…nto feature/gradient-verification
Hey @awaelchli, why not push it directly to PL ? |
Because @williamFalcon wants only essential callbacks in core PL library, and all non-essential, specialized callbacks here in bolts. Or at least this the information I have back from when pl_bolts was created, maybe it changed. I do not want to force this into any library unless team/community wants it. |
This looks like a great feature and we need to provide more callback examples to people. It is up to you, but I see its value for PL. |
Thank you for the kind feedback. Ok, let me adress the remaining review comments here on the PR and I will double check with William. |
self.model = model | ||
|
||
@abstractmethod | ||
def check(self, *args: Any, **kwargs: Any) -> bool: |
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.
@akihironitta this mypy tool is not very smart :( It is not liking that the subclass has different args than here. I want this abstract method to be as general as possible and not specify concrete arguments and types. It should only act as an interface. Any suggestions how to proceed? I believe I have to add # type: ignore
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.
I found a related issue in mypy repo, and it basically says that an easy workaround would be to add # type: ignore[override]
, so shall we just ignore it then?
python/mypy#1237 (comment)
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.
no chance, it won't work. I tried to put it everywhere: at the top of method, on the same line as signature, below it, on top of the class, on top of the file, both in subclass and superclass.
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.
I had to spam #type: ignore
everywhere to make it work.
This mypy tool, I don't understand it. I spent hours now studying the docs of this tool trying to figure out what the error messages mean. I tried everything, but the type: ignore
are unavoidable, yet they pollute the code unnecessarily. It's unbelievably frustrating, and I can no longer work on this, sorry.
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.
I completely understand your frustration. Let's ignore them all for now.
What does this PR do?
Fixes #194
Adds the requested callbacks for model verification.
It's copied from my personal repository.
cc @TylerYep
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃