A fast, extensible progress bar for Julia. This is a Julia clone of the great Python package tqdm
.
Run the following in a julia prompt:
using Pkg
Pkg.add("ProgressBars")
julia> using ProgressBars
julia> for i in ProgressBar(1:100000) #wrap any iterator
#code
end
100.00%┣████████████████████████████████████████████████▉┫ 100000/100000 [00:12<00:00 , 8616.43 it/s]
There is a tqdm
alias, so that people coming from python will feel right at home :)
julia> using ProgressBars
julia> for i in tqdm(1:100000) #wrap any iterator
#code
end
100.00%┣████████████████████████████████████████████████▉┫ 100000/100000 [00:12<00:00 , 8616.43 it/s]
Or with a set description (e.g. for loss values when training neural networks)
julia> iter = ProgressBar(1:100)
for i in iter
# ... Neural Network Training Code
loss = exp(-i)
set_description(iter, string(@sprintf("Loss: %.2f", loss)))
end
Loss: 0.02 3.00%┣█▌ ┫ 3/100 00:00<00:02, 64.27 it/s]
Postfixes are also possible, if that's your kind of thing:
julia> iter = ProgressBar(1:100)
for i in iter
# ... Neural Network Training Code
loss = exp(-i)
set_postfix(iter, Loss=@sprintf("%.2f", loss))
end
100.0%┣████████████████████████████████████████████┫ 1000/1000 [00:02<00:00, 420.4 it/s, Loss: 0.37]
Now with added support for Threads.@threads for
:
julia> a = []
Threads.@threads for i in ProgressBar(1:1000)
push!(a, i * 2)
end
100.00%┣█████████████████████████████████████████████████████▉┫ 1000/1000 00:00<00:00, 28753.50 it/s]