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

ProgressMeter.next! prints as many bars as updates (on Jupyter notebook) #71

Open
davidbp opened this issue May 28, 2017 · 11 comments
Open

Comments

@davidbp
Copy link

davidbp commented May 28, 2017

Hello,

When I use ``ProgressMeter.next!(progressbar; showvalues = [(:epoch, epoch), (:acc, acc)])`

I get the following behaviour

Progress:   5%|██                                       |  ETA: 0:00:13
  epoch:  1
Progress:  10%|████                                     |  ETA: 0:00:11
  epoch:  2
Progress:  15%|██████                                   |  ETA: 0:00:09
  epoch:  3
Progress:  20%|████████                                 |  ETA: 0:00:08
  epoch:  4

I was expecting a single bar that changed, not multiple of them.
I have tried with @showprogressand it works as expected. This is the output:

fit!(percep, X_train, y_train, 20, 0.001)
Progress: 100%|█████████████████████████████████████████| Time: 0:00:07
@damiendr
Copy link

I have the same problem in IJulia and it seems to come from showvalues.

@timholy
Copy link
Owner

timholy commented Nov 15, 2017

What version are you two running? If it's 0.5.1, can you try Pkg.pin("ProgressMeter", v"0.5.0")?

@timholy
Copy link
Owner

timholy commented Nov 15, 2017

Oh, wait, this seems like a special case. Can you provide a complete minimum working example?

@damiendr
Copy link

damiendr commented Nov 15, 2017

The problem occurs with both 0.5.0 and 0.5.1 — I have IJulia 1.6.2.

Here is a working example:

using ProgressMeter
p = Progress(100)
for i in 1:100
    update!(p, i; showvalues = [(:test, 1.0)])
    sleep(0.01)
end

Here as a notebook: https://gist.github.com/damiendr/4d932dfe60d8de17fbbe9a2d215edcfc#file-progressmeter-ipynb
Github renders it just as it appears on my machine except that I have the text in colors.

@juliohm
Copy link

juliohm commented Mar 22, 2018

I have the same issue on IJulia whenever I try to print some variable besides just showing the progress bar.

@marius311
Copy link
Contributor

Dug into this since I was also hoping to have this work. Looks like it boils down to different behavior between notebook / REPL for:
image
and
image

The same issue appears to be true of the Python version of this (print("line1"); print("\033[F",end=''); print("line2")) so its probably a general issue for Jupyter notebooks.

I'm guessing Jupyter writes the output line-by-line and there's no way to go back once its up. But maybe there's a way to control the size of the output buffer? Anyone familiar with this?

@denizyuret
Copy link

Would it help solve the problem if we printed everything on one line?

@timholy
Copy link
Owner

timholy commented Sep 12, 2018

If IJulia can't support the equivalent of terminal movement escape codes then one has to find a completely independent solution on IJulia. That will presumably involve learning about how Jupyter handles output to the browser.

@mboratko
Copy link

As pointed out, Python suffers from the same difficulty. In that case I was using tqdm, and was able to easily switch to their tqdm_notebook functionality, which uses ipywidgets to display a much nicer progress bar that worked well within the notebook.

@VPetukhov
Copy link

I'm surprised that it's still an issue. I tried to replace update!(p, i; showvalues = [(:test, 1.0)]) with

update!(p, i)
ProgressMeter.printover(p.output, "test: 1.0", p.color)

and indeed it's almost working. It shows the desired message for some time, but almost immediately it got overwritten with the default message. So, maybe, fixing #33 could resolve this issue as well?

@3f6a
Copy link

3f6a commented Aug 3, 2023

Possibly related: #271

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