Skip to content

Commit d2a3c51

Browse files
committed
Add required jobs for keras2onnx application test.
Signed-off-by: Jay Zhang <[email protected]>
1 parent b0a8bf9 commit d2a3c51

File tree

7 files changed

+123
-145
lines changed

7 files changed

+123
-145
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
name: Unit Test Run
1+
name: Keras2onnx Application Test Run
22

33
inputs:
4-
os:
5-
description: 'OS type'
64
tf_version:
75
description: 'TensorFlow version'
86
python_version:
@@ -11,10 +9,6 @@ inputs:
119
description: 'ONNXRuntime version'
1210
onnx_version:
1311
description: 'ONNX version'
14-
opset_version:
15-
description: 'OPSET version'
16-
skip_tflite:
17-
description: 'Skip TFLite tests'
1812

1913
runs:
2014
using: "composite"
@@ -27,38 +21,46 @@ runs:
2721
- name: Install dependencies (TF-v${{ inputs.tf_version }})
2822
shell: bash
2923
run: |
30-
chmod +x ./tests/utils/setup_test_env.sh
31-
./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }}
24+
python -m pip install --upgrade pip
25+
pip install onnxconverter-common
26+
pip install onnx==${{ matrix.onnx_version }}
27+
pip uninstall -y protobuf
28+
pip install "protobuf~=3.20"
29+
pip install h5py==3.7.0
30+
pip install parameterized
31+
pip install timeout-decorator
32+
pip install coloredlogs flatbuffers
33+
pip install tensorflow==${{ matrix.tf_version }}
34+
pip install onnxruntime==${{ matrix.ort_version }}
35+
pip install Pillow==8.2.0
36+
pip install opencv-python
37+
pip install tqdm
38+
pip install keras-segmentation==0.2.0
39+
git clone https://github.com/matterport/Mask_RCNN
40+
cd Mask_RCNN
41+
pip install -r requirements.txt
42+
python setup.py install
43+
cd ..
44+
pip install matplotlib
45+
git clone https://github.com/qqwweee/keras-yolo3
46+
pip install keras-resnet
47+
pip install git+https://www.github.com/keras-team/keras-contrib.git
48+
pip install keras-tcn==2.8.3
49+
pip install git+https://github.com/qubvel/efficientnet
50+
pip install transformers==4.2.0
51+
pip install keras-self-attention
52+
pip install pytest pytest-cov pytest-runner
53+
pip install "numpy<2"
3254
33-
- name: Fix Paths (Windows only)
34-
shell: pwsh
35-
if: runner.os == 'Windows'
36-
run: |
37-
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
38-
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
39-
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
40-
echo "##vso[task.prependpath]$base_dir/Library/bin"
55+
pip install -e .
4156
42-
- name: Run unit_test (Linux)
43-
shell: bash
44-
if: runner.os == 'Linux'
45-
run: |
46-
export TF2ONNX_TEST_BACKEND=onnxruntime
47-
export TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
48-
export TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
49-
export TF2ONNX_SKIP_TFJS_TESTS=True
50-
export TF2ONNX_SKIP_TF_TESTS=False
51-
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
52-
ls
57+
echo "----- List all of depdencies:"
58+
pip freeze --all
5359
54-
- name: Run unit_test (Windows)
55-
shell: pwsh
56-
if: runner.os == 'Windows'
60+
- name: Run keras_application_test (${{ runner.os }})
61+
shell: bash
5762
run: |
58-
set TF2ONNX_TEST_BACKEND=onnxruntime
59-
set TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
60-
set TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
61-
set TF2ONNX_SKIP_TFJS_TESTS=True
62-
set TF2ONNX_SKIP_TF_TESTS=False
63-
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
64-
ls
63+
python -c "import onnxruntime"
64+
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
65+
cd tests/keras2onnx_applications/nightly_build
66+
python run_all_v2.py

.github/actions/keras_unit_test/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Unit Test Run
1+
name: Keras2onnx Unit Test Run
22

33
inputs:
44
tf_version:

.github/actions/pretrained_model_test/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Unit Test Run
1+
name: Pretrained Model Test Run
22

33
inputs:
44
tf_version:

.github/workflows/keras_application_test_ci.yml

