Skip to content

Commit

Permalink
Fix style issues and update CI to use onnxruntime==1.17.0 (#1067)
Browse files Browse the repository at this point in the history
* Fix style issues and update CI to use onnxruntime==1.17.0

Signed-off-by: Xavier Dupre <[email protected]>

* fix 3.12

Signed-off-by: Xavier Dupre <[email protected]>

---------

Signed-off-by: Xavier Dupre <[email protected]>
  • Loading branch information
xadupre authored Feb 8, 2024
1 parent 160c548 commit aacd1a3
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 32 deletions.
18 changes: 16 additions & 2 deletions .azure-pipelines/linux-conda-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ jobs:
strategy:
matrix:

Py311-Onnx150-Rt170-Skl140:
do.bench: '0'
python.version: '3.11' # onnxruntime-extensions needs to be update to switch to 3.12
numpy.version: '>=1.21.1'
scipy.version: '>=1.7.0'
onnx.version: 'onnx==1.15.0' # -i https://test.pypi.org/simple/ onnx==1.15.0rc2'
onnx.target_opset: ''
onnxrt.version: 'onnxruntime==1.17.0'
sklearn.version: '>=1.4.0'
pandas.version: ''
lgbm.version: ''
onnxcc.version: '>=1.8.1'
run.example: '1'

Py311-Onnx150-Rt163-Skl140:
do.bench: '0'
python.version: '3.11'
Expand All @@ -22,11 +36,11 @@ jobs:
onnx.version: 'onnx==1.15.0' # -i https://test.pypi.org/simple/ onnx==1.15.0rc2'
onnx.target_opset: ''
onnxrt.version: 'onnxruntime==1.16.3'
sklearn.version: '>=1.4.0'
sklearn.version: '==1.4.0'
pandas.version: ''
lgbm.version: ''
onnxcc.version: '>=1.8.1'
run.example: '1'
run.example: '0'

Py311-Onnx150-Rt161-Skl132:
do.bench: '0'
Expand Down
19 changes: 14 additions & 5 deletions .azure-pipelines/win32-conda-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,25 @@ jobs:
vmImage: 'windows-latest'
strategy:
matrix:
Py310-Onnx150-Rt163-Skl140:
Py311-Onnx150-Rt170-Skl140:
python.version: '3.11' # onnxruntime-extensions needs to be update to switch to 3.12
onnx.version: 'onnx==1.15.0' # '-i https://test.pypi.org/simple/ onnx==1.15.0rc2'
onnx.target_opset: ''
numpy.version: 'numpy>=1.22.3'
scipy.version: 'scipy'
onnxrt.version: 'onnxruntime==1.17.0'
onnxcc.version: 'onnxconverter-common>=1.8.1'
sklearn.version: '>=1.4.0'
Py311-Onnx150-Rt163-Skl140:
python.version: '3.11'
onnx.version: 'onnx==1.15.0' # '-i https://test.pypi.org/simple/ onnx==1.15.0rc2'
onnx.target_opset: ''
numpy.version: 'numpy>=1.22.3'
scipy.version: 'scipy'
onnxrt.version: 'onnxruntime==1.16.3'
onnxcc.version: 'onnxconverter-common>=1.8.1'
sklearn.version: '>=1.4.0'
Py310-Onnx150-Rt163-Skl131:
sklearn.version: '==1.4.0'
Py311-Onnx150-Rt163-Skl131:
python.version: '3.11'
onnx.version: 'onnx==1.15.0'
onnx.target_opset: ''
Expand All @@ -31,7 +40,7 @@ jobs:
onnxrt.version: 'onnxruntime==1.16.1'
onnxcc.version: 'onnxconverter-common>=1.8.1'
sklearn.version: '==1.3.1'
Py310-Onnx141-Rt160-Skl131:
Py311-Onnx141-Rt160-Skl131:
python.version: '3.11'
onnx.version: 'onnx==1.14.1'
onnx.target_opset: ''
Expand All @@ -40,7 +49,7 @@ jobs:
onnxrt.version: 'onnxruntime==1.16.0'
onnxcc.version: 'onnxconverter-common>=1.8.1'
sklearn.version: '>=1.3.1'
Py310-Onnx140-Rt151-Skl130:
Py311-Onnx140-Rt151-Skl130:
python.version: '3.11'
onnx.version: 'onnx==1.14.0'
onnx.target_opset: ''
Expand Down
1 change: 1 addition & 0 deletions docs/tutorial/plot_jfunction_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
A very simple pipeline and the first attempt to convert it into ONNX.
"""

import numpy as np
from numpy.testing import assert_allclose
from onnx.version_converter import convert_version
Expand Down
1 change: 1 addition & 0 deletions docs/tutorial/plot_transformer_discrepancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
All imports. It also registered onnx converters for :epkg:`xgboost`
and :epkg:`lightgbm`.
"""

import pprint
import numpy
from sklearn.pipeline import Pipeline
Expand Down
8 changes: 5 additions & 3 deletions skl2onnx/algebra/onnx_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,11 @@ def __str__(self):
return "{}({} in) -> {}".format(
self.__class__.__name__,
len(self.inputs) if self.inputs is not None else 0,
[str(o) for o in self.output_names]
if self.output_names is not None
else "?",
(
[str(o) for o in self.output_names]
if self.output_names is not None
else "?"
),
)

def set_onnx_name_prefix(self, onnx_prefix_name):
Expand Down
6 changes: 3 additions & 3 deletions skl2onnx/helpers/investigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def __init__(self, model):
model.decision_function
): # noqa
model._debug_decision_function = model.decision_function # noqa
self.methods[
"decision_function"
] = lambda model, X: model._debug_decision_function(X)
self.methods["decision_function"] = (
lambda model, X: model._debug_decision_function(X)
)

