Keras integration with TQDM progress bars
Switch branches/tags
Clone or download
Pull request Compare This branch is 20 commits behind bstriner:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Keras integration with TQDM progress bars.

  • Keras is an awesome machine learning library for Theano or TensorFlow.
  • TQDM is a progress bar library with good support for nested loops and Jupyter/IPython notebooks.

Key features

  • TQDM supports nested progress bars. If you have Keras fit and predict loops within an outer TQDM loop, the nested loops will display properly.
  • TQDM supports Jupyter/IPython notebooks.
  • TQDM looks great!

TQDMNotebookCallback with leave_inner=False (default)

Keras TQDM leave_inner=False

TQDMNotebookCallback with leave_inner=True

Keras TQDM leave_inner=True

TQDMCallback for command-line scripts



Stable release

pip install keras-tqdm

Development release

git clone
cd keras-tqdm
python install

Basic usage

It's very easy to use Keras TQDM. The only required change is to remove default messages (verbose=0) and add a callback to The rest happens automatically! For Jupyter Notebook required code modification is as simple as:

from keras_tqdm import TQDMNotebookCallback
# keras, model definition..., Y_train, verbose=0, callbacks=[TQDMNotebookCallback()])

For plain text mode (e.g. for Python run from command line)

from keras_tqdm import TQDMCallback
# keras, model definition..., Y_train, verbose=0, callbacks=[TQDMCallback()])

Advanced usage

Use keras_tqdm to utilize TQDM progress bars for Keras fit loops. keras_tqdm loops can be nested inside TQDM loops to display nested progress bars (although you can use them inside ordinary for loops as well). Set verbose=0 to suppress the default progress bar.

from keras_tqdm import TQDMCallback
from tqdm import tqdm
for model in tqdm(models, desc="Training several models"):, y, verbose=0, callbacks=[TQDMCallback()])

For IPython and Jupyter notebook TQDMNotebookCallback instead of TQDMCallback. Use tqdm_notebook in your own code instead of tqdm.


Please feel free to submit PRs and issues. Comments, questions, and requests are welcome. If you need more control, subclass TQDMCallback and override the tqdm function.