-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix compile_fn
bug and reduce return type confusion
#5909
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5909 +/- ##
==========================================
- Coverage 89.48% 89.46% -0.02%
==========================================
Files 73 73
Lines 13275 13282 +7
==========================================
+ Hits 11879 11883 +4
- Misses 1396 1399 +3
|
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 don't think the point_fn distinction is useful enough to warrant separate methods, and specially a more verbose default one.
I understand the typing concerns, but then again... this is Python.
Do we need the I'd really prefer to reduce the type confusion, because this function is used in a lot of places. Having well defined types here will help typing throughout the entire codebase. |
Yeah let's get rid of the silly wrapper. How would we go about doing it? |
I moved I also looked into removing |
Regardless of what we decide we still need to have a test that calls these functions. The fact that the original PR test failed makes this even more important. |
@ricardoV94 I neither have the time to start refactoring here, nor to figure out why the test Dan wrote ran into that error. I looked into it this morning, but couldn't figure out why. The only reason why I picked up the issue is that this is a blocker for |
Then I suggest you limit the PR to the bugfix alone (and test) |
That original test failed not because of the forwarding of the Mode kwarg. IMO we should instead just remove those module-level functions and stick with the methods that we're using anyway. But it's Monday again and I have other priorities. I can't justify investing more time here. |
`Model.compile_fn` requires all parameters except `outs` to be keyword arguments so the top level `compile_fn` didn't work as written.
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.
Thanks for adding the test! Now that I see the solution it does make sense that inputs need to be specified..
Let's merge when the test go green 👍
This takes the bugfix from #5865 by @dfm albeit without the test case.
I looked into the test case and couldn't quite figure out why it's not working.
But if we were to test these module-level functions that are just forwarding to the
Model
methods, we should be doing that with mocks..While I was at it, I also deprecated
Model.compile_fn(point_fn=True)
in favor of havingModel.compile_fn
vs.Model.compile_point_fn
.The motivation here is that switching the return type via a kwarg is really terrible from a typing perspective.
The
Model.compile_point_fn() -> PointFunc
signature on the other hand is less confusing.Incompatible Changes
Compatible Changes
Model.compile_fn(point_fn=True)
was deprecated in favor of a newModel.compile_point_fn()
methodBugfixes
pm.compile_fn
now correctly forwards themode
kwarg (closes Bug in pm.compile_fn #5867)