Keras Model.fit Verbose Formatting
You can try the Keras-adapted version of the TQDM progress bar library.
- The original TQDM library: https://github.com/tqdm/tqdm
- The Keras version of TQDM: https://github.com/bstriner/keras-tqdm
The usage instructions can be brought down to:
install e.g. per
pip install keras-tqdm
(stable) orpip install git+https://github.com/bstriner/keras-tqdm.git
(for latest dev-version)import the callback function with
from keras_tqdm import TQDMNotebookCallback
run Keras'
fit
orfit_generator
withverbose=0
orverbose=2
settings, but with a callback to the importedTQDMNotebookCallback
, e.g.model.fit(X_train, Y_train, verbose=0, callbacks=[TQDMNotebookCallback()])
The result:
Took me a while to see this but I just added built-in support for keras
in tqdm
(version >= 4.41.0) so you could do:
from tqdm.keras import TqdmCallback
...
model.fit(..., verbose=0, callbacks=[TqdmCallback(verbose=2)])
This turns off keras
' progress (verbose=0
), and uses tqdm
instead. For the callback, verbose=2
means separate progressbars for epochs and batches. 1
means clear batch bars when done. 0
means only show epochs (never show batch bars).