We often come across large datasets in machine learning. While machine learning learn these datasets there are massive loops being processed behind the screen, it seems like an eternity of waiting time until the process is completed. 

tqdm can help you create progress bars for data processing, training machine learning models, multi-loop Python function, and downloading data from the internet.This tutorial will teach you how to implement Progress Bars during training in keras.

Tqdm is a popular Python library that provides a simple and convenient way to add progress bars to loops and iterable objects.

Using tqdm, you can wrap your loops or iterators with a progress bar, allowing you to track the progress of your code execution. It provides an intuitive and visually appealing progress bar that shows the percentage of completion, estimated time remaining, and other relevant information.

Install the package using pip:

!pip3 install tqdm

tqdm has just added built-in support for keras so you could create a Keras callback:

from tqdm.keras import TqdmCallback

model.compile(optimizer=keras.optimizers.Adam(1e-3),loss="binary_crossentropy",metrics=["accuracy"],)

model.fit(train_ds,verbose=0,epochs=epochs,callbacks=[TqdmCallback(verbose=2)], validation_data=val_ds)
Keras tqdm progress bar

This will turns off keras‘ progress (verbose=0), and uses tqdm instead. For the tqdm callback, verbose=2 means separate progressbars for epochs and batches. 1 means clear batch bars when done. 0 means only show epochs (no progress bar for batch).