Skip to content

More control over ProgressBar formatting #3118

@jmg049

Description

@jmg049

🚀 Feature - Improved contrib.handlers.tqdm_logger.ProgressBar formatting and alignment

More configurable arguments/bar formatting of the available ProgressBar class. Specifically to allow for the alignment of multiple bars (train loop, test/validation loop).

The current functionality of the ProgressBar class modifies the bar format to include the current_epoch/total_epochs when max_epochs > 1. This mostly works well for the train loop. However, format/alignment issues arise when the train loop is used with a validation loop that runs at the end of each epoch (on EpochCompleted). The validation loop should only be run once. However, this causes the epoch information to be omitted, and consequently, any format options which attempt to align the bars are void (see the screenshot below; both progress bars are set to have the same formatting). The format given below may not format as intended, but I cannot test it since I cannot remove/add the epoch information.

Ideally, control would be given over the if/how the epoch information is displayed when creating the ProgressBar. Investigating the codebase, it seems that this stuff is handled internally in the _OutputHandler class. I would very much like to align the bars to start and finish in the same place as each other, purely for aesthetics.

BAR_FMT = "{desc:<15} [{n_fmt}/{total_fmt}]|{bar}| {rate_fmt}{postfix}"

image

In the above image, I would love control over aligning the actual bar sections of the progress bars.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions