--- id: skl2onnx version: "1.20.0" license: Apache License v2.0 license_treatment: permissive maintenance: active --- # skl2onnx — Convert scikit-learn models to ONNX License: permissive · Maintenance: active · Downloads: 2.6M/mo ## What it is and what it does skl2onnx is a converter that takes trained scikit-learn models and transforms them into ONNX (Open Neural Network Exchange) format, an open standard for representing machine learning models. Once converted, models can be deployed and executed using ONNX Runtime or other ONNX-compatible inference engines. The package handles scikit-learn pipelines, individual models, and transformers, with support for external converters to extend functionality. It supports opset 21 and has been tested against onnxruntime. The conversion workflow is straightforward: train a scikit-learn model, call to_onnx() with a sample input, serialize the result, and load it into an inference runtime. This is useful for deploying models in production environments where portability or interoperability with other ML frameworks matter. Use it for: - Deploy scikit-learn models to production systems using ONNX Runtime. - Convert scikit-learn pipelines to a portable format that can run on different platforms or languages via ONNX. - Integrate scikit-learn models into applications that require ONNX format for compatibility with existing inference infrastructure. - Export trained models for use in edge devices or resource-constrained environments where ONNX Runtime is available. - Register external converters to extend ONNX support for models or transformers from external libraries. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts trained scikit-learn models to ONNX format for deployment and high-performance inference using ONNX Runtime or other compatible tools. Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real deployment problem—getting scikit-learn models into a portable format. Use it if you need to deploy scikit-learn models outside their native environment. ## Install pip install skl2onnx uv add skl2onnx poetry add skl2onnx ## Installing skl2onnx Before you install: Low friction install with only two runtime dependencies (onnx and scikit-learn). The package is actively maintained with a recent release and no known vulnerabilities. License in practice: Apache License v2.0 is permissive, allowing use in commercial and private projects with minimal restrictions beyond attribution and liability disclaimers. Quickstart: pip install skl2onnx from skl2onnx import to_onnx clr = RandomForestClassifier() clr.fit(X_train, y_train) onx = to_onnx(clr, X[:1]) with open("model.onnx", "wb") as f: f.write(onx.SerializeToString()) Verify before relying: - Whether all scikit-learn model types are supported or only a subset (documentation mentions 'Supported scikit-learn Models' page but list not provided) - Performance improvement magnitude when using ONNX Runtime versus native scikit-learn inference - Compatibility with custom scikit-learn estimators or only built-in models - Whether external converters can be registered for models from libraries beyond scikit-learn ## Package facts - License: Apache License v2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 2.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags scikit-learn to ONNX conversion, sklearn model export ONNX, convert scikit-learn models, ONNX model deployment, model format conversion, ONNX runtime compatibility, machine learning model export, model-export, ml-deployment, inference-optimization [View on SkillFed](https://skillfed.io/packages/skl2onnx) · [View on PyPI](https://pypi.org/project/skl2onnx/)