This entry would be just a quick tip for those of you who are working with data processing in Python and would benefit from a visualizing the progress.
There’s a simple library called tqdm which allow you to do that with a minimal overhead.
Let’s check the usage with a model training dummy code:
As you can see, we have 3 dummy functions for loading data, training and validating, each of them invoking sleep function to simulate data processing.
The main code consists of batch processing of the training data.
If we run the code, we’ll be able to see the progress of the batches, the training and the validation of each batch, separately.
Integrations, advanced features and performance
tqdm supports Pandas, Keras, Dask and IPython/Jupyter integrations and provides advances features such as manual updates of the progress,
callbacks support, custom messages, formatting and more.
On top of that, even though tqdm claims to add only 60ns per iteration (and 80ns for gui), one of the more important features is the control over performance related properties such as intervals and miniters.