Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI with onnxruntime==1.19.0 #1125

Merged
merged 8 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
numpy_version: '>=1.21.1,<2.0'
scipy_version: '>=1.7.0'
onnx_version: 'onnx==1.16.0'
onnxrt_version: 'onnxruntime==1.18.0'
onnxrt_version: 'onnxruntime==1.19.0'
python_version: '3.12'
- python_version: '3.12'
documentation: 0
numpy_version: '>=1.21.1,<2.0'
scipy_version: '>=1.7.0'
onnx_version: 'onnx==1.16.0'
onnxrt_version: 'onnxruntime==1.18.0'
onnxrt_version: 'onnxruntime==1.18.1'
sklearn_version: '==1.4.2'
- python_version: '3.11'
documentation: 1
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/windows-macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ jobs:
os: [windows-latest, macos-latest]
sklearn_version: ['==1.5.0', '==1.4.2', '==1.3.2', '==1.2.2', '==1.1.3']
include:
- sklearn_version: '==1.5.0'
python_version: '3.12'
numpy_version: '>=1.21.1,<2.0'
scipy_version: '>=1.7.0'
onnx_version: 'onnx==1.16.0'
onnxrt_version: 'onnxruntime<1.20.0'
- sklearn_version: '==1.5.0'
python_version: '3.11'
numpy_version: '>=1.21.1,<2.0'
scipy_version: '>=1.7.0'
onnx_version: 'onnx==1.16.0'
onnxrt_version: 'onnxruntime==1.18.0'
onnxrt_version: 'onnxruntime<1.19.0'
- python_version: '3.11'
numpy_version: '>=1.21.1,<2.0'
scipy_version: '>=1.7.0'
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/bench_plot_onnxruntime_decision_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on DecisionTree.
"""

# Authors: Xavier Dupré (benchmark)
from io import BytesIO
from time import perf_counter as time
Expand Down Expand Up @@ -101,7 +102,7 @@ def bench(n_obs, n_features, max_depths, methods, repeat=10, verbose=False):

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -123,7 +124,7 @@ def bench(n_obs, n_features, max_depths, methods, repeat=10, verbose=False):
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
if r2 >= repeated:
break
end = time()
Expand Down
9 changes: 5 additions & 4 deletions benchmarks/bench_plot_onnxruntime_hgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on RandomForestRegressor.
"""

