ProgressMeter.jl
ProgressMeter.jl copied to clipboard
ProgressMeter.next! prints as many bars as updates (on Jupyter notebook)
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 @showprogress
and it works as expected. This is the output:
fit!(percep, X_train, y_train, 20, 0.001)
Progress: 100%|█████████████████████████████████████████| Time: 0:00:07
I have the same problem in IJulia and it seems to come from showvalues
.
What version are you two running? If it's 0.5.1, can you try Pkg.pin("ProgressMeter", v"0.5.0")
?
Oh, wait, this seems like a special case. Can you provide a complete minimum working example?
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.
I have the same issue on IJulia whenever I try to print some variable besides just showing the progress bar.
Dug into this since I was also hoping to have this work. Looks like it boils down to different behavior between notebook / REPL for:
and
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?
Would it help solve the problem if we printed everything on one line?
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.
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.
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 https://github.com/timholy/ProgressMeter.jl/issues/33 could resolve this issue as well?
Possibly related: https://github.com/timholy/ProgressMeter.jl/issues/271