Skip to content

Commit 6365d38

Browse files
authored
ONNX opset 17 with IR version 8 support (#2014)
* ONNX opset 17 with IR version 8 support Signed-off-by: Deyu Huang <[email protected]>
1 parent a587862 commit 6365d38

15 files changed

+362
-396
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The common issues we run into we try to document here [Troubleshooting Guide](Tr
2727

2828
tf2onnx will use the ONNX version installed on your system and installs the latest ONNX version if none is found.
2929

30-
We support and test ONNX opset-9 to opset-16. opset-6 to opset-8 should work but we don't test them.
30+
We support and test ONNX opset-9 to opset-17. opset-6 to opset-8 should work but we don't test them.
3131
By default we use ```opset-13``` for the resulting ONNX graph.
3232

3333
If you want the graph to be generated with a specific opset, use ```--opset``` in the command line, for example ```--opset 13```.
@@ -187,7 +187,7 @@ ONNX requires default values for graph inputs to be constant, while Tensorflow's
187187

188188
#### --opset
189189

190-
By default we use the opset 13 to generate the graph. By specifying ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 16``` would create a onnx graph that uses only ops available in opset 16. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
190+
By default we use the opset 13 to generate the graph. By specifying ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 17``` would create a onnx graph that uses only ops available in opset 17. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
191191

192192
#### --dequantize
193193

ci_build/azure_pipelines/keras2onnx_application_tests.yml

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,6 @@ jobs:
88
vmImage: 'ubuntu-latest'
99
strategy:
1010
matrix:
11-
Python37-onnx1.6:
12-
python.version: '3.7'
13-
ONNX_PATH: onnx==1.6.0
14-
INSTALL_KERAS: pip install keras==2.3.1
15-
UNINSTALL_KERAS:
16-
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
17-
INSTALL_ORT: pip install onnxruntime==1.8.0
18-
INSTALL_KERAS_RESNET: pip install keras-resnet
19-
INSTALL_TRANSFORMERS:
20-
INSTALL_NUMPY:
21-
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"
22-
23-
Python37-onnx1.9:
24-
python.version: '3.7'
25-
ONNX_PATH: onnx==1.9.0
26-
INSTALL_KERAS: pip install keras==2.3.1
27-
UNINSTALL_KERAS:
28-
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
29-
INSTALL_ORT: pip install onnxruntime==1.9.0
30-
INSTALL_KERAS_RESNET: pip install keras-resnet
31-
INSTALL_TRANSFORMERS:
32-
INSTALL_NUMPY:
33-
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"
34-
3511
Python37-onnx1.11-tf1.15:
3612
python.version: '3.7'
3713
ONNX_PATH: onnx==1.11.0
@@ -68,6 +44,18 @@ jobs:
6844
INSTALL_NUMPY:
6945
NIGHTLY_BUILD_TEST: python run_all_v2.py
7046

47+
Python310-onnx1.12-tf2.9:
48+
python.version: '3.10'
49+
ONNX_PATH: onnx==1.12.0
50+
INSTALL_KERAS:
51+
UNINSTALL_KERAS:
52+
INSTALL_TENSORFLOW: pip install tensorflow==2.9.0
53+
INSTALL_ORT: pip install onnxruntime==1.12.0
54+
INSTALL_KERAS_RESNET: pip install keras-resnet
55+
INSTALL_TRANSFORMERS: pip install transformers==4.12.0
56+
INSTALL_NUMPY:
57+
NIGHTLY_BUILD_TEST: python run_all_v2.py
58+
7159
steps:
7260
- template: 'templates/keras2onnx_application_tests.yml'
7361
parameters:
@@ -79,18 +67,6 @@ jobs:
7967
vmImage: 'windows-2019'
8068
strategy:
8169
matrix:
82-
Python37-onnx1.6:
83-
python.version: '3.7'
84-
ONNX_PATH: onnx==1.6.0
85-
INSTALL_KERAS: pip install keras==2.3.1
86-
UNINSTALL_KERAS:
87-
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
88-
INSTALL_ORT: pip install onnxruntime==1.9.0
89-
INSTALL_KERAS_RESNET: pip install keras-resnet
90-
INSTALL_TRANSFORMERS:
91-
INSTALL_NUMPY: pip install numpy==1.19.0
92-
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"
93-
9470
Python37-onnx1.9:
9571
python.version: '3.7'
9672
ONNX_PATH: onnx==1.9.0
@@ -115,18 +91,30 @@ jobs:
11591
INSTALL_NUMPY: pip install numpy==1.19.0
11692
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"
11793

118-
Python38-onnx1.11-tf2.9:
94+
Python38-onnx1.11-tf2.8:
11995
python.version: '3.8'
12096
ONNX_PATH: onnx==1.11.0
12197
INSTALL_KERAS:
12298
UNINSTALL_KERAS:
123-
INSTALL_TENSORFLOW: pip install tensorflow==2.9.0
99+
INSTALL_TENSORFLOW: pip install tensorflow==2.8.0
124100
INSTALL_ORT: pip install onnxruntime==1.11.0
125101
INSTALL_KERAS_RESNET: pip install keras-resnet
126102
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
127103
INSTALL_NUMPY:
128104
NIGHTLY_BUILD_TEST: python run_all_v2.py
129105

106+
Python310-onnx1.12-tf2.9:
107+
python.version: '3.10'
108+
ONNX_PATH: onnx==1.12.0
109+
INSTALL_KERAS:
110+
UNINSTALL_KERAS:
111+
INSTALL_TENSORFLOW: pip install tensorflow==2.9.0
112+
INSTALL_ORT: pip install onnxruntime==1.12.0
113+
INSTALL_KERAS_RESNET: pip install keras-resnet
114+
INSTALL_TRANSFORMERS: pip install transformers==4.12.0
115+
INSTALL_NUMPY:
116+
NIGHTLY_BUILD_TEST: python run_all_v2.py
117+
130118
steps:
131119
- template: 'templates/keras2onnx_application_tests.yml'
132120
parameters:

ci_build/azure_pipelines/keras2onnx_unit_test.yml

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,27 @@ jobs:
1616
INSTALL_ORT: pip install onnxruntime==1.9.0
1717
INSTALL_NUMPY: pip install numpy==1.19.0
1818

19-
Python38-tf2.2:
20-
python.version: '3.8'
21-
ONNX_PATH: onnx==1.11.0
22-
TENSORFLOW_PATH: tensorflow-cpu==2.2.0
23-
INSTALL_ORT: pip install onnxruntime==1.11.0
24-
INSTALL_NUMPY: pip install numpy==1.19.0
25-
26-
Python38-tf2.3:
27-
python.version: '3.8'
28-
ONNX_PATH: onnx==1.11.0
29-
TENSORFLOW_PATH: tensorflow-cpu==2.3.0
30-
INSTALL_ORT: pip install onnxruntime==1.11.0
31-
INSTALL_NUMPY: pip install numpy==1.19.0
32-
3319
Python38-tf2.5:
3420
python.version: '3.8'
3521
ONNX_PATH: onnx==1.11.0
3622
TENSORFLOW_PATH: tensorflow-cpu==2.5.0
3723
INSTALL_ORT: pip install onnxruntime==1.11.0
3824
INSTALL_NUMPY: pip install numpy==1.19.0
3925

40-
Python38-tf2.8:
41-
python.version: '3.8'
26+
Python39-tf2.8:
27+
python.version: '3.9'
4228
ONNX_PATH: onnx==1.11.0
4329
TENSORFLOW_PATH: tensorflow-cpu==2.8.0
4430
INSTALL_ORT: pip install onnxruntime==1.11.0
4531
INSTALL_NUMPY:
4632

33+
Python310-tf2.9:
34+
python.version: '3.9'
35+
ONNX_PATH: onnx==1.12.0
36+
TENSORFLOW_PATH: tensorflow-cpu==2.9.0
37+
INSTALL_ORT: pip install onnxruntime==1.12.0
38+
INSTALL_NUMPY:
39+
4740
############ Pure Keras Unit Tests ############
4841
Keras-Py37-tf1.15.0:
4942
python.version: '3.7'
@@ -70,6 +63,14 @@ jobs:
7063
INSTALL_ORT: pip install onnxruntime==1.11.0
7164
INSTALL_NUMPY: pip install numpy==1.19.0
7265

66+
Keras-Py310-tf2.9.0:
67+
python.version: '3.10'
68+
ONNX_PATH: -i onnx==1.12.0
69+
KERAS: keras==2.9.0
70+
TENSORFLOW_PATH: tensorflow==2.9.0
71+
INSTALL_ORT: pip install onnxruntime==1.11.0
72+
INSTALL_NUMPY: pip install numpy==1.23.0
73+
7374
steps:
7475
- template: 'templates/keras2onnx_unit_test.yml'
7576
parameters:
@@ -88,34 +89,27 @@ jobs:
8889
INSTALL_ORT: pip install onnxruntime==1.9.0
8990
INSTALL_NUMPY: pip install numpy==1.19.0
9091

91-
Python37-tf2.2:
92-
python.version: '3.7'
93-
ONNX_PATH: onnx==1.11.0
94-
TENSORFLOW_PATH: tensorflow-cpu==2.2.0
95-
INSTALL_ORT: pip install onnxruntime==1.11.0
96-
INSTALL_NUMPY: pip install numpy==1.19.0
97-
98-
Python37-tf2.3:
99-
python.version: '3.7'
100-
ONNX_PATH: onnx==1.11.0
101-
TENSORFLOW_PATH: tensorflow-cpu==2.3.0
102-
INSTALL_ORT: pip install onnxruntime==1.11.0
103-
INSTALL_NUMPY: pip install numpy==1.19.0
104-
10592
Python37-tf2.5:
10693
python.version: '3.7'
10794
ONNX_PATH: onnx==1.11.0
10895
TENSORFLOW_PATH: tensorflow-cpu==2.5.0
10996
INSTALL_ORT: pip install onnxruntime==1.11.0
11097
INSTALL_NUMPY: pip install numpy==1.19.0
11198

112-
Python37-tf2.8:
99+
Python38-tf2.8:
113100
python.version: '3.8'
114101
ONNX_PATH: onnx==1.11.0
115102
TENSORFLOW_PATH: tensorflow-cpu==2.8.0
116103
INSTALL_ORT: pip install onnxruntime==1.11.0
117104
INSTALL_NUMPY:
118105

106+
Python310-tf2.9:
107+
python.version: '3.10'
108+
ONNX_PATH: onnx==1.12.0
109+
TENSORFLOW_PATH: tensorflow-cpu==2.9.0
110+
INSTALL_ORT: pip install onnxruntime==1.12.0
111+
INSTALL_NUMPY:
112+
119113
############ Pure Keras Unit Tests ############
120114
Keras-Py37-tf1.15.0:
121115
python.version: '3.7'
@@ -140,6 +134,14 @@ jobs:
140134
INSTALL_ORT: pip install onnxruntime==1.11.0
141135
INSTALL_NUMPY: pip install numpy==1.19.0
142136

137+
Keras-Py310-tf2.9.0:
138+
python.version: '3.10'
139+
ONNX_PATH: onnx==1.12.0
140+
KERAS: keras==2.9.0
141+
TENSORFLOW_PATH: tensorflow==2.9.0
142+
INSTALL_ORT: pip install onnxruntime==1.12.0
143+
INSTALL_NUMPY:
144+
143145
steps:
144146
- template: 'templates/keras2onnx_unit_test.yml'
145147
parameters:

ci_build/azure_pipelines/onnxruntime_nightly_test.yml

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,7 @@ stages:
4242

4343
- template: 'templates/job_generator.yml'
4444
parameters:
45-
platforms: ['linux']
46-
python_versions: ['3.9']
47-
tf_versions: ['2.9.1']
48-
onnx_opsets: ['']
49-
onnx_backends: {onnxruntime: ['nightly']}
50-
job:
51-
steps:
52-
- template: 'unit_test.yml'
53-
report_coverage: 'True'
54-
55-
- template: 'templates/job_generator.yml'
56-
parameters:
57-
platforms: ['linux']
58-
python_versions: ['3.9']
59-
tf_versions: ['2.8.0']
60-
onnx_opsets: ['']
61-
onnx_backends: {onnxruntime: ['nightly']}
62-
job:
63-
steps:
64-
- template: 'unit_test.yml'
65-
report_coverage: 'True'
66-
67-
- template: 'templates/job_generator.yml'
68-
parameters:
69-
platforms: ['linux']
45+
platforms: ['linux', 'windows']
7046
python_versions: ['3.8']
7147
tf_versions: ['2.7.3']
7248
onnx_opsets: ['']
@@ -78,9 +54,9 @@ stages:
7854

7955
- template: 'templates/job_generator.yml'
8056
parameters:
81-
platforms: ['linux']
57+
platforms: ['linux', 'windows']
8258
python_versions: ['3.9']
83-
tf_versions: ['2.6.2']
59+
tf_versions: ['2.8.0']
8460
onnx_opsets: ['']
8561
onnx_backends: {onnxruntime: ['nightly']}
8662
job:
@@ -90,16 +66,16 @@ stages:
9066

9167
- template: 'templates/job_generator.yml'
9268
parameters:
93-
platforms: ['windows']
94-
python_versions: ['3.7']
95-
tf_versions: ['2.5.0']
69+
platforms: ['linux', 'windows']
70+
python_versions: ['3.10']
71+
tf_versions: ['2.9.1']
9672
onnx_opsets: ['']
9773
onnx_backends: {onnxruntime: ['nightly']}
9874
job:
9975
steps:
10076
- template: 'unit_test.yml'
10177
report_coverage: 'True'
102-
78+
10379
- template: 'templates/combine_test_coverage.yml'
10480

10581
schedules:

ci_build/azure_pipelines/pretrained_model_test-matrix.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
- template: 'templates/job_generator.yml'
2323
parameters:
2424
platforms: ['linux', 'windows']
25-
python_versions: ['3.9']
26-
tf_versions: ['2.6.2']
25+
python_versions: ['3.8']
26+
tf_versions: ['2.7.0']
2727
job:
2828
steps:
2929
- template: 'pretrained_model_test.yml'
@@ -32,24 +32,24 @@ jobs:
3232
parameters:
3333
platforms: ['linux', 'windows']
3434
python_versions: ['3.8']
35-
tf_versions: ['2.7.0']
35+
tf_versions: ['2.8.0']
3636
job:
3737
steps:
3838
- template: 'pretrained_model_test.yml'
3939

4040
- template: 'templates/job_generator.yml'
4141
parameters:
4242
platforms: ['linux', 'windows']
43-
python_versions: ['3.8']
44-
tf_versions: ['2.8.0']
43+
python_versions: ['3.9']
44+
tf_versions: ['2.9.1']
4545
job:
4646
steps:
4747
- template: 'pretrained_model_test.yml'
4848

4949
- template: 'templates/job_generator.yml'
5050
parameters:
5151
platforms: ['linux', 'windows']
52-
python_versions: ['3.9']
52+
python_versions: ['3.10']
5353
tf_versions: ['2.9.1']
5454
job:
5555
steps:

ci_build/azure_pipelines/pretrained_model_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424

2525
- template: 'templates/job_generator.yml'
2626
parameters:
27-
# 2.9, tf
28-
python_versions: ['3.9']
27+
# 2.10, tf
28+
python_versions: ['3.10']
2929
tf_versions: ['2.9.1']
3030
job:
3131
steps:

ci_build/azure_pipelines/templates/job_generator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ parameters:
55
python_versions: ['3.7']
66
tf_versions: ['']
77
onnx_versions: ['']
8-
onnx_opsets: ['16', '15', '14', '13', '12', '11', '10', '9']
8+
onnx_opsets: ['17', '16', '15', '14', '13', '12', '11', '10', '9']
99
onnx_backends: {onnxruntime: ['1.12.0']}
1010
job: {}
1111
run_setup: 'True'

ci_build/azure_pipelines/templates/unit_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Run unit test
22

33
parameters:
4-
onnx_opsets: ['16', '15', '14', '13', '12', '11', '10', '9']
4+
onnx_opsets: ['17', '16', '15', '14', '13', '12', '11', '10', '9']
55
skip_tflite_tests: 'True'
66
skip_tfjs_tests: 'True'
77
skip_tf_tests: 'False'

ci_build/azure_pipelines/trimmed_keras2onnx_application_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
INSTALL_NUMPY: pip install numpy==1.19.0
2121
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"
2222

23-
Python38-tf2.x:
24-
python.version: '3.8'
25-
ONNX_PATH: onnx==1.11.0
23+
Python310-tf2.x:
24+
python.version: '3.10'
25+
ONNX_PATH: onnx==1.12.0
2626
INSTALL_KERAS:
2727
UNINSTALL_KERAS:
2828
INSTALL_TENSORFLOW: pip install tensorflow==2.9.1
29-
INSTALL_ORT: pip install onnxruntime==1.11.0
29+
INSTALL_ORT: pip install onnxruntime==1.12.0
3030
INSTALL_KERAS_RESNET: pip install keras-resnet
31-
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
31+
INSTALL_TRANSFORMERS: pip install transformers==4.2.0
3232
INSTALL_NUMPY:
3333
NIGHTLY_BUILD_TEST: python run_all_v2.py
3434

0 commit comments

Comments
 (0)