Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
67 changes: 34 additions & 33 deletions ci_build/azure_pipelines/keras2onnx_application_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ jobs:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python37-onnx1.5:
python.version: '3.7'
ONNX_PATH: onnx==1.5.0
INSTALL_KERAS: pip install keras==2.2.4
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.8.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
INSTALL_NUMPY:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python37-onnx1.6:
python.version: '3.7'
ONNX_PATH: onnx==1.6.0
Expand All @@ -44,7 +32,7 @@ jobs:
INSTALL_NUMPY:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python37-onnx1.11:
Python37-onnx1.11-tf1.15:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS: pip install keras==2.3.1
Expand All @@ -56,18 +44,30 @@ jobs:
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"

Python38-tf2.x:
python.version: '3.8'
Python37-onnx1.11-tf2.5:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS:
INSTALL_KERAS:
UNINSTALL_KERAS: pip uninstall keras -y
INSTALL_TENSORFLOW: pip install tensorflow==2.5.0
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all_v2.py

Python38-onnx1.11-tf2.8:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS:
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==2.8.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
INSTALL_NUMPY:
NIGHTLY_BUILD_TEST: python run_all_v2.py

steps:
- template: 'templates/keras2onnx_application_tests.yml'
parameters:
Expand All @@ -79,17 +79,6 @@ jobs:
vmImage: 'windows-2019'
strategy:
matrix:
Python37-onnx1.5:
python.version: '3.7'
ONNX_PATH: onnx==1.5.0
INSTALL_KERAS: pip install keras==2.2.4
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.8.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"

Python37-onnx1.6:
python.version: '3.7'
ONNX_PATH: onnx==1.6.0
Expand All @@ -114,7 +103,7 @@ jobs:
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"

Python37-onnx1.11:
Python37-onnx1.11-tf1.15:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS: pip install keras==2.3.1
Expand All @@ -126,16 +115,28 @@ jobs:
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"

Python38-tf2.x:
python.version: '3.8'
Python37-onnx1.11-tf2.5:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS:
INSTALL_KERAS:
UNINSTALL_KERAS: pip uninstall keras -y
INSTALL_TENSORFLOW: pip install tensorflow==2.5.0
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all_v2.py

Python38-tf2.8:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS:
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==2.8.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
INSTALL_NUMPY:
NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py"

steps:
Expand Down
35 changes: 14 additions & 21 deletions ci_build/azure_pipelines/keras2onnx_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ jobs:
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python37-tf2.1:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.1.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python38-tf2.2:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
Expand All @@ -44,14 +37,14 @@ jobs:
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

############ Pure Keras Unit Tests ############
Keras-Py37-tf1.15.0:
python.version: '3.7'
ONNX_PATH: onnx==1.10.2
KERAS: keras==2.2.5
TENSORFLOW_PATH: tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0
Python38-tf2.8:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.8.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY:

############ Pure Keras Unit Tests ############
Keras-Py37-tf1.15.0:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
Expand Down Expand Up @@ -94,13 +87,6 @@ jobs:
TENSORFLOW_PATH: tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0

Python37-tf2.1:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.1.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python37-tf2.2:
python.version: '3.7'
ONNX_PATH: onnx==1.11.0
Expand All @@ -122,6 +108,13 @@ jobs:
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python37-tf2.8:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.8.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY:

############ Pure Keras Unit Tests ############
Keras-Py37-tf1.15.0:
python.version: '3.7'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ steps:

- script: |
call activate py$(python.version)
python -m pip install --upgrade pip numpy==1.19
python -m pip install --upgrade pip numpy
echo Test numpy installation... && python -c "import numpy"
pip install %ONNX_PATH%
pip uninstall -y protobuf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ jobs:
matrix:
Python37-onnx1.10:
python.version: '3.7'
ONNX_PATH: onnx==1.10.2
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS: pip install keras==2.2.4
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
INSTALL_NUMPY: pip install numpy==1.19.0
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python38-tf2:
Python38-tf2.x:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
INSTALL_KERAS:
UNINSTALL_KERAS: pip uninstall keras -y
INSTALL_TENSORFLOW: pip install tensorflow==2.5.0
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==2.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
INSTALL_NUMPY: pip install numpy==1.19.0
INSTALL_NUMPY:
NIGHTLY_BUILD_TEST: python run_all_v2.py

