pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Show sampling progress bars by forcing console behaviour in fastprogress

Open fohria opened this issue 4 years ago • 9 comments

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!

screenshot

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

fohria avatar Dec 17 '20 14:12 fohria

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

sfo avatar Feb 05 '21 14:02 sfo

This post gave me a solution.

wzh1895 avatar Mar 10 '21 23:03 wzh1895

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.

Vital-Fernandez avatar Mar 13 '21 21:03 Vital-Fernandez

Can we fix this on the PyMC3 side? We don't want to change the import for everyone but just make it optional.

twiecki avatar Mar 14 '21 11:03 twiecki

Can we fix this on the PyMC3 side? 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

fohria avatar Mar 19 '21 08:03 fohria

Can we fix this on the PyMC3 side? We don't want to change the import for everyone but just make it optional.

ricardoV94 avatar Apr 06 '21 09:04 ricardoV94

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

shammyD avatar Apr 27 '21 01:04 shammyD

Does anyone still have this problem? I use PyMC through VSCode all the time without any progress bar problems.

fonnesbeck avatar Aug 27 '22 18:08 fonnesbeck

I havent seen this problem. I vote we close and if it appears again someone can reopen

canyon289 avatar Aug 27 '22 19:08 canyon289

Closing as stale, feel free to reopen if still relevant

ricardoV94 avatar Feb 06 '24 10:02 ricardoV94