Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f849206
One progress bar per chain when samplings
jessegrabowski Jan 6, 2025
b74f4fb
Add guard against divide by zero when computing draws per second
jessegrabowski Jan 6, 2025
06572c6
No more purple
jessegrabowski Jan 7, 2025
23d122f
Step samplers are responsible for setting up progress bars
jessegrabowski Jan 8, 2025
1c5b734
Fix typos
jessegrabowski Jan 8, 2025
959f073
Add progressbar defaults to BlockedStep ABC
jessegrabowski Jan 8, 2025
50394e3
pre-commit
jessegrabowski Jan 8, 2025
4945153
Only update NUTS divergence stats after tuning
jessegrabowski Jan 9, 2025
1cec794
Add `Elapsed` and `Remaining` columns
jessegrabowski Jan 10, 2025
a96d7bb
Remove green color when chain finishes
jessegrabowski Jan 23, 2025
d61ddf6
Create `ProgressManager` class to handle progress bars
jessegrabowski Jan 23, 2025
1e13cf9
Yield `stats` from `_iter_sample`
jessegrabowski Jan 23, 2025
28a80c1
Use `ProgressManager` in `_sample_many`
jessegrabowski Jan 23, 2025
345faff
pre-commit
jessegrabowski Jan 23, 2025
741cf36
Explicit case handling for `progressbar` argument
jessegrabowski Jan 23, 2025
f4ccbd5
Allow all permutations of arguments to progressbar
jessegrabowski Jan 23, 2025
9649d66
Appease mypy
jessegrabowski Jan 23, 2025
a629a97
Add True case
jessegrabowski Jan 23, 2025
e024991
Fix final count when `progress = "combined"`
jessegrabowski Jan 25, 2025
4e535d4
Update docstrings
jessegrabowski Jan 25, 2025
b9b0583
mypy + cleanup
jessegrabowski Jan 25, 2025
9de9930
Syntax error in typehint
jessegrabowski Jan 25, 2025
79d1248
Simplify progressbar choices, update docstring
jessegrabowski Jan 26, 2025
161d10c
Incorporate feedback
jessegrabowski Jan 27, 2025
b381e5d
Be verbose with progressbar settings
jessegrabowski Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions pymc/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,28 +704,38 @@ def callbacks(self, task: "Task"):

class ProgressManager:
def __init__(self, step_method, chains, draws, tune, progressbar, progressbar_theme):
mode = "chain"
stats = "full"

if isinstance(progressbar, bool):
show_progress = progressbar
else:
show_progress = True

if "+" in progressbar:
mode, stats = progressbar.split("+")
else:
mode = progressbar
stats = "full"

if mode not in ["chain", "combined"]:
raise ValueError('Invalid mode. Valid values are "chain" and "combined"')
if stats not in ["full", "simple"]:
raise ValueError('Invalid stats. Valid values are "full" and "simple"')
self.combined_progress = False
self.full_stats = True
show_progress = True

match progressbar:
case True:
show_progress = True
case False:
show_progress = False
case "combined":
self.combined_progress = True
case "chain":
self.combined_progress = False
case "combined+full":
self.combined_progress = True
self.full_stats = True
case "combined+simple":
self.combined_progress = True
self.full_stats = False
case "chain+full":
self.combined_progress = False
self.full_stats = True
case "chain+simple":
self.combined_progress = False
self.full_stats = False
case _:
raise ValueError(
"Invalid value for `progressbar`. Valid values are True (default), False (no progress bar), "
"or one of 'combined', 'chain', 'combined+full', 'combined+simple', 'chain+full', 'chain+simple'."
)

progress_columns, progress_stats = step_method._progressbar_config(chains)
self.combined_progress = mode == "combined"
self.full_stats = stats == "full"

self._progress = self.create_progress_bar(
progress_columns,
Expand Down
Loading