Skip to content

Commit 624fd8b

Browse files
authored
Merge branch 'main' into main
2 parents 5a235d2 + 0004163 commit 624fd8b

30 files changed

+872
-1307
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Keras2onnx Application Test Run
2+
3+
inputs:
4+
tf_version:
5+
description: 'TensorFlow version'
6+
python_version:
7+
description: 'Python version'
8+
ort_version:
9+
description: 'ONNXRuntime version'
10+
onnx_version:
11+
description: 'ONNX version'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Python (${{ inputs.python_version }})
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python_version }}
20+
21+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
22+
shell: bash
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install onnxconverter-common
26+
pip install onnx==${{ inputs.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==${{ inputs.tf_version }}
34+
pip install onnxruntime==${{ inputs.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 keras-self-attention
51+
pip install pytest pytest-cov pytest-runner
52+
53+
if [[ ${{ inputs.tf_version }} == 1.* ]]; then
54+
pip install keras==2.3.1
55+
pip install transformers==4.2.0
56+
pip uninstall -y h5py
57+
pip install h5py==2.9.0
58+
pip install numpy==1.19.0
59+
else
60+
pip install transformers
61+
pip install "numpy<2"
62+
fi
63+
64+
pip install -e .
65+
66+
echo "----- List all of depdencies:"
67+
pip freeze --all
68+
69+
- name: Run keras_application_test (${{ runner.os }})
70+
shell: bash
71+
run: |
72+
python -c "import onnxruntime"
73+
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
74+
cd tests/keras2onnx_applications/nightly_build
75+
python run_all_v2.py
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Keras2onnx Unit Test Run
2+
3+
inputs:
4+
tf_version:
5+
description: 'TensorFlow version'
6+
python_version:
7+
description: 'Python version'
8+
ort_version:
9+
description: 'ONNXRuntime version'
10+
onnx_version:
11+
description: 'ONNX version'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Python (${{ inputs.python_version }})
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python_version }}
20+
21+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
22+
shell: bash
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install onnxconverter-common
26+
pip install onnx==${{ inputs.onnx_version }}
27+
pip install h5py==3.7.0
28+
pip install parameterized
29+
pip install timeout-decorator
30+
pip install coloredlogs flatbuffers
31+
pip install tensorflow==${{ inputs.tf_version }}
32+
pip install pytest pytest-cov pytest-runner
33+
pip install onnxruntime==${{ inputs.ort_version }}
34+
pip uninstall -y protobuf
35+
pip install "protobuf~=3.20"
36+
if [[ ${{ inputs.tf_version }} == 1.* ]]; then
37+
pip install numpy==1.19.0
38+
else
39+
pip install "numpy<2"
40+
fi
41+
42+
pip install -e .
43+
44+
echo "----- List all of depdencies:"
45+
pip freeze --all
46+
47+
- name: Run keras_unit_test (Linux)
48+
shell: bash
49+
if: runner.os == 'Linux'
50+
run: |
51+
python -c "import onnxruntime"
52+
python -c "import onnxconverter_common"
53+
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Pretrained Model Test Run
2+
3+
inputs:
4+
tf_version:
5+
description: 'TensorFlow version'
6+
python_version:
7+
description: 'Python version'
8+
ort_version:
9+
description: 'ONNXRuntime version'
10+
onnx_version:
11+
description: 'ONNX version'
12+
opset_version:
13+
description: 'OPSET version'
14+
skip_tflite:
15+
description: 'Skip TFLite tests'
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Set up Python (${{ inputs.python_version }})
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ inputs.python_version }}
24+
25+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
26+
shell: bash
27+
run: |
28+
chmod +x ./tests/utils/setup_test_env.sh
29+
./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }}
30+
31+
- name: Fix Paths (Windows only)
32+
shell: pwsh
33+
if: runner.os == 'Windows'
34+
run: |
35+
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
36+
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
37+
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
38+
echo "##vso[task.prependpath]$base_dir/Library/bin"
39+
40+
- name: Run pretrained_model_test
41+
shell: bash
42+
run: |
43+
# TODO: fix unity model path
44+
# python tests/run_pretrained_models.py --backend $CI_ONNX_BACKEND --opset $CI_ONNX_OPSET --config tests/unity.yaml || status=$?
45+
python tests/run_pretrained_models.py --backend onnxruntime --opset ${{ inputs.opset_version }} --skip_tf_tests False --skip_tflite_tests ${{ inputs.skip_tflite }} --skip_tfjs_tests True --config tests/run_pretrained_models.yaml || status=$?
46+
ls

