Skip to content

Commit a92e31d

Browse files
authored
Merge branch 'main' into optimize_shape_infer
2 parents a46e68a + 14f04ff commit a92e31d

File tree

126 files changed

+4548
-2322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+4548
-2322
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
---
22
name: Bug/Performance issue
33
about: Use this template for reporting a bug or a performance issue.
4-
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
57
---
68

9+
<!--
710
**Dubugging advice**
8-
[delete this section if it doesn't solve your issue]
911
- Add a `--opset` flag with the highest possible opset you can use. Some ops only convert in higher opsets.
1012
- Try installing the latest tf2onnx from main. Some bug fixes might not have been released to PyPI. Run `pip uninstall tf2onnx` and `pip install git+https://github.com/onnx/tensorflow-onnx`
1113
- If using a saved model, use the Tensorflow `saved_model_cli` to determine the correct `--tag` and `--signature_def` flags to use. If the signature you need is not listed, use the `--concrete_function` flag to index into the model's defined functions.
12-
- If your model was made in tf1.x, try running tf2onnx in a venv with tensorflow 1.x installed. tf2.x should be able to read tf1 models, but sometimes there are bugs.
14+
- If your model was made in tf1.x, try running tf2onnx in a venv with tensorflow 1.x installed. tf2.x should be able to read tf1.x models, but sometimes there are bugs.
15+
-->
1316

1417
**Describe the bug**
15-
A clear and concise description of what the bug is.
18+
<!-- Please describe a clear and concise description of what the bug is. -->
1619

1720
**Urgency**
18-
If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.
21+
<!-- If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none. -->
1922

2023
**System information**
21-
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
22-
- Tensorflow Version:
24+
- OS Platform and Distribution (e.g., Linux Ubuntu 18.04*):
25+
- TensorFlow Version:
2326
- Python version:
27+
- ONNX version (if applicable, e.g. 1.11*):
28+
- ONNXRuntime version (if applicable, e.g. 1.11*):
29+
2430

2531
**To Reproduce**
26-
Describe steps/code to reproduce the behavior. Please upload/link the model you are trying to convert if possible.
32+
<!-- Describe steps/code/command to reproduce the behavior. Please upload/link the model you are trying to convert if possible. -->
2733

2834
**Screenshots**
29-
If applicable, add screenshots to help explain your problem.
35+
<!-- If applicable, add screenshots to help explain your problem. -->
3036

3137
**Additional context**
32-
Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.
38+
<!-- Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging. -->
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Feature request
3+
about: Requests for new tf2onnx features
4+
title: ''
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
Before submitting your request, please review past submissions to ensure that it is not a duplicate of a known feature request.
11+
12+
### Describe the feature request
13+
14+
15+
### Describe scenario use case

.github/ISSUE_TEMPLATE/operators.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Missing Operator
3+
about: Operator that does not currently support in tf2onnx.
4+
title: ''
5+
labels: 'unsupported ops'
6+
assignees: ''
7+
8+
9+
10+
---
11+
# New Operator
12+
13+
### Describe the operator
14+
<!-- Why is this operator necessary? What does it accomplish? -->
15+
16+
### Do you know this operator be constructed using existing ONNX operators?
17+
<!-- If so, why not add it as a function? -->
18+
19+
### Is this operator used by any model currently? Which one?
20+
21+
### Are you willing to contribute it? (Y/N)
22+
23+
### Notes
24+
<!-- Any additional information -->

.github/ISSUE_TEMPLATE/question.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Question
3+
about: Ask a question about the tf2onnx.
4+
title: ''
5+
labels: 'question'
6+
assignees: ''
7+
8+
9+
10+
---
11+
# Ask a Question
12+
13+
### Question
14+
<!-- Explain your question here. -->
15+
16+
### Further information
17+
- Is this issue related to a specific model?
18+
**Model name**: <!-- *e.g. mnist* -->
19+
20+
**Model opset**: <!-- *e.g. 17* -->
21+
22+
### Notes
23+
<!-- Any additional information, code snippets. -->
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
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

0 commit comments

Comments
 (0)