+58-80
Original file line numberDiff line numberDiff line change
@@ -14,99 +14,96 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
run_tests:
17+
Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
18+
strategy:
19+
fail-fast: false
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Run Tests (Py38-TF2.9)
27+
uses: ./.github/actions/keras_application_test
28+
with:
29+
tf_version: '2.9.0'
30+
python_version: '3.8'
31+
ort_version: '1.16.3'
32+
onnx_version: '1.16.1'
33+
34+
- name: Upload Test Results
35+
if: always()
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: Test Results (Py38-TF2.9-ubuntu)
39+
path: ./**/test-results-*.xml
40+
41+
Test_max_py_with_latest_tf: # Do not change this name because it is used in Ruleset of this repo.
42+
strategy:
43+
fail-fast: false
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Run Tests (Py310-TF2.15)
51+
uses: ./.github/actions/keras_application_test
52+
with:
53+
tf_version: '2.15.0'
54+
python_version: '3.10'
55+
ort_version: '1.16.3'
56+
onnx_version: '1.16.1'
57+
58+
- name: Upload Test Results
59+
if: always()
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: Test Results (Py310-TF2.15-ubuntu)
63+
path: ./**/test-results-*.xml
64+
65+
Extra_tests:
1866
strategy:
1967
fail-fast: false
2068
matrix:
2169
name:
22-
- 'py38-tf2.9'
2370
- 'py39-tf2.10'
2471
- 'py39-tf2.15'
2572
os: ['ubuntu-latest', 'windows-2022']
26-
opset_version: ['18', '15']
2773
ort_version: ['1.16.3']
2874
onnx_version: ['1.16.1']
2975
include:
30-
- name: 'py38-tf2.9'
31-
tf_version: '2.9.0'
32-
python_version: '3.8'
3376
- name: 'py39-tf2.10'
3477
tf_version: '2.10.0'
3578
python_version: '3.9'
3679
- name: 'py39-tf2.15'
3780
tf_version: '2.15.0'
3881
python_version: '3.9'
39-
4082
runs-on: ${{ matrix.os }}
4183

4284
steps:
43-
- name: Set up Python (${{ matrix.python_version }})
44-
uses: actions/setup-python@v5
45-
with:
46-
python-version: ${{ matrix.python_version }}
47-
4885
- name: Checkout code
4986
uses: actions/checkout@v4
5087

51-
- name: Install dependencies (TF-v${{ matrix.tf_version }})
52-
shell: bash
53-
run: |
54-
python -m pip install --upgrade pip
55-
pip install onnxconverter-common
56-
pip install onnx==${{ matrix.onnx_version }}
57-
pip uninstall -y protobuf
58-
pip install "protobuf~=3.20"
59-
pip install h5py==3.7.0
60-
pip install parameterized
61-
pip install timeout-decorator
62-
pip install coloredlogs flatbuffers
63-
pip install tensorflow==${{ matrix.tf_version }}
64-
pip install onnxruntime==${{ matrix.ort_version }}
65-
pip install Pillow==8.2.0
66-
pip install opencv-python
67-
pip install tqdm
68-
pip install keras-segmentation==0.2.0
69-
git clone https://github.com/matterport/Mask_RCNN
70-
cd Mask_RCNN
71-
pip install -r requirements.txt
72-
python setup.py install
73-
cd ..
74-
pip install matplotlib
75-
git clone https://github.com/qqwweee/keras-yolo3
76-
pip install keras-resnet
77-
pip install git+https://www.github.com/keras-team/keras-contrib.git
78-
pip install keras-tcn==2.8.3
79-
pip install git+https://github.com/qubvel/efficientnet
80-
pip install transformers==4.2.0
81-
pip install keras-self-attention
82-
pip install pytest pytest-cov pytest-runner
83-
pip install "numpy<2"
84-
85-
pip install -e .
86-
87-
echo "----- List all of depdencies:"
88-
pip freeze --all
89-
90-
- name: Run keras application tests (${{ matrix.os }})
91-
run: |
92-
python -c "import onnxruntime"
93-
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
94-
cd tests/keras2onnx_applications/nightly_build
95-
python run_all_v2.py
96-
88+
- name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.ort_version }})
89+
uses: ./.github/actions/keras_application_test
90+
with:
91+
tf_version: ${{ matrix.tf_version }}
92+
python_version: ${{ matrix.python_version }}
93+
ort_version: ${{ matrix.ort_version }}
94+
onnx_version: ${{ matrix.onnx_version }}
9795
- name: Upload Test Results
9896
if: always()
9997
uses: actions/upload-artifact@v3
10098
with:
101-
name: Test Results (${{ matrix.tf_version }}-${{ matrix.python_version }}-${{ matrix.os }})
99+
name: Test Results (${{ matrix.python_version }}-${{ matrix.tf_version }}-${{ matrix.os }})
102100
path: ./**/test-results*.xml
103101

