Syntax
In training we can create a generator by data_gen = iter(dataloader)
. By using tqdm
we can create a progress bar to visuallize the progress of the current Epoch:
for ... in tqdm(data_gen, total=n_batches, desc="Epoch {}".format(epoch), bar_format=config.bar_format): ...
total
Since generator cannot provide the total legnth, we must providetotal
as kwarg.- Note that
total
depends ondrop_last
inDataLoader
(in pytorch). desc
is easy to understand.
bar_format
The bar_format
we use can be formatted by:
"{desc}: {percentage:.1f}%|{bar:15}| {n}/{total_fmt} [{elapsed}, {rate_fmt}{postfix}]"
This will show the information as shown in the picture:
