SimpleProgressBar#

class braintools.trainer.SimpleProgressBar(width=50, refresh_rate=0.1)#

Simple text-based progress bar with no dependencies.

Provides a basic progress bar that works in any terminal.

Parameters:
  • width (int) – Width of the progress bar in characters.

  • refresh_rate (float) – Minimum time between updates in seconds.

Examples

>>> pbar = SimpleProgressBar()
>>> pbar.start(total=100, desc='Training')
>>> for i in range(100):
...     pbar.update(1, loss=0.5)
>>> pbar.close()
close()[source]#

Close the progress bar.

set_postfix(metrics)[source]#

Set postfix text with metrics.

Parameters:

metrics (Dict[str, Any]) – Metrics to display.

start(total=None, desc='', unit='it')[source]#

Start the progress bar.

Parameters:
  • total (int | None) – Total number of iterations.

  • desc (str) – Description to display.

  • unit (str) – Unit name for iterations.

update(n=1, **kwargs)[source]#

Update the progress bar.

Parameters:
  • n (int) – Number of iterations to advance.

  • **kwargs – Additional metrics to display.