Skip to content

Commit

Permalink
Disable sample_posterior_predictive taskbar when progressbar=False
Browse files Browse the repository at this point in the history
  • Loading branch information
fonnesbeck committed Apr 23, 2024
1 parent e5d84ba commit b04ebdb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pymc/sampling/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def sample_posterior_predictive(
_log.info(f"Sampling: {list(sorted(volatile_basic_rvs, key=lambda var: var.name))}") # type: ignore
ppc_trace_t = _DefaultTrace(samples)
try:
with Progress(console=Console(theme=progressbar_theme)) as progress:
with Progress(console=Console(theme=progressbar_theme), disable=not progressbar) as progress:
task = progress.add_task("Sampling ...", total=samples, visible=progressbar)
for idx in np.arange(samples):
if nchain > 1:
Expand Down
2 changes: 1 addition & 1 deletion pymc/sampling/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def __init__(
"[progress.percentage]{task.percentage:>3.0f}%",
TimeRemainingColumn(),
TextColumn("/"),
TimeElapsedColumn()
TimeElapsedColumn(),
console=Console(theme=progressbar_theme),
)
self._show_progress = progressbar
Expand Down
4 changes: 2 additions & 2 deletions pymc/sampling/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import cloudpickle
import numpy as np

from rich.progress import BarColumn, Progress, TextColumn, TimeRemainingColumn, TimeElaspedColumn
from rich.progress import BarColumn, Progress, TextColumn, TimeRemainingColumn, TimeElapsedColumn

from pymc.backends.base import BaseTrace
from pymc.initial_point import PointType
Expand Down Expand Up @@ -181,7 +181,7 @@ def __init__(self, steppers, parallelize: bool, progressbar: bool = True):
"[progress.percentage]{task.percentage:>3.0f}%",
TimeRemainingColumn(),
TextColumn("/"),
TimeElaspedColumn(),
TimeElapsedColumn(),
) as self._progress:
for c, stepper in enumerate(steppers):
# enumerate(progress_bar(steppers)) if progressbar else enumerate(steppers)
Expand Down

0 comments on commit b04ebdb

Please sign in to comment.