TQDMProgressBarWrapper#

class braintools.trainer.TQDMProgressBarWrapper(**kwargs)#

Progress bar wrapper using tqdm.

Provides rich progress bar features with tqdm.

Parameters:

**kwargs – Additional arguments passed to tqdm.

Examples

Keyword arguments go to tqdm; here the bar writes to a buffer:

>>> import io
>>> import braintools
>>> buf = io.StringIO()
>>> pbar = braintools.trainer.TQDMProgressBarWrapper(file=buf, leave=True)
>>> pbar.start(total=3, desc='Training')
>>> pbar.update(3, loss=0.5)
>>> pbar.close()
>>> 'Training' in buf.getvalue() and '3/3' in buf.getvalue()
True
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.