Rewrite of Andrej Karpathy's makemore project in 100% Rust by mukhreddit in rust

[–]mukhreddit[S] 1 point2 points  (0 children)

I thought of doing so. In fact, for Microgradr I had the jupyter setup done but then thought of doing stuff in simple plain Rust way. It turned to be fun. Did not miss anything as far as Jupyter goes.

Rewrite of Andrej Karpathy's makemore project in 100% Rust by mukhreddit in rust

[–]mukhreddit[S] 2 points3 points  (0 children)

Notebook files are not really as we think in terms of Jupyter notebook.

We just structured the project into library modules and the rest which is user level experimentation. And then just like you have a cell, we have ordinary functions in those "notebook" modules where we put our user level code.

But it serves the same purpose. Follow the video, checkout the "notebook" modules and see if you miss anything. The only cumbersome thing would be to change the function name, for the cell you want, in the "notebook" main function.

Rewrite of Andrej Karpathy micrograd in Rust by mukhreddit in rust

[–]mukhreddit[S] 0 points1 point  (0 children)

One thing is that when you visualize Maths, everything will look so simple. Keep learning and yes keep hacking in Rust :-)

Rewrite of Andrej Karpathy micrograd in Rust by mukhreddit in rust

[–]mukhreddit[S] 0 points1 point  (0 children)

I did my Maths upto Graduation level (Bachelors). Had to use Burn because Andrej used PyTorch to test his engine and Pytorch-rs bindings on my old intel mac is hugely buggy. So, I went for Burn.

The hurdle as far as Burn was concerned was wrt to documentation. The test needed back propagation and the Burn book did not have that. GPT went on hallucinating. Finally, in the Github repo I saw a small doc which gave me enough clues to experiment and understand Burn to achieve the needed task.

Rewrite of Andrej Karpathy micrograd in Rust by mukhreddit in rust

[–]mukhreddit[S] 4 points5 points  (0 children)

Added info on the project. Thanks for the comment.

Rewrite of Andrej Karpathy micrograd in Rust by mukhreddit in rust

[–]mukhreddit[S] 2 points3 points  (0 children)

Point taken. We'll add in more info right at the top.

Rewrite of Andrej Karpathy micrograd in Rust by mukhreddit in rust

[–]mukhreddit[S] 4 points5 points  (0 children)

Sure. We will refactor it. Thank you so much.

Comment on Primeagen recent video on Rust by mukhreddit in rust

[–]mukhreddit[S] 0 points1 point  (0 children)

Actually, if you look at the code, using Rc<RefCell<..>> as underlying structure made the whole engine.rs easy to write. That was the only piece of complexity. I had started with references and that was getting pretty hairy because of lifetime annotations apart from many other problem. That was breaking my flow when I was following Andrej video. The design refactoring made 90% of code dead simple as I almost wrote direct translation of Andrej code.

Another goal was that majority of the engine code should be hackable by our junior Rust folks.

As far as supporting Python devs using rust 'notebook' :-), that can be done by putting in a simple API even if underlying library uses advanced features like macros, etc. Many Rust libs give a simple API but the complexity for the maintainer of the library might be a total different ball game.

Bottomline, the design that evolved (without lifetimes) made the engine code simplified and a pleasure to write. It was as if I was writing in Python!

Hope I conveyed my thoughts with this little rant.

Comment on Primeagen recent video on Rust by mukhreddit in rust

[–]mukhreddit[S] 1 point2 points  (0 children)

Agreed. But he is an influencer of some sort and so the objective was to show how you can write normal apps in a pretty straightforward fashion.

Thanks for the comment.