M
Modular•7mo ago
Martin Dudek

Basic Progress Bar for Mojo

Based on a discussion we had here on Discord, I implemented a basic progress bar in Mojo and put it on Github https://github.com/dorjeduck/mopro Just when i published it, @Ryulord pointed out another progress bar implementation to me, which he is about to introduce here. His implementation looks for sure more advanced, so look out for it (i leave it to him to post the link here .when he is ready) Nevertheless, I wiill keep my implementation on github for the time being, may it benefit.
GitHub
GitHub - dorjeduck/mopro: Progress Bar for Mojo
Progress Bar for Mojo. Contribute to dorjeduck/mopro development by creating an account on GitHub.
7 Replies
Martin Dudek
Martin DudekOP•7mo ago
should that be the default setting? 😉
No description
Martin Dudek
Martin DudekOP•7mo ago
Today it dawned on me that the usage of progress_bar is quite similar to Mojo's vectorize. Feeling a burst of creativity, I decided to combine them into one function: vectorize_bar
from mopro import vectorize_bar

alias simd_width=16

fn main():
@parameter
fn vectorized_step[width:Int](i: Int):
sleep(0.1 * width)
vectorize_bar[vectorized_step,simd_width](total=9*16+15)
from mopro import vectorize_bar

alias simd_width=16

fn main():
@parameter
fn vectorized_step[width:Int](i: Int):
sleep(0.1 * width)
vectorize_bar[vectorized_step,simd_width](total=9*16+15)
The vectorized progress bar increases less smoothly since it is updated in width steps after each function call—nothing comes for free, right? 😉
Martin Dudek
Martin DudekOP•7mo ago
vectorization rocks 🚀 well we know this already but having both progress_barand vectorize_baravailable, visualizes this nicely ... 😉 (output of https://github.com/dorjeduck/progressbar.mojo/blob/main/example_vectorizebar_2.mojo)
No description
Martin Dudek
Martin DudekOP•7mo ago
To wrap up this project, I added the possibility for runtime customization today. For instance, you can now display additional information, like the current value of the loss function, alongside the progress bar. (as we know it from tqdm) Any feedback, feature suggestions, or pull requests are most welcome!
No description
Jack Clayton
Jack Clayton•7mo ago
Wow epic @Martin Dudek, we should use this for the official installer 🔥
Martin Dudek
Martin DudekOP•7mo ago
Thanks, @Jack Clayton! Of course feel free to modify and improve it to fit specific needs if you really want to use it for the installer Currently, the customization options are quite basic, and I'm unsure how it performs across different systems, as console output can be tricky. I'm looking forward to community feedback and PRs to help make it stable and useful for a variety of use cases.
ModularBot
ModularBot•7mo ago
Congrats @Martin Dudek, you just advanced to level 12!
Want results from more Discord servers?
Add your server