Transpile trained machine learning models into native code (Java, C, Python, Go, etc.) with zero dependencies.
m2cgen is a Python library that transpiles trained machine learning models into native source code across multiple programming languages like Java, C, Python, and Go. It solves the problem of deploying models in environments where Python or heavy dependencies are not feasible, enabling integration into embedded systems, mobile applications, or performance-critical services.
Machine learning engineers and developers who need to deploy models in production environments without Python runtimes, such as in C++ applications, JavaScript web apps, or resource-constrained devices.
Developers choose m2cgen for its zero-dependency output, extensive language support, and compatibility with popular ML frameworks, making model deployment flexible and portable across diverse tech stacks.
Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies
Supports 16+ programming languages including C, Java, Go, and JavaScript, enabling deployment in diverse environments from embedded systems to web apps, as listed in the README.
Covers linear models, SVMs, decision trees, random forests, and gradient boosting from scikit-learn, XGBoost, and LightGBM, providing wide utility for common ML tasks.
Generates self-contained code with zero runtime dependencies, perfect for constrained environments like serverless functions or mobile devices, as emphasized in the key features.
Maintains alignment with original model APIs, such as decision_function for SVMs or predict_proba for trees, ensuring predictable behavior post-transpilation.
Excludes frameworks like TensorFlow and PyTorch, limiting its utility for modern neural network-based models, which are not mentioned in the supported models table.
Large ensemble models can trigger recursion errors during code generation, requiring manual intervention to reduce estimators or increase recursion limits, as noted in the FAQ.
Generated code may produce slightly different results due to float64-only handling and language-specific floating-point implementations, a known issue acknowledged in the FAQ.
Open Source Computer Vision Library
A library for efficient similarity search and clustering of dense vectors.
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow
Convolutional Neural Networks
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.