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.5.1447.tar.gz
.
File metadata
- Download URL: mlprodict-0.5.1447.tar.gz
- Upload date:
- Size: 396.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffba0716a2e6bac60fa9ea83efb36cbb623334aca115bfd35fce29854dcd3f25 |
|
MD5 | 002ae229868885ddcd3ba63eff152b26 |
|
BLAKE2b-256 | c3934e672918b53a2c7970d30873efc3b51386503929ea1813e8e973ae1954c8 |
File details
Details for the file mlprodict-0.5.1447-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a2c4f6077aa40fbdd6dcfe1b270f01732b1d0532a094259c05ad6b3b9d56af9 |
|
MD5 | 172f5808dab85ab214200e5b2d388679 |
|
BLAKE2b-256 | e36f55ad119127a6d53f97264bd5aee8f0797696485d6961417dd2154d4f6b76 |
File details
Details for the file mlprodict-0.5.1447-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 20.2 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a7585225b4d30e6d267a1297c6c086c6c0d9d6defb861864eafd745950e198f |
|
MD5 | eadfeef658cfd2deb344b9436e03e1d3 |
|
BLAKE2b-256 | 0e7564f16653d9a182357ac99c0aaee7e95d366b444aad312daf95d620e3f3ef |
File details
Details for the file mlprodict-0.5.1447-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d0e7e92b4b44912e036daff1540fe3082562607b24c168bdbeda4b5a71a747d |
|
MD5 | 4c6dd65e7b84f256846d3c52383f40a0 |
|
BLAKE2b-256 | 2aeb28e6140517134b239be9ba20354b6a866432f6f3b163571626eca08d9777 |
File details
Details for the file mlprodict-0.5.1447-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db127b0001b86cd6b021c11113c93a97721e99162708422294e0f53a6ef837a |
|
MD5 | 5c4fc06ce3cd50730679f7f7c5f37e6b |
|
BLAKE2b-256 | fd6c35adbdb4c7754e1fe34da712495645d0998e02862c82b87c5e60193cd2f5 |
File details
Details for the file mlprodict-0.5.1447-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 20.9 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb82aca17e8436704a1f7d93b30bf599d95997b90202de07eeb7c29a2ea6717f |
|
MD5 | 6c5e02b64983cdf93a2fc011a0f3abb1 |
|
BLAKE2b-256 | 141d7e627cab80a04c9992cc3b4f3beb33a6f4d90459148211f38168046b44f3 |
File details
Details for the file mlprodict-0.5.1447-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: mlprodict-0.5.1447-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 248c1a1862135be2fe7fc699c81401afc51cd041bc7d9a6cca357fcc953e8aa8 |
|
MD5 | 68b6a88f335aa08f8c7dcba88b55e22b |
|
BLAKE2b-256 | ac897f170bcbc7c91a522bd93494afd809074796c9d5a4758d93a8d216e0eabe |