pymc
pymc copied to clipboard
Show sampling progress bars by forcing console behaviour in fastprogress
I'm using Atom + Hydrogen plugin and progress bars are not shown when sampling.
Probably the same issue as #4090 but there it's Pycharm.
fastprogress library has a force_console_behavior functionality which enabled me to see fastprogress progress bar, a la this issue
Tried adding that fix after import of pymc3 but didn't work, I suspect because the objects are already created on import.
so i replaced the import in pymc3/sampling.py and pymc3/parallel_sampling.py:
# from fastprogress.fastprogress import progress_bar
from fastprogress.fastprogress import force_console_behavior
master_bar, progress_bar = force_console_behavior()
...and voila!

Maybe an option can be added somewhere to change to this progress bar behaviour for those editors that require it?
Versions and main components
- PyMC3 Version: 3.10
- Theano Version: 1.0.11
- Python Version: 3.8.5
- Operating system: PopOS 20.10
- How did you install PyMC3: conda
You are right. It is indeed the same for PyCharm as described in #4090 and your solution works in this case as well.
The files that require changes are:
- tuning/starting.py
- parallel_sampling.py
- sampling.py
- variational/inference.py
This post gave me a solution.
This post gave me a solution.
Thank you for sharing, that worked for me. However, I am not getting the iterations per second. I am doing a clean installation in a new computer so I am not sure if this feature has been removed.
Can we fix this on the PyMC3 side? We don't want to change the import for everyone but just make it optional.
Can we fix this on the
PyMC3side? We don't want to change the import for everyone but just make it optional.
Would it be possible to add the import (not replace it), and then add a parameter to the sample function? Something like:
pm.sample(progressbarconsole=True/False)
I'm not familiar enough with the code base to know how feasible this is though
Can we fix this on the
PyMC3side? We don't want to change the import for everyone but just make it optional.
Hi @fohria and @sfo I tried your solution using Spyder and I still don't see a progress bar, would you have any ideas? I changed each of
- tuning/starting.py
- parallel_sampling.py
- sampling.py
- variational/inference.py
commenting out the original progress_bar import and inserting:
from fastprogress.fastprogress import force_console_behavior
master_bar, progress_bar = force_console_behavior()
python 3.9.2, spyder 5.0.0, pymc3 3.11.2
Does anyone still have this problem? I use PyMC through VSCode all the time without any progress bar problems.
I havent seen this problem. I vote we close and if it appears again someone can reopen
Closing as stale, feel free to reopen if still relevant