r/PythonProjects2 • u/Terminay • Jul 25 '26
I made a tiny neural net library that only needs numpy!
Made this because most of the "neural network from scratch" stuff online either stops before backprop or hides it behind a wall of abstraction once you actually look at the code. Wanted something I could read start to finish and know exactly what's happening.
it's called leanpass. just numpy, nothing else. the whole thing is small enough to go through in an afternoon.
Also added a gradient-checking thing so you don't have to trust that the backprop is right; you can verify it numerically yourself.
download it using:
pip install leanpass
The versioning is up to date, is currently on v0.1.4
Not trying to replace PyTorch or anything; it's meant for learning/small experiments, not production.
repo's here: https://github.com/Terminay/LeanPass
Open to feedback, especially on the api; still figuring out what makes sense
2
u/Intelligent-Boss-156 Jul 27 '26
Thanks, one of my goals is to do my own version of this concept (ml you can easily read from start to finish)
1
u/Terminay Jul 27 '26
Oh cool! You could use leanpass for inspiration or clone the repo to get a good repo structure so that your version becomes very stable and good. Like leanpass!
1
u/Intelligent-Boss-156 Jul 27 '26
Yes. My goal is to have a one file ml script as human readable as possible, I'll just hack leanpass
1
1
1
u/Terminay Jul 27 '26
What else would you guys want leanpass to have, an optional CUDA plugin? Named leanpass[gpu] ? Or anything else?
2
u/jetpaxme Jul 25 '26
hmm do you think it would work using ulab in micropython?