import warnings
from io import BytesIO
from time import perf_counter as time
Expand Down Expand Up @@ -100,7 +101,7 @@ def bench(

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -122,7 +123,7 @@ def bench(
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
if r2 >= repeated:
break
end = time()
Expand All @@ -140,7 +141,7 @@ def bench(
try:
assert_almost_equal(p1.ravel(), p2.ravel(), decimal=5)
except AssertionError as e:
warnings.warn(str(e))
warnings.warn(str(e), stacklevel=0)
return res


Expand All @@ -158,7 +159,7 @@ def plot_results(df, verbose=False):
for n_obs in sorted(set(df.n_obs)):
for max_depth in sorted(set(df.max_depth)):
pos = 0
for n_jobs in [1]:
for _n_jobs in [1]:
a = ax[row, pos]
if row == ax.shape[0] - 1:
a.set_xlabel("N features", fontsize="x-small")
Expand Down
18 changes: 9 additions & 9 deletions benchmarks/bench_plot_onnxruntime_linreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on LinearRegression.
"""

import warnings
from io import BytesIO
from time import perf_counter as time
Expand Down Expand Up @@ -100,7 +101,7 @@ def bench(n_obs, n_features, fit_intercepts, methods, repeat=10, verbose=False):

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(loop_repeat):
for _r in range(loop_repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -120,21 +121,20 @@ def bench(n_obs, n_features, fit_intercepts, methods, repeat=10, verbose=False):
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
end = time()
obs["time_ort"] = (end - st) / repeated
res.append(obs)
if verbose and (len(res) % 1 == 0 or n >= 10000):
print("bench", len(res), ":", obs)

# checks that both produce the same outputs
if n <= 10000:
if len(p1.shape) == 1 and len(p2.shape) == 2:
p2 = p2.ravel()
try:
assert_almost_equal(p1.ravel(), p2.ravel(), decimal=5)
except AssertionError as e:
warnings.warn(str(e))
if n <= 10000 and len(p1.shape) == 1 and len(p2.shape) == 2:
p2 = p2.ravel()
try:
assert_almost_equal(p1.ravel(), p2.ravel(), decimal=5)
except AssertionError as e:
warnings.warn(str(e), stacklevel=0)
return res


Expand Down
5 changes: 3 additions & 2 deletions benchmarks/bench_plot_onnxruntime_logreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on LogisticRegression.
"""

# Authors: Xavier Dupré (benchmark)
from io import BytesIO
from time import perf_counter as time
Expand Down Expand Up @@ -113,7 +114,7 @@ def bench(n_obs, n_features, fit_intercepts, methods, repeat=10, verbose=False):

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -133,7 +134,7 @@ def bench(n_obs, n_features, fit_intercepts, methods, repeat=10, verbose=False):
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
end = time()
obs["time_ort"] = (end - st) / repeated
res.append(obs)
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/bench_plot_onnxruntime_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on RandomForest.
"""

# Authors: Xavier Dupré (benchmark)
from io import BytesIO
from time import perf_counter as time
Expand Down Expand Up @@ -118,7 +119,7 @@ def bench(

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x)
Expand All @@ -140,7 +141,7 @@ def bench(
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
if r2 >= repeated:
break
end = time()
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/bench_plot_onnxruntime_random_forest_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on RandomForestRegressor.
"""

import sys
import warnings
from io import BytesIO
Expand Down Expand Up @@ -137,7 +138,7 @@ def bench(
# creates different inputs to avoid caching
# in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -159,7 +160,7 @@ def bench(
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
if r2 >= repeated:
break
end = time()
Expand Down Expand Up @@ -191,7 +192,7 @@ def bench(
p1.ravel(), p2.ravel(), decimal=5
)
except AssertionError as e:
warnings.warn(str(e))
warnings.warn(str(e), stacklevel=0)
return res


Expand Down
7 changes: 4 additions & 3 deletions benchmarks/bench_plot_onnxruntime_svm_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Benchmark of onnxruntime on SVM.
"""

# Authors: Xavier Dupré (benchmark)
import warnings
from io import BytesIO
Expand Down Expand Up @@ -86,7 +87,7 @@ def bench(n_obs, n_features, kernels, methods, repeat=10, verbose=False):

# creates different inputs to avoid caching in any ways
Xs = []
for r in range(repeat):
for _r in range(repeat):
x = np.empty((n, nfeat))
x[:, :] = rand(n, nfeat)[:, :]
Xs.append(x.astype(np.float32))
Expand All @@ -108,7 +109,7 @@ def bench(n_obs, n_features, kernels, methods, repeat=10, verbose=False):
r2 = 0
for X in Xs:
p2 = fct2(X)
r2 += 1
r2 += 1 # noqa: SIM113
if r2 >= repeated:
break
end = time()
Expand All @@ -126,7 +127,7 @@ def bench(n_obs, n_features, kernels, methods, repeat=10, verbose=False):
try:
assert_almost_equal(p1.ravel(), p2.ravel(), decimal=3)
except AssertionError as e:
warnings.warn(str(e))
warnings.warn(str(e), stacklevel=0)
return res


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/post_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def svm_models():
tick.label.set_fontsize(8)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(8)
pos += 1
pos += 1 # noqa: SIM113

fig.tight_layout()
fig.savefig("svm_model.png", dpi=1000)
Expand Down
4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.

import os
Expand All @@ -10,7 +8,7 @@
import skl2onnx

sys.path.append(os.path.abspath("exts"))
from github_link import make_linkcode_resolve # noqa
from github_link import make_linkcode_resolve


# -- Project information -----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Let's use the API to compute the prediction
of a simple logistic regression model.
"""

import skl2onnx
import onnxruntime
import onnx
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_benchmark_cdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
generated/scipy.spatial.distance.cdist.html>`_
function computes pairwise distances.
"""

from pprint import pprint
from timeit import Timer
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/plot_benchmark_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
does not handle string type. This cannot be part of the final ONNX pipeline
and must be removed. Look for comment starting with ``---`` below.
"""

import skl2onnx
import onnx
import sklearn
Expand Down Expand Up @@ -105,7 +106,7 @@

pipe.predict_proba(X_digits[:2])

for i, step in enumerate(steps):
for _i, step in enumerate(steps):
onnx_step = step["onnx_step"]
sess = rt.InferenceSession(
onnx_step.SerializeToString(), providers=["CPUExecutionProvider"]
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/plot_black_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
The first converter to change its behaviour depending on a black list
of operators is for model *GaussianMixture*.
"""

import onnxruntime
import onnx
import numpy
Expand Down Expand Up @@ -167,11 +168,11 @@
#################################
# **Versions used for this example**

import sklearn # noqa
import sklearn

print("numpy:", numpy.__version__)
print("scikit-learn:", sklearn.__version__)
import skl2onnx # noqa
import skl2onnx

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from' Note documentation

Module 'skl2onnx' is imported with both 'import' and 'import from'.

print("onnx: ", onnx.__version__)
print("onnxruntime: ", onnxruntime.__version__)
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/plot_cast_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
based on the assumption ``(x / y)`` is usually different from
``x * ( 1 / y)`` on a computer.
"""

import onnxruntime
import onnx
import os
Expand Down Expand Up @@ -169,11 +170,11 @@
#################################
# **Versions used for this example**

import sklearn # noqa
import sklearn

print("numpy:", np.__version__)
print("scikit-learn:", sklearn.__version__)
import skl2onnx # noqa
import skl2onnx

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from' Note documentation

Module 'skl2onnx' is imported with both 'import' and 'import from'.

print("onnx: ", onnx.__version__)
print("onnxruntime: ", onnxruntime.__version__)
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_complex_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
does not handle string type. This cannot be part of the final ONNX pipeline
and must be removed. Look for comment starting with ``---`` below.
"""

import os
import pprint
import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_convert_decision_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
++++++++++++++++++++++++++++

"""

import numpy
import sklearn
from sklearn.datasets import load_iris
Expand Down
Loading
Loading