Karpathy's microgpt.py ported to sw-MLPL three ways -- faithful, idiomatic, compact -- compared with the Python original and the Rust port, with literate programs, equations and results.
A ML Study group stepped through Karpathy's python code on Colab, and we looked at a Rust version I created. I was asked to create a more readable version in my ML/array programming language.
This work is helping me with dogfooding my language. I am now adding several improvements to the language to improve ergonomics, readability, and possibly speed (one example in sw-MLPL actually runs faster than my Rust port). I was able to express the code more compactly than the Python or Rust versions.
The planned improvements will allow me to simplify many downstream demo projects that have been working around language deficiencies.
The link includes literate programming explanations of the code with math equations.
0 comments
No comments yet.
Related stories
- Lobsters · 86 points · about 1 year ago
- Hacker News · 2 points · about 15 hours ago
- DEV Community · 13 points · 7 days ago
- Writing Rust code that's faster than state-of-the-art libraries by asking agents to make the code fasterminimaxir.comLobsters · 5 points · 8 days ago
- Hacker News · 8 points · 6 days ago
- Lobsters · 54 points · over 7 years ago