Skip to content

[PyTorch] A progress bar using Keras style: pkbar

Last Updated on 2020-12-29 by Clay

PyTorch is a famous Python deep learning framework

Introduction

I have been studying about pointer-generator network lately, and I found a package “pkbar“can let us to use keras style progress bar in our tasks.

In fact, it can be used not only in the code of PyTorch framework but also in any loop.


pkbar

If you use it in first time, you can use the following command to install it:

pip3 install pkbar

And then we can use pkbar package.

# coding: utf-8
import time
import pkbar


def main():
    iterate = 10
    bar = pkbar.Pbar(name="Progress", target=iterate)

    for i in range(iterate):
        time.sleep(0.3)
        bar.update(i)


if __name__ == '__main__':
    main()


Output:

Progress
10/10  [==============================] - 3.0s

References


Read More

Leave a Reply