def __repr__(self):
"""
Expand Down
1 change: 0 additions & 1 deletion skl2onnx/sklapi/cast_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def _deprecate_positional_args(x):


class CastRegressor(RegressorMixin, BaseEstimator): # noqa

"""
Cast predictions into a specific types.
This should be used to minimize the conversion
Expand Down
1 change: 0 additions & 1 deletion skl2onnx/sklapi/cast_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def _deprecate_positional_args(x):


class CastTransformer(TransformerMixin, BaseEstimator):

"""
Cast features into a specific types.
This should be used to minimize the conversion
Expand Down
1 change: 0 additions & 1 deletion skl2onnx/sklapi/replace_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def _deprecate_positional_args(x):


class ReplaceTransformer(TransformerMixin, BaseEstimator):

"""
Replaces a value by another one.
It can be used to replace 0 by nan.
Expand Down
1 change: 1 addition & 0 deletions skl2onnx/sklapi/sklearn_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@file
@brief Overloads :epkg:`TfidfVectorizer` and :epkg:`CountVectorizer`.
"""

from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer

try:
Expand Down
1 change: 0 additions & 1 deletion skl2onnx/sklapi/woe_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def _deprecate_positional_args(x):


class WOETransformer(TransformerMixin, BaseEstimator):

"""
This transformer cannot be trained. It takes a list of intervals,
one list per columns, and returns for every feature the list
Expand Down
32 changes: 20 additions & 12 deletions skl2onnx/sklapi/woe_transformer_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ def __str__(self):
"Node(%s, is_left=%r, is_leaf=%r, feature=%r, "
"threshold=%r, value=%r, index=%r)%s"
% (
self.parent
if isinstance(self.parent, int)
else "id%r" % id(self.parent),
(
self.parent
if isinstance(self.parent, int)
else "id%r" % id(self.parent)
),
self.is_left,
self.is_leaf,
self.feature,
Expand All @@ -115,15 +117,21 @@ def __str__(self):
self.onnx_mode,
self.onnx_threshold,
self.onnx_value,
" -- %r" % self.intervals_
if hasattr(self, "intervals_")
else "",
" LL %r" % self.intervals_left_
if hasattr(self, "intervals_left_")
else "",
" RR %r" % self.intervals_right_
if hasattr(self, "intervals_right_")
else "",
(
" -- %r" % self.intervals_
if hasattr(self, "intervals_")
else ""
),
(
" LL %r" % self.intervals_left_
if hasattr(self, "intervals_left_")
else ""
),
(
" RR %r" % self.intervals_right_
if hasattr(self, "intervals_right_")
else ""
),
),
)
)
Expand Down
8 changes: 5 additions & 3 deletions tests/test_sklearn_classifiers_extreme.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def test_one_training_class(self):
onx = to_onnx(cl, x, target_opset=TARGET_OPSET, options={"zipmap": False})

for cls in [
(lambda onx: ReferenceEvaluator(onx, verbose=0))
if ReferenceEvaluator is not None
else None,
(
(lambda onx: ReferenceEvaluator(onx, verbose=0))
if ReferenceEvaluator is not None
else None
),
lambda onx: InferenceSession(
onx.SerializeToString(), providers=["CPUExecutionProvider"]
),
Expand Down

0 comments on commit aacd1a3

Please sign in to comment.