Python Runtime for ONNX models, other helpers to convert machine learned models in C++.
Project description
mlprodict
mlprodict explores ways to productionize machine learning predictions. One approach uses ONNX and tries to implement a runtime in python / numpy or wraps onnxruntime into a single class. The package provides tools to compare predictions, to benchmark models converted with sklearn-onnx. The second approach consists in converting a pipeline directly into C and is not much developed.
from sklearn.linear_model import LinearRegression from sklearn.datasets import load_iris from mlprodict.onnxrt import OnnxInference from mlprodict.onnxrt.validate.validate_difference import ( measure_relative_difference) import numpy iris = load_iris() X = iris.data[:, :2] y = iris.target lr = LinearRegression() lr.fit(X, y) # Predictions with scikit-learn. expected = lr.predict(X[:5]) print(expected) # Conversion into ONNX. from mlprodict.onnx_conv import to_onnx model_onnx = to_onnx(lr, X.astype(numpy.float32)) # Predictions with onnxruntime oinf = OnnxInference(model_onnx, runtime='onnxruntime1') ypred = oinf.run({'X': X[:5]}) print(ypred) # Measuring the maximum difference. print(measure_relative_difference(expected, ypred))
Installation
Installation from pip should work unless you need the latest development features.
pip install mlprodict
The package includes a runtime for onnx. That’s why there is a limited number of dependencies. However, some features relies on sklearn-onnx, onnxruntime, scikit-learn. They can be installed with the following instructions:
pip install mlprodict[all]
Some functions used in that package may rely on features implemented in PR still pending. In that case, you should install sklearn-onnx from:
pip install git+https://github.com/xadupre/sklearn-onnx.git@jenkins
If needed, the development version should be directy installed from github:
pip install git+https://github.com/sdpython/mlprodict.git
On Linux and Windows, the package must be compiled with openmp. Full instructions to build the module and run the documentation are described in config.yml for Linux. When this project becomes more stable, it will changed to be using official releases. The code is available at GitHub/mlprodict and has online documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mlprodict-0.7.1624.tar.gz
.
File metadata
- Download URL: mlprodict-0.7.1624.tar.gz
- Upload date:
- Size: 607.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c1c7641fdca7994994402eb3d94c632b58b9d4bbf5f14eb134a0e26299514e9 |
|
MD5 | 9cd1111c3fe5c3792a86fb87bdd4a3ce |
|
BLAKE2b-256 | e473116f5b6ec29392e4da619861efaf864f725739e3363b5a9478146d53584f |
File details
Details for the file mlprodict-0.7.1624-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ffc851fa2a34f4688e196439cf984c24469b23cf8630ad241ccba0d77dc059c |
|
MD5 | bb87518f4d762290917afbfbba2918d2 |
|
BLAKE2b-256 | d4489f4ba2940287dd0664e1a51bf549498134bccd67fc50a05660dc2cb79561 |
File details
Details for the file mlprodict-0.7.1624-cp39-cp39-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp39-cp39-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 15.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f4be4d3746d8a18ba70a392c933345e7013e78e1c659ce888f244710d929d2c |
|
MD5 | e2699c772e3df2158e3c804c8945b135 |
|
BLAKE2b-256 | f2c08215da5a3114c8278bce3b9c756f6328d1e2c6bf8cf0dca7572c3f9fad2f |
File details
Details for the file mlprodict-0.7.1624-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d1ac0bf47e89c16a29d70cc7327d41011ca930a0845878de41f399613cb9a64 |
|
MD5 | 97275c9f74f94c0de10ed0438cfdf24d |
|
BLAKE2b-256 | 2acc2b651ba1b693e65b0207b0191bc1c992247678d41394d574a0a8afe765c0 |
File details
Details for the file mlprodict-0.7.1624-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f32ade9156a00dff70e85992e82f062bca450813e04c02bb2b9a60cb41890ca |
|
MD5 | 672f42c65143d6ec444f9eff5b8c72bb |
|
BLAKE2b-256 | 676d9d9bfbe4422679d6376f66754389db716c4c79ee8244820b10246342c981 |
File details
Details for the file mlprodict-0.7.1624-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a34030c4319ad1880262a04a4f57684921b13ba22ba51cd99eac13f166ae6c5 |
|
MD5 | 5419622196590e3f6e523b0701727efb |
|
BLAKE2b-256 | 75ae97497cb565051a5d47aa7daf021cbfe622b8d410b5dea7778cfa4b24fb25 |
File details
Details for the file mlprodict-0.7.1624-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.5 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a97fffa8fe485aaf34e00bf1aef27327751a57abc9ff8725e4e3947521f5948e |
|
MD5 | a47fd2d3e351aa586077f59f8006300f |
|
BLAKE2b-256 | d42fae320371c7776c5b869434d303cedafbf2f74c698ffd0e214ff02c43f914 |
File details
Details for the file mlprodict-0.7.1624-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 24.1 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f16dbaafbc81b0951b8fd061b0f2d554923067cc5f43875673a16dca475f354b |
|
MD5 | 28e01bc30d6441b1e20e13c0b68ac0a8 |
|
BLAKE2b-256 | 2df27c8b3d20227c05e11715e72d219349eb5fb428320d9811b1f5b4b4a11d08 |
File details
Details for the file mlprodict-0.7.1624-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.7.1624-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e40747d17f7f7ec5d0474d76e76f5a896ab4c21eef6101504fb4253b9ac56f2 |
|
MD5 | 225bda7ec0487edf3ae093417347a573 |
|
BLAKE2b-256 | c6736e6f758d2d51258eaf23d3b2fa99072b04d7543d2048abdf4acedf2d5ca2 |