Skip to content
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

Show sampling progress bars by forcing console behaviour in fastprogress #4349

Closed
fohria opened this issue Dec 17, 2020 · 10 comments
Closed

Comments

@fohria
Copy link

fohria commented Dec 17, 2020

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
@sfo
Copy link

sfo commented Feb 5, 2021

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

@wzh1895
Copy link

wzh1895 commented Mar 10, 2021

This post gave me a solution.

@Vital-Fernandez
Copy link

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.

@twiecki
Copy link
Member

twiecki commented Mar 14, 2021

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

@fohria
Copy link
Author

fohria commented Mar 19, 2021

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

@ricardoV94
Copy link
Member

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

@ricardoV94 ricardoV94 reopened this Apr 6, 2021
@shammyD
Copy link

shammyD commented Apr 27, 2021

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

@fonnesbeck
Copy link
Member

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

@canyon289
Copy link
Member

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

@ricardoV94
Copy link
Member

Closing as stale, feel free to reopen if still relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants