question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProgBar has poor performance in jupyter notebook

See original GitHub issue

When I use model.fit() in jupyter notebook (with verbose) the chrome which host jupyter client frozen. the output shows:

Epoch 1/10
5000/5000 [==============================] - 1s - loss: 0.3613 - acc: 0.9016     
Epoch 2/10
5000/5000 [==============================] - 1s - loss: 0.3593 - acc: 0.9026     
Epoch 3/10
5000/5000 [========================>.....] - ETA: 0s - loss: 0.3447 - acc: 0.9059

I dump it with xxd and find there’s lots of ‘\x08’ at the end of line.

00000000: 4570 6f63 6820 312f 3130 0a35 3030 302f  Epoch 1/10.5000/
00000010: 3530 3030 205b 3d3d 3d3d 3d3d 3d3d 3d3d  5000 [==========
00000020: 3d3d 3d3d 3d3d 3d3d 3d3d 3d3d 3d3d 3d3d  ================
00000030: 3d3d 3d3d 5d20 2d20 3173 202d 206c 6f73  ====] - 1s - los
00000040: 733a 2030 2e33 3631 3320 2d20 6163 633a  s: 0.3613 - acc:
00000050: 2030 2e39 3031 3620 2020 2020 0808 0808   0.9016     ....
00000060: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000070: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000080: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000090: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000a0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000b0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000c0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000d0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000e0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
000000f0: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000100: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000110: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000120: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000130: 0808 0808 0808 0808 0808 0808 0808 0808  ................
00000140: 0808 0808 0808 0808 0808 0808 0808 0808  ................

I think we could use ipywidgets to improve the performance. Here’s an example The code snippets I’m using is:

from keras.layers import Dense, Activation
from keras.models import Sequential

model = Sequential()
model.add(Dense(output_dim=1024, input_dim=image_size*image_size))
model.add(Activation("relu"))
model.add(Dense(output_dim=10))
model.add(Activation("softmax"))

model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])

model.fit(train_dataset[:5000], train_labels[:5000], nb_epoch=10, batch_size=128)

Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

31reactions
bstrinercommented, Jan 3, 2017

I just put together a module for keras/tqdm integration. Try this out:

https://github.com/bstriner/keras-tqdm/blob/master/examples/keras_progress_bars.ipynb https://github.com/bstriner/keras-tqdm

After some fiddling, the TQDM display looks really good

TQDM

Please let me know if it works for you. I’d be interested in how the performance is in comparison.

To use it, set verbose=0 to stop the built-in keras progress bar, and set callbacks=[TQDMCallback()] to use the TQDM progress bar.

Cheers, Ben

4reactions
clouds56commented, Mar 11, 2017

Hi all, @bstriner have implement a progress bar using tqdm, please checkout https://github.com/bstriner/keras-tqdm.

#!/usr/bin/bash
pip install keras-tqdm

#!/usr/bin/python3
from keras_tqdm import TQDMNotebookCallback
# keras, model definition...
model.fit(X_train, Y_train, verbose=0, callbacks=[TQDMNotebookCallback()])

It is a fancy package, worth a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

progress bar in jupyter notebook go crazy - Stack Overflow
The first time everything work right, it has only one progress bar. But when I run it again(to produce a video), the progress...
Read more >
tqdm documentation
By comparison, the well-established ProgressBar has an 800ns/iter overhead. In addition to its low overhead, tqdm uses smart algorithms to predict the remaining ......
Read more >
Module: display — IPython 8.7.0 documentation
When this object is returned by an input cell or passed to the display function, it will result in Audio controls being displayed...
Read more >
alive-progress - PyPI
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Read more >
Python Notebook: Determine if Processes Completed
BUT, Pro has the integrated Notebook which is great. ... Is there a way to show a progress bar or any indication that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found