.github/actions/unit_test/action.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Unit Test Run
2+
3+
inputs:
4+
tf_version:
5+
description: 'TensorFlow version'
6+
python_version:
7+
description: 'Python version'
8+
ort_version:
9+
description: 'ONNXRuntime version'
10+
onnx_version:
11+
description: 'ONNX version'
12+
opset_version:
13+
description: 'OPSET version'
14+
skip_tflite:
15+
description: 'Skip TFLite tests'
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Set up Python (${{ inputs.python_version }})
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ inputs.python_version }}
24+
25+
- name: Install dependencies (TF-v${{ inputs.tf_version }})
26+
shell: bash
27+
run: |
28+
chmod +x ./tests/utils/setup_test_env.sh
29+
./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }}
30+
31+
- name: Fix Paths (Windows only)
32+
shell: pwsh
33+
if: runner.os == 'Windows'
34+
run: |
35+
$site_dir = python -c "import site; print(site.getsitepackages()[1])"
36+
echo "##vso[task.prependpath]$site_dir\numpy\.libs"
37+
$base_dir = python -c "import site; print(site.getsitepackages()[0])"
38+
echo "##vso[task.prependpath]$base_dir/Library/bin"
39+
40+
- name: Run unit_test (Linux)
41+
shell: bash
42+
if: runner.os == 'Linux'
43+
run: |
44+
export TF2ONNX_TEST_BACKEND=onnxruntime
45+
export TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
46+
export TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
47+
export TF2ONNX_SKIP_TFJS_TESTS=True
48+
export TF2ONNX_SKIP_TF_TESTS=False
49+
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
50+
ls
51+
52+
- name: Run unit_test (Windows)
53+
shell: pwsh
54+
if: runner.os == 'Windows'
55+
run: |
56+
set TF2ONNX_TEST_BACKEND=onnxruntime
57+
set TF2ONNX_TEST_OPSET=${{ inputs.opset_version }}
58+
set TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
59+
set TF2ONNX_SKIP_TFJS_TESTS=True
60+
set TF2ONNX_SKIP_TF_TESTS=False
61+
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
62+
ls
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Keras2onnx App Test (CI)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
19+
strategy:
20+
fail-fast: false
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Run Tests (Py38-TF2.9)
28+
uses: ./.github/actions/keras_application_test
29+
with:
30+
tf_version: '2.9.0'
31+
python_version: '3.8'
32+
ort_version: '1.16.3'
33+
onnx_version: '1.16.1'
34+
35+
- name: Upload Test Results
36+
if: always()
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: Test Results (Py38-TF2.9-ubuntu)
40+
path: ./**/test-results-*.xml
41+
42+
Test_max_py_with_latest_tf: # Do not change this name because it is used in Ruleset of this repo.
43+
strategy:
44+
fail-fast: false
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Run Tests (Py310-TF2.15)
52+
uses: ./.github/actions/keras_application_test
53+
with:
54+
tf_version: '2.15.0'
55+
python_version: '3.10'
56+
ort_version: '1.16.3'
57+
onnx_version: '1.16.1'
58+
59+
- name: Upload Test Results
60+
if: always()
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: Test Results (Py310-TF2.15-ubuntu)
64+
path: ./**/test-results-*.xml
65+
66+
Test_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
67+
strategy:
68+
fail-fast: false
69+
runs-on: ubuntu-latest
70+
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Run Tests (Py37-TF1.15)
76+
uses: ./.github/actions/keras_application_test
77+
with:
78+
tf_version: '1.15.5'
79+
python_version: '3.7'
80+
ort_version: '1.14.1'
81+
onnx_version: '1.14.1'
82+
83+
- name: Upload Test Results
84+
if: always()
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: Test Results (Py37-TF1.15-ubuntu)
88+
path: ./**/test-results-*.xml
89+
90+
Extra_tests:
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
name:
95+
- 'py39-tf2.10'
96+
- 'py39-tf2.15'
97+
os: ['ubuntu-latest', 'windows-2022']
98+
ort_version: ['1.16.3']
99+
onnx_version: ['1.16.1']
100+
include:
101+
- name: 'py39-tf2.10'
102+
tf_version: '2.10.0'
103+
python_version: '3.9'
104+
- name: 'py39-tf2.15'
105+
tf_version: '2.15.0'
106+
python_version: '3.9'
107+
runs-on: ${{ matrix.os }}
108+
109+
steps:
110+
- name: Checkout code
111+
uses: actions/checkout@v4
112+
113+
- name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.ort_version }})
114+
uses: ./.github/actions/keras_application_test
115+
with:
116+
tf_version: ${{ matrix.tf_version }}
117+
python_version: ${{ matrix.python_version }}
118+
ort_version: ${{ matrix.ort_version }}
119+
onnx_version: ${{ matrix.onnx_version }}
120+
- name: Upload Test Results
121+
if: always()
122+
uses: actions/upload-artifact@v3
123+
with:
124+
name: Test Results (${{ matrix.python_version }}-${{ matrix.tf_version }}-${{ matrix.os }})
125+
path: ./**/test-results*.xml
126+
127+
publish-test-results:
128+
name: "Publish Tests Results to Github"
129+
needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Test_py37_with_tf1_15, Extra_tests]
130+
runs-on: ubuntu-latest
131+
permissions:
132+
checks: write
133+
pull-requests: write
134+
if: always()
135+
steps:
136+
- name: Download Artifacts
137+
uses: actions/download-artifact@v3
138+
with:
139+
path: artifacts
140+
141+
- name: Publish Test Results
142+
uses: EnricoMi/publish-unit-test-result-action@v2
143+
with:
144+
files: "artifacts/**/*.xml"

0 commit comments

Comments
 (0)