summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-mlprodict.spec271
-rw-r--r--sources1
3 files changed, 273 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..2d5b2fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/mlprodict-0.9.1883.tar.gz
diff --git a/python-mlprodict.spec b/python-mlprodict.spec
new file mode 100644
index 0000000..ba9e88f
--- /dev/null
+++ b/python-mlprodict.spec
@@ -0,0 +1,271 @@
+%global _empty_manifest_terminate_build 0
+Name: python-mlprodict
+Version: 0.9.1883
+Release: 1
+Summary: Python Runtime for ONNX models, other helpers to convert machine learned models in C++.
+License: MIT
+URL: http://www.xavierdupre.fr/app/mlprodict/helpsphinx/index.html
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5b/d2/7f643bb8432e9c7961becb4f44e0e0f8455dffa92344c6e4ca7b4d18d232/mlprodict-0.9.1883.tar.gz
+
+Requires: python3-pybind11
+Requires: python3-numpy
+Requires: python3-onnx
+Requires: python3-scipy
+Requires: python3-cython
+Requires: python3-jinja2
+Requires: python3-scikit-learn
+Requires: python3-skl2onnx
+Requires: python3-onnxruntime
+Requires: python3-scipy
+Requires: python3-pandas
+Requires: python3-mlinsights
+Requires: python3-lightgbm
+Requires: python3-xgboost
+Requires: python3-mlstatpy
+Requires: python3-onnxruntime-extensions
+Requires: python3-scikit-learn
+Requires: python3-skl2onnx
+Requires: python3-scikit-learn
+Requires: python3-skl2onnx
+Requires: python3-lightgbm
+Requires: python3-mlinsights
+Requires: python3-xgboost
+Requires: python3-scikit-learn
+Requires: python3-skl2onnx
+Requires: python3-onnxruntime
+Requires: python3-scikit-learn
+Requires: python3-onnxruntime
+Requires: python3-onnxruntime-extensions
+
+%description
+*mlprodict* was initially started to help implementing converters
+to *ONNX*. The main features is a python runtime for
+*ONNX* (class `OnnxInference
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/mlprodict/onnxrt/onnx_inference.html>`_),
+visualization tools
+(see `Visualization
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/api/tools.html#visualization>`_),
+and a `numpy API for ONNX
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/tutorial/numpy_api_onnx.html>`_).
+The package also provides tools to compare
+predictions, to benchmark models converted with
+`sklearn-onnx <https://github.com/onnx/sklearn-onnx/tree/master/skl2onnx>`_.
+ import numpy
+ 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
+ from mlprodict import __max_supported_opset__, get_ir_version
+ 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),
+ black_op={'LinearRegressor'},
+ target_opset=__max_supported_opset__)
+ print("ONNX:", str(model_onnx)[:200] + "\n...")
+ # Predictions with onnxruntime
+ model_onnx.ir_version = get_ir_version(__max_supported_opset__)
+ oinf = OnnxInference(model_onnx, runtime='onnxruntime1')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)})
+ print("ONNX output:", ypred)
+ # Measuring the maximum difference.
+ print("max abs diff:", measure_relative_difference(expected, ypred['variable']))
+ # And the python runtime
+ oinf = OnnxInference(model_onnx, runtime='python')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)},
+ verbose=1, fLOG=print)
+ print("ONNX output:", 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]
+The code is available at
+`GitHub/mlprodict <https://github.com/sdpython/mlprodict/>`_
+and has `online documentation <http://www.xavierdupre.fr/app/
+mlprodict/helpsphinx/index.html>`_.
+
+%package -n python3-mlprodict
+Summary: Python Runtime for ONNX models, other helpers to convert machine learned models in C++.
+Provides: python-mlprodict
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-cffi
+BuildRequires: gcc
+BuildRequires: gdb
+%description -n python3-mlprodict
+*mlprodict* was initially started to help implementing converters
+to *ONNX*. The main features is a python runtime for
+*ONNX* (class `OnnxInference
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/mlprodict/onnxrt/onnx_inference.html>`_),
+visualization tools
+(see `Visualization
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/api/tools.html#visualization>`_),
+and a `numpy API for ONNX
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/tutorial/numpy_api_onnx.html>`_).
+The package also provides tools to compare
+predictions, to benchmark models converted with
+`sklearn-onnx <https://github.com/onnx/sklearn-onnx/tree/master/skl2onnx>`_.
+ import numpy
+ 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
+ from mlprodict import __max_supported_opset__, get_ir_version
+ 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),
+ black_op={'LinearRegressor'},
+ target_opset=__max_supported_opset__)
+ print("ONNX:", str(model_onnx)[:200] + "\n...")
+ # Predictions with onnxruntime
+ model_onnx.ir_version = get_ir_version(__max_supported_opset__)
+ oinf = OnnxInference(model_onnx, runtime='onnxruntime1')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)})
+ print("ONNX output:", ypred)
+ # Measuring the maximum difference.
+ print("max abs diff:", measure_relative_difference(expected, ypred['variable']))
+ # And the python runtime
+ oinf = OnnxInference(model_onnx, runtime='python')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)},
+ verbose=1, fLOG=print)
+ print("ONNX output:", 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]
+The code is available at
+`GitHub/mlprodict <https://github.com/sdpython/mlprodict/>`_
+and has `online documentation <http://www.xavierdupre.fr/app/
+mlprodict/helpsphinx/index.html>`_.
+
+%package help
+Summary: Development documents and examples for mlprodict
+Provides: python3-mlprodict-doc
+%description help
+*mlprodict* was initially started to help implementing converters
+to *ONNX*. The main features is a python runtime for
+*ONNX* (class `OnnxInference
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/mlprodict/onnxrt/onnx_inference.html>`_),
+visualization tools
+(see `Visualization
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/api/tools.html#visualization>`_),
+and a `numpy API for ONNX
+<http://www.xavierdupre.fr/app/mlprodict/helpsphinx/tutorial/numpy_api_onnx.html>`_).
+The package also provides tools to compare
+predictions, to benchmark models converted with
+`sklearn-onnx <https://github.com/onnx/sklearn-onnx/tree/master/skl2onnx>`_.
+ import numpy
+ 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
+ from mlprodict import __max_supported_opset__, get_ir_version
+ 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),
+ black_op={'LinearRegressor'},
+ target_opset=__max_supported_opset__)
+ print("ONNX:", str(model_onnx)[:200] + "\n...")
+ # Predictions with onnxruntime
+ model_onnx.ir_version = get_ir_version(__max_supported_opset__)
+ oinf = OnnxInference(model_onnx, runtime='onnxruntime1')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)})
+ print("ONNX output:", ypred)
+ # Measuring the maximum difference.
+ print("max abs diff:", measure_relative_difference(expected, ypred['variable']))
+ # And the python runtime
+ oinf = OnnxInference(model_onnx, runtime='python')
+ ypred = oinf.run({'X': X[:5].astype(numpy.float32)},
+ verbose=1, fLOG=print)
+ print("ONNX output:", 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]
+The code is available at
+`GitHub/mlprodict <https://github.com/sdpython/mlprodict/>`_
+and has `online documentation <http://www.xavierdupre.fr/app/
+mlprodict/helpsphinx/index.html>`_.
+
+%prep
+%autosetup -n mlprodict-0.9.1883
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-mlprodict -f filelist.lst
+%dir %{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.1883-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..294feb5
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+b2efe11fc250f3de35e182cb6e22a3fb mlprodict-0.9.1883.tar.gz