-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add warning if a Minibatched variable is used without total_size #7742
Conversation
…tten This should help catch a well-known Minibatch footgun
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7742 +/- ##
=======================================
Coverage 92.82% 92.82%
=======================================
Files 107 107
Lines 18324 18326 +2
=======================================
+ Hits 17010 17012 +2
Misses 1314 1314
🚀 New features to boost your workflow:
|
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. My only suggestion is that we have some way for a user who knows he doesn't want to set total_size
to somehow avoid the warning. I can't think of a case where anyone would want to do this, but something like total_size=False
to silence the warning might be nice?
Might also be too convoluted.
I don't think you ever want to not set total_size if you are doing
minibatching. If you are doing something fancy you probably are just
setting it to something other than len(data)
…On Tue, 1 Apr 2025, 10:10 Jesse Grabowski, ***@***.***> wrote:
***@***.**** approved this pull request.
LGTM. My only suggestion is that we have some way for a user who knows he
doesn't want to set total_size to somehow avoid the warning. I can't
think of a case where anyone would want to do this, but something like
total_size=False to silence the warning might be nice?
Might also be too convoluted.
—
Reply to this email directly, view it on GitHub
<#7742 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACCUIZBJRM5CAGC5PTEQL2XJCWHAVCNFSM6AAAAAB2CSI7Q6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOMZRHA2TGMBXGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@@ -1241,6 +1241,15 @@ def register_rv( | |||
self.add_named_variable(rv_var, dims) | |||
self.set_initval(rv_var, initval) | |||
else: | |||
if ( |
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.
this should have checked if minibatch is anywhere in the ancestors of value not just immediately
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.
Do we need to do that? This check is only for observed random variables. I thought for those we don't allow the value to depend on another node
Description
This should help catch a well-known Minibatch footgun where a user forgets to include the
total_size
argumentChecklist
Type of change
📚 Documentation preview 📚: https://pymc--7742.org.readthedocs.build/en/7742/