3 ms·
I had good fun transliterating it to Rust as a learning experience (https://github.com/stochastical/microgpt-rs https://github.com/stochastical/microgpt-rs). Th
by subset 7mo ago
I had good fun transliterating it to Rust as a learning experience (https://github.com/stochastical/microgpt-rs https://github.com/stochastical/microgpt-rs). The trickiest part was working out how to represent the autograd graph data structure with Rust types. I'm finalising some small tweaks to make it run in the browser via WebAssmebly and then compile it up for my blog :) Andrej's code is really quite poetic, I love how much it packs into such a concise program
- hei-lima 7mo agoGreat work! Might do it too in some other language...
- pmarreck 7mo agoZig, here. Anything but Python
- O5vYtytb 7mo agoAt least python can do this exercise without pulling 3rd party dependencies :)
- justinhj 7mo agoWhat's missing from Zig and its std lib for this?
- moderation 7mo agoZig version [0] doesn't need any external dependencies. 0. https://tangled.org/m17e.co/microgpt https://tangled.org/m17e.co/microgpt
- pmarreck 7mo agoSweet! Presumably this one is even faster than the JS?
- thomasmg 7mo agoI got a convertion to Java. It worked (at least I think...) in the first try. Then I want to convert this to my own programming language (which traspiles to C). I like those tiny projects very much!
- amelius 7mo agoStoring the partial derivatives into the weights structure is quite the hack, to be honest. But everybody seems to do it like that.
- jtesp 7mo agohow did you do the transliteration/port?
- subset 7mo agoHandwritten! (aka no LLM assistance :) It wasn't transpiled or anything like that. I've been meaning to post a little about it on my blog; just been caught up with other stuff atm. One thing that was a _little_ frustrating coming from Python, though, was the need to rely on crates for basic things like random number generation and network requests. It pulls in a lot, even if you only need a little. I understand the Rust community prefers it that way as it's easier to evolve rather than be stuck with backwards-compatability requirements. But I still missed "batteries included" Python.
- jtesp 7mo agonice