Live data from Hacker News

Transform ML models into native code with zero dependencies

github.com

21–27 of 27 posts

Re: Transform ML models into native code with zero dependencies

#21
post #12

Does anyone know of a similar idea for neural networks? As far as I can tell, you need the entire framework (which requires a heavy, 1.5 GB docker image) to apply a trained model, even though in theory you only need matrix multiplication and a few activation functions. Related: https://onnx.ai/

Try Yolo: https://pjreddie.com/darknet/yolo/ . It's written in C.

Re: Transform ML models into native code with zero dependencies

#22

There are similar libraries for converting ML models into SQL queries. However, the important part of most models is not the `estimator.fit(X, y)` line, but all the things that are done to X before fitting or estimating.

Hard to say one part is more important than the other. A working model that does its job in code is incredibly useful.

Re: Transform ML models into native code with zero dependencies

#24
One big improvement for this project would be to somehow break out the model weights into an additional dependency, or file, to allow for very large models and separation between "code" and "data. Overall, pretty good, the alternative approach is either using the underlying C++ lib, or just doing some matrix math!

Re: Transform ML models into native code with zero dependencies

#25

One big improvement for this project would be to somehow break out the model weights into an additional dependency, or file, to allow for very large models and separation between "code" and "data. Overall, pretty good, the alternative approach is either using the underlying C++ lib, or just doing some matrix math!

The package sklearn-porter supports the separation between inference (code) and model data (parameters) by passing `export_data=True` while transpiling the trained estimator.

Re: Transform ML models into native code with zero dependencies

#26

One big improvement for this project would be to somehow break out the model weights into an additional dependency, or file, to allow for very large models and separation between "code" and "data. Overall, pretty good, the alternative approach is either using the underlying C++ lib, or just doing some matrix math!

The package sklearn-porter supports the separation between inference (code) and model data (parameters) by passing `export_data=True` while transpiling the trained estimator.

Thanks, I'm coming over from R and will certainly check that out!

Re: Transform ML models into native code with zero dependencies

#27
Hey folks! One of the authors here. Somehow this post went under our radar. Thank you all for your comments and feedback! We're super excited about the amount of attention that this project has gotten. This motivates us to work even harder and to deliver even more cool stuff. Go and JS support are definitely on our agenda. Shouldn't be too hard to add since we first transform models into AST and only then interpret AST into a specific language. I might be wrong but this is a very crucial detail that distinguishes m2cgen from similar projects like sklearn-porter. As a result models are completely decoupled from languages and can be worked on independently. Once you implement a particular model, all languages get its support automatically. And vice versa. Plus we support XGBoost and LightGBM :) SVM support is something we'll be focusing on from the modeling side of things. Any contributions are much appreciated!
Post reply on HN