Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
Enable tf2onnx installation
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wildenhain <[email protected]>
  • Loading branch information
TomWildenhain-Microsoft committed Apr 28, 2021
1 parent a4eb769 commit 617e8b4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 127 deletions.
127 changes: 1 addition & 126 deletions .azure-pipelines/linux-conda-CI-tf-keras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
$(INSTALL_ORT)
pip install git+https://github.com/onnx/tensorflow-onnx
displayName: 'Install dependencies'
- script: |
Expand All @@ -84,129 +85,3 @@ jobs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()

- job: 'Tests_Nightly'
timeoutInMinutes: 180
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
Python36-onnx1.2:
python.version: '3.6'
ONNX_PATH: onnx==1.2.3
INSTALL_KERAS: pip install keras==2.1.6
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.1.1
INSTALL_KERAS_RESNET:
INSTALL_TRANSFORMERS:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python36-onnx1.5:
python.version: '3.6'
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.1.1
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python37:
python.version: '3.7.3'
ONNX_PATH: onnx==1.8.0
INSTALL_KERAS: pip install keras==2.3.1
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install -i https://test.pypi.org/simple/ ort-nightly
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python37-official-ort:
python.version: '3.7.3'
ONNX_PATH: onnx==1.6.0
INSTALL_KERAS: pip install keras==2.3.1
UNINSTALL_KERAS:
INSTALL_TENSORFLOW: pip install tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.3.0
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS:
NIGHTLY_BUILD_TEST: python run_all.py --exclude "test_keras_applications_v2.py"

Python38-tf2:
python.version: '3.8'
ONNX_PATH: onnx==1.8.0
INSTALL_KERAS:
UNINSTALL_KERAS: pip uninstall keras -y
INSTALL_TENSORFLOW: pip install tensorflow==2.2.0
INSTALL_ORT: pip install -i https://test.pypi.org/simple/ ort-nightly
INSTALL_KERAS_RESNET: pip install keras-resnet
INSTALL_TRANSFORMERS: pip install transformers==3.4.0
NIGHTLY_BUILD_TEST: python run_all_v2.py

maxParallel: 3

steps:
- script: sudo install -d -m 0777 /home/vsts/.conda/envs
displayName: Fix Conda permissions

- task: CondaEnvironment@1
inputs:
createCustomEnvironment: true
environmentName: 'py$(python.version)'
packageSpecs: 'python=$(python.version)'

- script: |
python -m pip install --upgrade pip
conda config --set always_yes yes --set changeps1 no
pip install $(ONNX_PATH)
pip install h5py==2.9.0
$(INSTALL_TENSORFLOW)
$(INSTALL_KERAS)
pip install git+https://github.com/microsoft/onnxconverter-common
pip install -r requirements.txt
pip install -r requirements-dev.txt
$(INSTALL_ORT)
pip install opencv-python
pip install tqdm
pip install keras-segmentation==0.2.0
git clone https://github.com/matterport/Mask_RCNN
cd Mask_RCNN
pip install -r requirements.txt
python setup.py install
cd ..
pip install matplotlib
git clone https://github.com/qqwweee/keras-yolo3
$(INSTALL_KERAS_RESNET)
pip install git+https://www.github.com/keras-team/keras-contrib.git
pip install keras-tcn==2.8.3
$(UNINSTALL_KERAS)
pip install git+https://github.com/qubvel/efficientnet
$(INSTALL_TRANSFORMERS)
pip install keras-self-attention
pip install git+https://github.com/onnx/tensorflow-onnx
displayName: 'Install dependencies'
- script: |
pip install -e .
python -c "import onnxruntime"
pytest tests --doctest-modules --junitxml=junit/test-results.xml
cd applications/nightly_build
$(NIGHTLY_BUILD_TEST)
displayName: 'pytest'
- script: |
pip install -e .
python -c "import onnxruntime"
coverage run --include=keras2onnx/* -m pytest tests/test_layers.py
coverage report -m
coverage html
displayName: 'coverage'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results-*.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
1 change: 1 addition & 0 deletions .azure-pipelines/linux-conda-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
$(INSTALL_ORT)
pip install git+https://github.com/onnx/tensorflow-onnx
displayName: 'Install dependencies'
- script: |
Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines/win32-conda-CI-tf-keras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
%INSTALL_ORT%
pip install git+https://github.com/onnx/tensorflow-onnx
displayName: 'Install dependencies'
- script: |
Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines/win32-conda-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
%INSTALL_ORT%
pip install git+https://github.com/onnx/tensorflow-onnx
displayName: 'Install dependencies'
- script: |
Expand Down
2 changes: 1 addition & 1 deletion keras2onnx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def convert_keras_tf2onnx(model, name=None, doc_string='', target_opset=None, in
input_signature = _process_initial_types(initial_types)

import tf2onnx
model, external_tensor_storage = tf2onnx.convert.from_keras(model, input_signature, opset=target_opset)
model, external_tensor_storage = tf2onnx.convert.from_keras(model, input_signature, opset=target_opset, inputs_as_nchw=channel_first_inputs)

return model

Expand Down

0 comments on commit 617e8b4

Please sign in to comment.