Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make it not print on multiple lines? #16

Open
keldLundgaard opened this issue Aug 1, 2017 · 2 comments
Open

How to make it not print on multiple lines? #16

keldLundgaard opened this issue Aug 1, 2017 · 2 comments

Comments

@keldLundgaard
Copy link

keldLundgaard commented Aug 1, 2017

I really like the promise of this library, but I can't seem to make it work as I would like. How can I make it not print several lines? I just want one progress bar for the full training run.

I am adding this to Keras callbacks:
TQDMCallback() # I can add leave_inner=False, leave_outer=False with seemingly no effect.

Here is an example of the output in my Jupyter notebook when I do model.fit(...). Tqdm works fine, i.e. I can do a loop and have a progress bar that displays the progress on a single line.

Training: 0%| | 0/9 [00:00<?, ?it/s]
Epoch: 4: 0%| | 0/94267 [00:00<?, ?it/s]
Epoch: 4 - loss: 3.725 30%|███ | 28672/94267 [00:00<00:00, 246462.35it/s]
Epoch: 4 - loss: 3.724 56%|█████▋ | 53248/94267 [00:00<00:00, 244136.09it/s]
Epoch: 4 - loss: 3.723 83%|████████▎ | 77824/94267 [00:00<00:00, 235065.89it/s]
Epoch: 4 - loss: 3.724, val_loss: 3.722100%|██████████| 94267/94267 [00:00<00:00, 158220.92it/s]
Training: 11%|█ | 1/9 [00:00<00:04, 1.93it/s]
Epoch: 5: 0%| | 0/94267 [00:00<?, ?it/s]
Epoch: 5 - loss: 3.724 30%|███ | 28672/94267 [00:00<00:00, 253709.54it/s]
Epoch: 5 - loss: 3.723 61%|██████ | 57344/94267 [00:00<00:00, 258542.12it/s]
Epoch: 5 - loss: 3.723 91%|█████████ | 86016/94267 [00:00<00:00, 260625.83it/s]
Epoch: 5 - loss: 3.724, val_loss: 3.722100%|██████████| 94267/94267 [00:00<00:00, 125086.89it/s]
Training: 22%|██▏ | 2/9 [00:00<00:03, 1.98it/s]
Epoch: 6: 0%| | 0/94267 [00:00<?, ?it/s]
Epoch: 6 - loss: 3.724 26%|██▌ | 24576/94267 [00:00<00:00, 242534.19it/s]
Epoch: 6 - loss: 3.724 56%|█████▋ | 53248/94267 [00:00<00:00, 243923.50it/s]
Epoch: 6 - loss: 3.724 83%|████████▎ | 77824/94267 [00:00<00:00, 243747.74it/s]
Epoch: 6 - loss: 3.724, val_loss: 3.722100%|██████████| 94267/94267 [00:00<00:00, 163744.60it/s]
Training: 33%|███▎ | 3/9 [00:01<00:03, 1.99it/s]
Epoch: 7: 0%| | 0/94267 [00:00<?, ?it/s]
Epoch: 7 - loss: 3.723 30%|███ | 28672/94267 [00:00<00:00, 249677.85it/s]
Epoch: 7 - loss: 3.724 56%|█████▋ | 53248/94267 [00:00<00:00, 242249.26it/s]
Epoch: 7 - loss: 3.724 78%|███████▊ | 73728/94267 [00:00<00:00, 222114.27it/s]
Epoch: 7 - loss: 3.724100%|█████████▉| 94208/94267 [00:00<00:00, 214223.28it/s]
Epoch: 7 - loss: 3.724, val_loss: 3.722100%|██████████| 94267/94267 [00:00<00:00, 1461.41it/s]
Training: 44%|████▍ | 4/9 [00:02<00:02, 1.91it/s]
Epoch: 8: 0%| | 0/94267 [00:00<?, ?it/s]
Epoch: 8 - loss: 3.724 22%|██▏ | 20480/94267 [00:00<00:00, 201277.37it/s]
Epoch: 8 - loss: 3.724 52%|█████▏ | 49152/94267 [00:00<00:00, 213755.21it/s]
Epoch: 8 - loss: 3.724 78%|███████▊ | 73728/94267 [00:00<00:00, 211569.82it/s]
Epoch: 8 - loss: 3.724, val_loss: 3.722100%|██████████| 94267/94267 [00:00<00:00, 164307.50it/s]

Relevant package versions in my conda-environment:

ipykernel==4.6.1
ipython==6.1.0
ipython-genutils==0.2.0
ipywidgets==6.0.0
jupyter==1.0.0
jupyter-client==5.1.0
jupyter-console==5.1.0
Keras==2.0.5
keras-tqdm==2.0.1

@bstriner
Copy link
Owner

bstriner commented Aug 2, 2017

TQDMNotebookCallback looks the best in Jupyter, although you can use the other callback. TQDMCallback uses a lot of control characters to add and remove lines, which can look funky in jupyter but looks good if you're running on the command line. The code to delete old lines probably doesn't look right in Jupyter without TQDMNotebookCallback.

Is there some reason you want the text progress bars instead of the widget even though you are in Jupyter?

@keldLundgaard
Copy link
Author

A couple of reasons. First, for whatever reason, the widgets won't show in my notebook. I get the following error message, and can't seem to get the remedies that are suggested online to work. I don't think this has anything to do with keras-tqdm though.

Widget Javascript not detected. It may not be installed or enabled properly.

Second, I like how concise the text-based tqdm loading bars look. The notebook tqdm loading bar has a lower information density, i.e. take up more lines for the same information. I haven't had any problems with normal text-based tqdm in notebooks for for-loops.

However, irrespective of my preference to text-based versus widget, the text-based bars should work as tqdm loading bars, right?

Thanks again for creating this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants