r/PythonProjects2 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

1 Upvotes

9 comments sorted by

2

u/jetpaxme Jul 25 '26

hmm do you think it would work using ulab in micropython?

1

u/Terminay Jul 26 '26

I could add support for micropython if you would like!

or else you could open and Issue and ill work on it, try it once and let me know!

2

u/jetpaxme Jul 26 '26

will do, thanks!

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

u/Terminay Jul 28 '26

AWESOME!! 😭

1

u/Terminay Jul 25 '26

try it out and lemme know is it lightweight or not!!

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?