- Notifications
You must be signed in to change notification settings - Fork2.2k
Fix progressbar with nested compound step samplers#7776
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
aloctavodia commentedJun 21, 2025
Currently, PyMC-BART works without this. However, a recent PR, which allows multiple BART RVs, fails without this. I have not tried with the alternative#7730. |
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.
Pull Request Overview
This PR refactors and centralizes progress bar functionality, updates sampling step methods to use the new API, and adds a regression test for nested compound samplers.
- Move
CustomProgress,RecolorOnFailureBarColumn,ProgressBarManager, and related logic frompymc/util.pyinto a newpymc/progress_bar.pymodule. - Update all imports to point to
pymc.progress_barand adjust references to the new_make_progressbar_update_functionsAPI. - Add an integration test (
test_progressbar_nested_compound) to guard against regressions in nestedCompoundStepprogress bars.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_progress_bar.py | Add regression test for nested compound-step sampling progress. |
| pymc/variational/inference.py | Update imports to use newCustomProgress location. |
| pymc/util.py | Remove old progress-bar classes and imports. |
| pymc/tuning/starting.py | Update progress-bar import to new module. |
| pymc/step_methods/slicer.py | Rename update-stats API to_make_progressbar_update_functions. |
| pymc/step_methods/metropolis.py | Rename and adjust update-stats API. |
| pymc/step_methods/hmc/*.py | Rename and adjust update-stats API in HMC and NUTS. |
| pymc/step_methods/compound.py | Rename and aggregate update-stat functions. |
| pymc/smc/sampling.py | Update progress-bar import. |
| pymc/sampling/*.py | Update progress-bar imports in various sampling pathways. |
| pymc/progress_bar.py | New module consolidating progress-bar logic and classes. |
| .github/workflows/tests.yml | Include the new test file in CI. |
Comments suppressed due to low confidence (1)
pymc/progress_bar.py:37
- [nitpick] Consider adding unit tests for
CustomProgress(e.g., togglingdisableandinclude_headers) to verify that tasks are added, updated, or suppressed as expected.
class CustomProgress(Progress):Uh oh!
There was an error while loading.Please reload this page.
codecovbot commentedJul 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #7776 +/- ##==========================================+ Coverage 89.19% 92.99% +3.80%========================================== Files 107 108 +1 Lines 18313 18327 +14 ==========================================+ Hits 16334 17043 +709+ Misses 1979 1284 -695
🚀 New features to boost your workflow:
|
jessegrabowski left a 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.
@ricardoV94 can you give the changes i pushed a final once over then we can merge this
ricardoV94 commentedJul 9, 2025
@aloctavodia can you check if this also fixes the problem on your end? |
Uh oh!
There was an error while loading.Please reload this page.
ricardoV94 commentedJul 15, 2025
@jessegrabowski I cleanup a bit the PR, if tests pass I think we're good. Wanna take a last look? |
jessegrabowski left a 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.
One docstring out of date, and a small issue I want to bring to your attention.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ricardoV94 commentedJul 15, 2025
Oops my PR got merged stale and a test is failing |
ricardoV94 commentedJul 15, 2025
The other failure is ours |
jessegrabowski commentedJul 15, 2025
There was a test with a hardcoded list of expected stats. It should pass now (not sure about the pre-commit problem) |
ricardoV94 commentedJul 15, 2025
pre-commit seems legit |
aloctavodia commentedJul 16, 2025
I can confirm that this fixes the problem in PyMC-BART |
Every step sampler can now decide whether sampling is failing or not by setting "failing" in the returned update dict
8a436d8 intopymc-devs:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Alternative to#7730 thatfixes#7721 andfixes#7724