fix: suppress nested progress bars via thread-local context manager #1922
fix: suppress nested progress bars via thread-local context manager #1922BHARATH0153 wants to merge 8 commits into
Conversation
…bi-dev#1811) Add sbi/utils/pbar.py with thread-local nesting tracker. Outer samplers (accept_reject_sample, rejection_sample, sampling_importance_resampling) wrap proposal calls in nested_pbar_context, while downstream functions like Diffuser.run check is_nested() to suppress their own bars.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1922 +/- ##
==========================================
+ Coverage 87.88% 87.99% +0.11%
==========================================
Files 143 144 +1
Lines 13387 13677 +290
==========================================
+ Hits 11765 12035 +270
- Misses 1622 1642 +20
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
@janfb please review when you have time thanks! |
|
@Jocho-Smith please review your insight will be helpful thanks! |
|
Hi @BHARATH0153 , I like the slim and precise implementation. How exactly did you test that this is leading to the desired output? I just run this test here again: #1473 (comment) Instead of the the current I see with your code So no bars at all. This might be one possible solution to resolve the confusion, however I think this is not what you aimed for here. So the confusion from the test example from the link above is that one requests 10 samples and gets 2 status bars mentioning 10 and 100 additional samples. This can be confusing, b/c users might think they got 100, when they actually get the 10 requested. So your solution removes the bars entirely, which makes the nestedness tracking unnecessary, right? Maybe it is helpful to look at the example code I linked and design your solution it in a way that makes it behave it in the way you want - possibly writing some more 'test scenarios'. Does that make sense? Hope it helps. Quick note: I'll be busy the next weeks as well, so Jan might actually be faster reviewing it before I can reply the next time. Thanks for looking at it either way! |
|
@janfb please check the new changes when you are free thanks! |
|
Hi @BHARATH0153 please note that as said in my comment below the issue that I am not able to review this in the next weeks. I will try to review it early August. Thanks for your patience! |
closes #1811
changes
Add sbi/utils/pbar.py with thread-local nesting tracker. Outer samplers (accept_reject_sample, rejection_sample, sampling_importance_resampling) wrap proposal calls in nested_pbar_context, while downstream functions like Diffuser.run check is_nested() to suppress their own bars.