Skip to main content

A simple and compact one-line progress bar for TensorFlow 2 Keras.

Project description

Build PyPi Downloads License Binder

A simple and compact one-line progress bar for TensorFlow 2 Keras.


TensorFlow Compact Progress Bar

Existing ways of monitoring training of TensorFlow Keras models either display nothing (verbose=0), one progress bar per epoch (verbose=1), or prints one line of metrics per epoch (verbose=2). When training for thousands of epochs, this often leads to bloated log files or crashed/sluggish Jupyter environments when working interactively.

This library provides a compact progress bar that simply displays the overall training progress by epoch. There are also a few small additional features for convenience, such as excluding certain metrics to avoid excessive clutter.

Notebook mode notebook_demo

Console mode console_demo

Getting Started

Install from PyPi:

$ pip install tf-compactprogbar

Dependencies

  • tensorflow >= 2 (TF 1 likely works, but untested)
  • tqdm
  • python >= 3.7
  • ipywidgets (Optional)
  • jupyterlab_widgets (Optional)

For nice looking Jupyter/IPython progress bars, make sure you have ipywidgets and jupyterlab_widgets if you are on Jupyter Lab.

Usage

To use it, disable the built-in logging (verbose=0) and pass it in as a Callback:

from tf_compactprogbar import CompactProgressBar

progBar = CompactProgressBar()
history = model.fit(X_train, Y_train,
                    epochs=200,
                    batch_size=100,
                    verbose=0,
                    validation_data = (X_test, Y_test),
                    callbacks=[progBar])

Documentation

# Call signature
CompactProgressBar(show_best=True, best_as_max=[], exclude=[], notebook='auto', epochs=None)

Args:
        - show_best    (bool)      Display best metrics. Default: True
        - best_as_max  (list)      Metrics which should be maximized (see note)
        - exclude      (list)      Metrics which should be excluded from display
        - notebook     (str/bool)  Whether to use IPython/Jupyter widget or console. Default: 'auto'
        - epochs       (int)       Optional total number of epochs. Default is inferred from `.fit`.
        
Note: When using `show_best`, by default the "best" metric is the minimum. Pass
in the metric name to `best_as_max` to change this behavior.

If there are any issues in Jupyter, please see the tqdm Issues page for help or disable notebook mode with notebook=False.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tf_compactprogbar-1.0.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tf_compactprogbar-1.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file tf_compactprogbar-1.0.2.tar.gz.

File metadata

  • Download URL: tf_compactprogbar-1.0.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for tf_compactprogbar-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7b89a9d92aadf6ac810ec4b3b9a13facb4ca3d05831bcf0a31146d88ef606492
MD5 a1e3341b4e3ab22caef277c26f0c6c21
BLAKE2b-256 e8f8cf1a543fbf15b6f76fe0b577c0d8afee5847118469cab98e1b33682086f4

See more details on using hashes here.

File details

Details for the file tf_compactprogbar-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tf_compactprogbar-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 02cd9ebeff4eab3871407e9c303c5a2bf4608d20f76a8234209a2d6befd3851c
MD5 e6b9d01e29b445b64450d3fedf79446e
BLAKE2b-256 460c30cd51c4ad9db18bde4ad281d617ae7f87064d7315e7d0e134b61917c0b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page