Skip to content

Commit

Permalink
Add support for Python310 and ORT 1.12 (#1975)
Browse files Browse the repository at this point in the history
* python3.10 support

Signed-off-by: Deyu Huang <[email protected]>

* add tests except keras

Signed-off-by: Deyu Huang <[email protected]>

* add protubuf limit for tf 2.9.1 and ort to 1.12.0

Signed-off-by: Deyu Huang <[email protected]>

* onnxruntime-extensions/yaml is not support with python3.10

Signed-off-by: Deyu Huang <[email protected]>

* remove onnxruntime-extensions support in py310

Signed-off-by: Deyu Huang <[email protected]>
Co-authored-by: Jay Zhang <[email protected]>
  • Loading branch information
hwangdeyu and fatcat-z authored Jul 29, 2022
1 parent f30f41f commit 087045d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The common issues we run into we try to document here [Troubleshooting Guide](Tr

| Build Type | OS | Python | TensorFlow | ONNX opset | Status |
| --- | --- | --- | --- | --- | --- |
| Unit Test - Basic | Linux, MacOS<sup>\*</sup>, Windows<sup>\*</sup> | 3.7-3.9 | 1.13-1.15, 2.1-2.8 | 9-16 | [![Build Status](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_apis/build/status/unit_test?branchName=main)](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_build/latest?definitionId=16&branchName=main) |
| Unit Test - Full | Linux, MacOS, Windows | 3.7-3.9 | 1.13-1.15, 2.1-2.8 | 9-16 | [![Build Status](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_apis/build/status/unit_test-matrix?branchName=main)](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_build/latest?definitionId=18&branchName=main) | |
| Unit Test - Basic | Linux, MacOS<sup>\*</sup>, Windows<sup>\*</sup> | 3.7-3.10 | 1.13-1.15, 2.1-2.8 | 9-16 | [![Build Status](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_apis/build/status/unit_test?branchName=main)](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_build/latest?definitionId=16&branchName=main) |
| Unit Test - Full | Linux, MacOS, Windows | 3.7-3.10 | 1.13-1.15, 2.1-2.8 | 9-16 | [![Build Status](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_apis/build/status/unit_test-matrix?branchName=main)](https://dev.azure.com/tensorflow-onnx/tensorflow-onnx/_build/latest?definitionId=18&branchName=main) | |
<br/>

## Supported Versions
Expand All @@ -42,7 +42,7 @@ You can install tf2onnx on top of tf-1.x or tf-2.x.

### Python

We support Python ```3.7-3.9```.
We support Python ```3.7-3.10```.
Note that on windows for Python > 3.7 the protobuf package doesn't use the cpp implementation and is very slow - we recommend to use Python 3.7 for that reason.

## Prerequisites
Expand Down
4 changes: 2 additions & 2 deletions ci_build/azure_pipelines/pretrained_model_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- template: 'templates/job_generator.yml'
parameters:
# 2.7, tf
# 2.8, tf
python_versions: ['3.7']
tf_versions: ['1.15.5','2.8.0']
job:
Expand All @@ -24,7 +24,7 @@ jobs:

- template: 'templates/job_generator.yml'
parameters:
# 2.8, tf
# 2.9, tf
python_versions: ['3.9']
tf_versions: ['2.9.1']
job:
Expand Down
2 changes: 1 addition & 1 deletion ci_build/azure_pipelines/templates/job_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
tf_versions: ['']
onnx_versions: ['']
onnx_opsets: ['16', '15', '14', '13', '12', '11', '10', '9']
onnx_backends: {onnxruntime: ['1.11.0']}
onnx_backends: {onnxruntime: ['1.12.0']}
job: {}
run_setup: 'True'
report_coverage: 'False'
Expand Down
17 changes: 14 additions & 3 deletions ci_build/azure_pipelines/templates/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ steps:
pip install pytest pytest-cov pytest-runner coverage graphviz requests pyyaml pillow pandas parameterized sympy coloredlogs flatbuffers
pip install $(CI_PIP_TF_NAME) $(CI_PIP_ONNX_NAME)
# protobuf release version 4.21.0 has some Python changes which is not compatible with tensorflow so far.
# Protobuf 3.20 results in linker errors on Windows in TF.
# Protobuf 4.0 is binary incompatible with what C++ TF uses.
# https://github.com/tensorflow/tensorflow/blob/c3337c73306b2b859d82fe130912f18e6a1c5c23/tensorflow/tools/pip_package/setup.py#L88
pip uninstall -y protobuf
pip install "protobuf<4.21.0"
pip install "protobuf<3.20.0"
# TF < 2.7 reuires numpy <= 1.19, but onnxruntime >= 1.11 requires numpy >= 1.21
if [[ $CI_TF_VERSION < 2.7 ]] && [[ $CI_ONNX_BACKEND == "onnxruntime" ]] ;
Expand Down Expand Up @@ -40,7 +42,12 @@ steps:
if [[ $CI_TF_VERSION == 2.* ]] ;
then
pip install onnxruntime-extensions==0.3.1
# onnxruntime-extensions is not supported Python 3.10 so far.
# https://github.com/microsoft/onnxruntime-extensions/issues/273
if [[ $CI_PYTHON_VERSION != 3.10 ]] ;
then
pip install onnxruntime-extensions==0.3.1
fi
if [[ $CI_TF_VERSION == 2.3* ]] ;
then
pip install tensorflow-text==${CI_TF_VERSION}
Expand All @@ -64,6 +71,10 @@ steps:
if [[ $CI_TF_VERSION == 2.8* ]] ;
then
pip install "tensorflow-text>=2.8,<2.9"
fi
if [[ $CI_TF_VERSION == 2.9* ]] ;
then
pip install "tensorflow-text>=2.9,<2.10"
else
pip install tensorflow-text
fi
Expand Down
2 changes: 1 addition & 1 deletion ci_build/azure_pipelines/unit_test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ stages:
- template: 'templates/job_generator.yml'
parameters:
platforms: ['linux', 'windows']
python_versions: ['3.9']
python_versions: ['3.9', '3.10']
tf_versions: ['2.8.0']
onnx_opsets: ['']
job:
Expand Down
13 changes: 12 additions & 1 deletion ci_build/azure_pipelines/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ stages:
- template: 'templates/job_generator.yml'
parameters:
# tf 2.9
python_versions: ['3.8']
python_versions: ['3.10']
tf_versions: ['2.9.1']
onnx_opsets: ['']
job:
Expand Down Expand Up @@ -168,5 +168,16 @@ stages:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/job_generator.yml'
parameters:
python_versions: ['3.10']
platforms: ['windows']
tf_versions: ['2.9.1']
onnx_opsets: ['16']
job:
steps:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/combine_test_coverage.yml'

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ def run(self):
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9']
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10']
)
2 changes: 2 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,8 @@ def func(x, y):
y_val = np.array(i / 10, np.float32)
self._run_test_case(func, [_OUTPUT], {_INPUT: x_val, _INPUT1: y_val}, rtol=1e-6, atol=2e-5)

# https://github.com/microsoft/onnxruntime/issues/12302
@skip_onnxruntime_backend("resize op can't work well under Cubic mode with ORT 1.12")
@check_tf_min_version("2.0", "Results are slightly different in tf1")
@check_opset_min_version(11, "resize bicubic")
def test_resize_bicubic(self):
Expand Down

0 comments on commit 087045d

Please sign in to comment.