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

Space between lines keeps increasing #21

Open
ghost opened this issue Nov 16, 2017 · 10 comments
Open

Space between lines keeps increasing #21

ghost opened this issue Nov 16, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Nov 16, 2017

When I use the TQDM with Keras, it works well but each time an epoch is added, the space between the train loop progressbar and the epoch loop progressbar keeps increasing. It is anoying when I have several epoch. Here is an example:

image

@dzubo
Copy link

dzubo commented Dec 29, 2017

Same in my case.
MacOS, Google Chrome.

I looked at the HTML code of the widget and discovered that every 'inner loop' leaves this code:

<div class="output_area">
    <div class="prompt"></div>
    <div class="output_subarea jupyter-widgets-view"></div>
</div>

So the code above repeats itself as many times as the number of the epochs.
And this div's have nonzero height - that's why every inner loop adds blank spaces.

Maybe that is because the author of original TQDM changed something in the code.

@janfreyberg
Copy link

I think that's actually more a jupyter thing. What could fix this is if instead of generating a new tqdm for each epoch, it actually just re-uses the old one and manually sets n to zero.

(Of course, only when leave_inner = False)

@phausamann
Copy link

This is an issue with ipywidgets (#1845). The only fix so far is to revert to ipywidgets 6.0.1

@starfys
Copy link

starfys commented Mar 6, 2018

Here's an implementation of @janfreyberg 's suggestion master...starfys:master

Note: The tqdm.monitor_interval = 0 at the top is unrelated, but helps with a different issue I was having (tqdm/tqdm#481)

Overall, this is a hack, and probably shouldn't be merged, but is useful in the meantime. The real issue is in ipywidgets (jupyter-widgets/ipywidgets#1845)

@phausamann
Copy link

Fixed in ipywidgets 7.2.0

Update your ipywidgets package to the latest version if you have this problem.

@guillochon
Copy link

Just FYI I am still getting this with ipywidgets 7.2.1. I'd prefer to turn off the inner progress bar entirely, there a way to do that?

@alexisdrakopoulos
Copy link

Still getting this on ipywidgets 7.4.2, have there been any other fixes/workarounds?

@TiagoCortinhal
Copy link

TiagoCortinhal commented Nov 29, 2018

@alexisdrakopoulos > Still getting this on ipywidgets 7.4.2, have there been any other fixes/workarounds?

I found one!!
jupyter-widgets/ipywidgets#1845 (comment)

You can use the following as a workaround:

from IPython.core.display import HTML
HTML("""
<style>
.p-Widget.jp-OutputPrompt.jp-OutputArea-prompt:empty {
  padding: 0;
  border: 0;
}
</style>
""")

@marcosterland
Copy link

The workaround by @TiagoCortinhal worked for me. But I had to wrap it with the display function:

from keras_tqdm import TQDMNotebookCallback
display(HTML("""
    <style>
        .p-Widget.jp-OutputPrompt.jp-OutputArea-prompt:empty {
              padding: 0;
              border: 0;
        }
    </style>
"""))

@tommedema
Copy link

This is the only workaround that worked for me in JupyterLab:

from IPython.core.display import HTML

# See https://github.com/bstriner/keras-tqdm/issues/21#issuecomment-443019223
display(HTML("""
    <style>
        .jp-OutputArea-child:has(.jp-OutputArea-prompt:empty) {
              padding: 0 !important;
        }
    </style>
"""))

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

9 participants