Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras floods Jupyter cell output during fit (verbose=1)

When running keras model inside Jupyter notebook with "verbose=1" option, I started getting not single line progress status updates as before, but a flood of status lines updated at batch. See attached picture. Restarting jupyter or the browser is not helping. Jupyter notebook server is: 5.6.0, keras is 2.2.2, Python is Python 3.6.5 Please help.

cell content:

history = model.fit(x=train_df_scaled, y=train_labels, batch_size=BATCH_SIZE, epochs=EPOCHS, verbose=1, validation_data=(validation_df_scaled, validation_labels), shuffle=True)

output flood example: (it is thousands of lines like this)

loss: 217.5794 - mean_absolute_error: 11.166 - ETA: 32:42 - loss: 216.9500 - mean_absolute_error: 11.165 - ETA: 32:21 - loss: 216.6378 - mean_absolute_error: 11.164 - ETA: 32:00 - loss: 216.0345 - mean_absolute_error: 11.164 - ETA: 31:41 - loss: 215.6621 - mean_absolute_error: 11.166 - ETA: 31:21 - loss: 215.4639 - mean_absolute_error: 11.171 - ETA: 31:02 - loss: 215.1654 - mean_absolute_error: 11.173 - ETA: 30:44 - loss: 214.6583 - mean_absolute_error: 11.169 - ETA: 30:27 - loss: 213.8844 - mean_absolute_error: 11.164 - ETA: 30:10 - loss: 213.3308 - mean_absolute_error: 11.163 - ETA: 29:54 - loss: 213.1179 - mean_absolute_error: 11.167 - ETA: 29:37 - loss: 212.8138 - mean_absolute_error: 11.169 - ETA: 29:25 - loss: 212.7157 - mean_absolute_error: 11.174 - ETA: 29:11 - loss: 212.5421 - mean_absolute_error: 11.177 - ETA: 28:56 - loss: 212.1867 - mean_absolute_error: 11.178 - ETA: 28:42 - loss: 211.8032 - mean_absolute_error: 11.180 - ETA: 28:28 - loss: 211.4079 - mean_absolute_error: 11.179 - ETA: 28:15 - loss: 211.2733 - mean_absolute_error: 11.182 - ETA: 28:02 - loss: 210.8588 - mean_absolute_error: 11.179 - ETA: 27:50 - loss: 210.4498 - mean_absolute_error: 11.178 - ETA: 27:37 - loss: 209.9327 - mean_absolute_error: 11.176 - ETA: 27:

like image 770
Poe Dator Avatar asked Sep 21 '18 11:09

Poe Dator


3 Answers

After a few tests I found that the error is related to tqdm import. Tqdm was used in a piece of code which was later rewritten withoout it. Even though I was not using tqdm in this notebook, just having it imported affected the keras output. To fix it I just commented out this line: from tqdm import tqdm and everything went fine, with nice keras progress bars. Not sure how exactly it conflicted with keras though...

like image 59
Poe Dator Avatar answered Oct 20 '22 01:10

Poe Dator


verbose=2 should be used for interactive outputs.

like image 34
Martin Krämer Avatar answered Oct 20 '22 01:10

Martin Krämer


Two things I would recommend:

  • Try restarting Jupyter Notebook server.
  • Try different browser other than what you're using; perhaps your browser got some update and it's breaking stuff! (usually, chrome is bad with notebooks!)
like image 24
Snehal Avatar answered Oct 20 '22 00:10

Snehal