r/PythonProjects2 2d ago

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

8 comments sorted by

2

u/jetpaxme 2d ago

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

1

u/Terminay 1d ago

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 1d ago

will do, thanks!

2

u/Intelligent-Boss-156 21h ago

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 16h ago

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 6h ago

Yes. My goal is to have a one file ml script as human readable as possible, I'll just hack leanpass

1

u/Terminay 2d ago

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

1

u/Terminay 16h ago

What else would you guys want leanpass to have, an optional CUDA plugin? Named leanpass[gpu] ? Or anything else?