m2cgen (Model 2 Code Generator) is an open-source tool that converts trained machine learning models into native, dependency-free code in a wide range of programming languages. Train a model in Python as usual, and m2cgen emits an equivalent implementation in Java, C, Go, JavaScript, C#, Rust and many other languages, so the model can run anywhere — including environments where installing a Python ML stack is impossible. The project has around 3,000 stars on GitHub.
Deploying a scikit-learn or XGBoost model usually drags along the whole training framework, which is a problem for embedded systems, mobile apps, legacy enterprise stacks and latency-sensitive services. m2cgen sidesteps this by translating the learned model itself — the trees, coefficients and support vectors — into plain source code with zero external dependencies. The generated code is readable and self-contained, so it can be audited, compiled and shipped like any other part of your codebase. It supports a broad set of estimators, from linear models and random forests to gradient boosting libraries such as XGBoost and LightGBM.
m2cgen is completely free and open source under the MIT license. There is no commercial version, hosted service or paid support tier required to use it.
m2cgen is for data scientists and engineers who need to ship classical ML models into production systems written in other languages, or onto constrained hardware where a full ML runtime is not an option.