104102
run_tests_tf_15:
105103
strategy:
106104
matrix:
107105
tf_version: ['1.15.0']
108106
python_version: ['3.7'] # Max version that supports tf 1.15
109-
opset_version: ['18', '15']
110107
ort_version: ['1.14.1'] # Max version that supports python 3.7
111108
onnx_version: ['1.14.1'] # Max version that supports python 3.7
112109
os: ['ubuntu-latest', 'windows-2022']
@@ -179,7 +176,7 @@ jobs:
179176

180177
publish-test-results:
181178
name: "Publish Tests Results to Github"
182-
needs: run_tests
179+
needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Extra_tests, run_tests_tf_15]
183180
runs-on: ubuntu-latest
184181
permissions:
185182
checks: write
@@ -195,22 +192,3 @@ jobs:
195192
uses: EnricoMi/publish-unit-test-result-action@v2
196193
with:
197194
files: "artifacts/**/*.xml"
198-
199-
publish-test-results-tf-15:
200-
name: "Publish Tests Results(TF15) to Github"
201-
needs: run_tests_tf_15
202-
runs-on: ubuntu-latest
203-
permissions:
204-
checks: write
205-
pull-requests: write
206-
if: always()
207-
steps:
208-
- name: Download Artifacts
209-
uses: actions/download-artifact@v3
210-
with:
211-
path: artifacts
212-
213-
- name: Publish Test Results
214-
uses: EnricoMi/publish-unit-test-result-action@v2
215-
with:
216-
files: "artifacts/**/*.xml"

.github/workflows/keras_unit_test_ci.yml

+11-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
1817
Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
1918
strategy:
2019
fail-fast: false
@@ -48,19 +47,19 @@ jobs:
4847
- name: Checkout code
4948
uses: actions/checkout@v4
5049

51-
- name: Run Tests (Py39-TF2.15)
50+
- name: Run Tests (Py310-TF2.15)
5251
uses: ./.github/actions/keras_unit_test
5352
with:
5453
tf_version: '2.15.0'
55-
python_version: '3.9'
54+
python_version: '3.10'
5655
ort_version: '1.16.3'
5756
onnx_version: '1.16.1'
5857

5958
- name: Upload Test Results
6059
if: always()
6160
uses: actions/upload-artifact@v3
6261
with:
63-
name: Test Results (Py39-TF2.15-ubuntu)
62+
name: Test Results (Py310-TF2.15-ubuntu)
6463
path: ./**/test-results-*.xml
6564

6665
Extra_tests:
@@ -69,17 +68,17 @@ jobs:
6968
matrix:
7069
name:
7170
- 'py39-tf2.10'
72-
- 'py310-tf2.15'
71+
- 'py39-tf2.15'
7372
os: ['ubuntu-latest', 'windows-2022']
7473
ort_version: ['1.16.3']
7574
onnx_version: ['1.16.1']
7675
include:
7776
- name: 'py39-tf2.10'
7877
tf_version: '2.10.0'
7978
python_version: '3.9'
80-
- name: 'py310-tf2.15'
79+
- name: 'py39-tf2.15'
8180
tf_version: '2.15.0'
82-
python_version: '3.10'
81+
python_version: '3.9'
8382
runs-on: ${{ matrix.os }}
8483

8584
steps:
@@ -89,16 +88,15 @@ jobs:
8988
- name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.ort_version }})
9089
uses: ./.github/actions/keras_unit_test
9190
with:
92-
tf_version: '2.9.0'
93-
python_version: '3.8'
94-
ort_version: '1.16.3'
95-
onnx_version: '1.16.1'
96-
91+
tf_version: ${{ matrix.tf_version }}
92+
python_version: ${{ matrix.python_version }}
93+
ort_version: ${{ matrix.ort_version }}
94+
onnx_version: ${{ matrix.onnx_version }}
9795
- name: Upload Test Results
9896
if: always()
9997
uses: actions/upload-artifact@v3
10098
with:
101-
name: Test Results (${{ matrix.tf_version }}-${{ matrix.python_version }}-${{ matrix.os }})
99+
name: Test Results (${{ matrix.python_version }}-${{ matrix.tf_version }}-${{ matrix.os }})
102100
path: ./**/test-results*.xml
103101

104102
run_tests_tf_15:

0 commit comments

Comments
 (0)