steps:
Expand Down
28 changes: 21 additions & 7 deletions ci_build/azure_pipelines/trimmed_keras2onnx_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
############ TF Keras Unit Tests ############
Python37-tf1.15:
python.version: '3.7'
ONNX_PATH: onnx==1.10.2
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python38-tf2.5:
Python38-tf2.9:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.5.0
TENSORFLOW_PATH: tensorflow-cpu==2.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0
INSTALL_NUMPY:

############ Pure Keras Unit Tests ############
Keras-Py37-tf1.15.0:
Expand All @@ -41,6 +41,13 @@ jobs:
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Keras-Py38-tf2.9.0:
python.version: '3.8'
ONNX_PATH: -i onnx==1.11.0
TENSORFLOW_PATH: tensorflow==2.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY:

steps:
- template: 'templates/keras2onnx_unit_test.yml'
parameters:
Expand All @@ -54,9 +61,9 @@ jobs:
############ TF Keras Unit Tests ############
Python37-tf-1.15:
python.version: '3.7'
ONNX_PATH: onnx==1.10.2
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python37-tf2.3:
Expand All @@ -66,6 +73,13 @@ jobs:
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY: pip install numpy==1.19.0

Python38-tf2.9:
python.version: '3.8'
ONNX_PATH: onnx==1.11.0
TENSORFLOW_PATH: tensorflow-cpu==2.9.0
INSTALL_ORT: pip install onnxruntime==1.11.0
INSTALL_NUMPY:

############ Pure Keras Unit Tests ############
Keras-Py37-tf2.2.0:
python.version: '3.7'
Expand Down
24 changes: 17 additions & 7 deletions tests/keras2onnx_unit_tests/mock_keras2onnx/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
import tensorflow
from distutils.version import StrictVersion
from packaging.version import Version

# Rather than using ONNX protobuf definition throughout our codebase, we import ONNX protobuf definition here so that
# we can conduct quick fixes by overwriting ONNX functions without changing any lines elsewhere.
Expand All @@ -22,11 +22,15 @@ def _check_onnx_version():


def is_tensorflow_older_than(version_str):
return StrictVersion(tensorflow.__version__.split('-')[0]) < StrictVersion(version_str)
return Version(tensorflow.__version__.split('-')[0]) < Version(version_str)


def is_tensorflow_later_than(version_str):
return StrictVersion(tensorflow.__version__.split('-')[0]) > StrictVersion(version_str)
return Version(tensorflow.__version__.split('-')[0]) > Version(version_str)


def python_keras_is_deprecated():
return is_tensorflow_later_than("2.5.0")


is_tf_keras = False
Expand All @@ -38,7 +42,10 @@ def is_tensorflow_later_than(version_str):
is_tf_keras = str_tk_keras != '0'

if is_tf_keras:
from tensorflow.python import keras
if python_keras_is_deprecated():
from tensorflow import keras
else:
from tensorflow.python import keras
else:
try:
import keras
Expand All @@ -47,12 +54,15 @@ def is_tensorflow_later_than(version_str):
is_tf_keras = True
except ImportError:
is_tf_keras = True
from tensorflow.python import keras
if python_keras_is_deprecated():
from tensorflow import keras
else:
from tensorflow.python import keras


def is_keras_older_than(version_str):
return StrictVersion(keras.__version__.split('-')[0]) < StrictVersion(version_str)
return Version(keras.__version__.split('-')[0]) < Version(version_str)


def is_keras_later_than(version_str):
return StrictVersion(keras.__version__.split('-')[0]) > StrictVersion(version_str)
return Version(keras.__version__.split('-')[0]) > Version(version_str)
Loading