Skip to content

Commit

Permalink
fix: update progress less frequently
Browse files Browse the repository at this point in the history
Update sampling progress less frequently. This solves
a UI issue for non-ansi terminals (e.g., jupyter notebook).

Closes #293
  • Loading branch information
riddell-stan committed May 16, 2021
1 parent 66742d3 commit 60be930
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stan/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ async def go():
iteration, iteration_max = map(
int, current_and_max_iterations_re.findall(progress_message).pop(0)
)
if current_iterations.get(operation["name"]) == iteration:
continue
current_iterations[operation["name"]] = iteration
iterations_count = sum(current_iterations.values())
total_iterations = iteration_max * num_chains
Expand All @@ -212,7 +214,7 @@ async def go():
sampling_output.write_line(
f"<comment>Sampling:</comment> {round(percent_complete):3.0f}% ({iterations_count}/{total_iterations})"
)
await asyncio.sleep(0.01)
await asyncio.sleep(0.05)

fit_in_cache = len(current_iterations) < num_chains

Expand Down

0 comments on commit 60be930

Please sign in to comment.