Skip to content

Try tf 2.18 (version 2) #2385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 13 additions & 10 deletions .github/actions/keras_application_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ runs:
python -m pip install --upgrade pip
pip install onnxconverter-common
pip install onnx==${{ inputs.onnx_version }}
pip uninstall -y protobuf
pip install "protobuf~=3.20"
pip install h5py==3.7.0
pip install h5py
pip install parameterized
pip install timeout-decorator
pip install coloredlogs flatbuffers
pip install tensorflow==${{ inputs.tf_version }}
pip install onnxruntime==${{ inputs.ort_version }}
pip install pillow
pip install opencv-python
Expand All @@ -49,16 +46,20 @@ runs:
pip install git+https://github.com/qubvel/efficientnet
pip install keras-self-attention
pip install pytest pytest-cov pytest-runner
pip uninstall -y protobuf h5py

if [[ ${{ inputs.tf_version }} == 1.* ]]; then
pip install keras==2.3.1
pip install transformers==4.2.0
pip uninstall -y h5py
pip install h5py==2.9.0
pip install numpy==1.19.0
echo "-- install-1 TF1-KERAS ${{ inputs.tf_version }}"
pip install numpy==1.19.0 tensorflow==${{ inputs.tf_version }} protobuf h5py==2.9.0 transformers==4.2.0 keras h5py
else
pip install transformers
pip install "numpy<2"
if [[ "${{ inputs.tf_version }}" != "2.13.0" && "${{ inputs.tf_version }}" != "2.9.0" ]]; then
echo "-- install-1 TF-KERAS ${{ inputs.tf_version }}"
pip install tf_keras==${{ inputs.tf_version }} tensorflow==${{ inputs.tf_version }} protobuf
else
echo "-- install-1 TF ${{ inputs.tf_version }}"
pip install protobuf tensorflow==${{ inputs.tf_version }}
fi
fi

pip install -e .
Expand All @@ -71,5 +72,7 @@ runs:
run: |
python -c "import onnxruntime"
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml

export TF_USE_LEGACY_KERAS=True
cd tests/keras2onnx_applications/nightly_build
python run_all_v2.py
17 changes: 11 additions & 6 deletions .github/actions/keras_unit_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ runs:
python -m pip install --upgrade pip
pip install onnxconverter-common
pip install onnx==${{ inputs.onnx_version }}
pip install h5py==3.7.0
pip install parameterized
pip install timeout-decorator
pip install coloredlogs flatbuffers
pip install tensorflow==${{ inputs.tf_version }}
pip install pytest pytest-cov pytest-runner
pip install onnxruntime==${{ inputs.ort_version }}
pip uninstall -y protobuf
pip install "protobuf~=3.20"
pip uninstall -y protobuf h5py tensorflow
if [[ ${{ inputs.tf_version }} == 1.* ]]; then
pip install numpy==1.19.0
echo "-- install-2 TF1-KERAS ${{ inputs.tf_version }}"
pip install numpy==1.19.0 tensorflow==${{ inputs.tf_version }} protobuf keras h5py
else
pip install "numpy<2"
if [[ "${{ inputs.tf_version }}" != "2.13.0" && "${{ inputs.tf_version }}" != "2.9.0" ]]; then
echo "-- install-2 TF-KERAS ${{ inputs.tf_version }}"
pip install tf_keras==${{ inputs.tf_version }} tensorflow==${{ inputs.tf_version }} h5py protobuf
else
echo "-- install-2 TF ${{ inputs.tf_version }}"
pip install protobuf tensorflow==${{ inputs.tf_version }} h5py
fi
fi

pip install -e .
Expand All @@ -48,6 +52,7 @@ runs:
shell: bash
if: runner.os == 'Linux'
run: |
export TF_USE_LEGACY_KERAS=True
python -c "import onnxruntime"
python -c "import onnxconverter_common"
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
2 changes: 2 additions & 0 deletions .github/actions/unit_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ runs:
export TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
export TF2ONNX_SKIP_TFJS_TESTS=True
export TF2ONNX_SKIP_TF_TESTS=False
export TF_USE_LEGACY_KERAS=True
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
ls

Expand All @@ -58,5 +59,6 @@ runs:
set TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }}
set TF2ONNX_SKIP_TFJS_TESTS=True
set TF2ONNX_SKIP_TF_TESTS=False
set TF_USE_LEGACY_KERAS=True
python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml
ls
38 changes: 26 additions & 12 deletions .github/workflows/keras_application_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:

jobs:

Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
Test1_py38_tf2_9: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand All @@ -39,7 +39,7 @@ jobs:
name: Test Results (Py38-TF2.9-ubuntu)
path: ./**/test-results-*.xml

Test_max_py_with_latest_tf: # Do not change this name because it is used in Ruleset of this repo.
Test1_py310_tf2_18: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand All @@ -48,22 +48,22 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Tests (Py310-TF2.15)
- name: Run Tests (Py310-TF2.18)
uses: ./.github/actions/keras_application_test
with:
tf_version: '2.15.0'
tf_version: '2.18.0'
python_version: '3.10'
ort_version: '1.16.3'
onnx_version: '1.16.1'
ort_version: '1.20.1'
onnx_version: '1.17.0'

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (Py310-TF2.15-ubuntu)
name: Test Results (Py310-TF2.18-ubuntu)
path: ./**/test-results-*.xml

Test_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
Test1_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-22.04
Expand All @@ -87,23 +87,37 @@ jobs:
name: Test Results (Py37-TF1.15-ubuntu)
path: ./**/test-results-*.xml

Extra_tests:
Extra_tests1:
strategy:
fail-fast: false
matrix:
name:
- 'py38-tf2.13'
- 'py39-tf2.15'
- 'py310-tf2.18'
- 'py311-tf2.18'
os: ['ubuntu-latest', 'windows-2022']
ort_version: ['1.16.3']
onnx_version: ['1.16.1']
include:
- name: 'py38-tf2.13'
tf_version: '2.13.0'
python_version: '3.8'
ort_version: '1.16.3'
onnx_version: '1.16.1'
- name: 'py39-tf2.15'
tf_version: '2.15.0'
python_version: '3.9'
ort_version: '1.16.3'
onnx_version: '1.16.1'
- name: 'py310-tf2.18'
tf_version: '2.18.0'
python_version: '3.10'
ort_version: '1.20.1'
onnx_version: '1.17.0'
- name: 'py311-tf2.18'
tf_version: '2.18.0'
python_version: '3.11'
ort_version: '1.20.1'
onnx_version: '1.17.0'
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -126,7 +140,7 @@ jobs:

publish-test-results:
name: "Publish Tests Results to Github"
needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Test_py37_with_tf1_15, Extra_tests]
needs: [Test1_py38_tf2_9, Test1_py310_tf2_18, Test1_py37_with_tf1_15, Extra_tests1]
runs-on: ubuntu-latest
permissions:
checks: write
Expand Down
70 changes: 54 additions & 16 deletions .github/workflows/keras_unit_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

jobs:
Test_min_py_with_min_tf: # Do not change this name because it is used in Ruleset of this repo.
Test2_py38_tf2_9: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand All @@ -38,7 +38,7 @@ jobs:
name: Test Results (Py38-TF2.9-ubuntu)
path: ./**/test-results-*.xml

Test_max_py_with_latest_tf: # Do not change this name because it is used in Ruleset of this repo.
Test2_py310_tf2_18: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand All @@ -47,22 +47,46 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Tests (Py310-TF2.15)
- name: Run Tests (Py310-TF2.18)
uses: ./.github/actions/keras_unit_test
with:
tf_version: '2.15.0'
tf_version: '2.18.0'
python_version: '3.10'
ort_version: '1.16.3'
onnx_version: '1.16.1'
ort_version: '1.20.1'
onnx_version: '1.17.0'

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (Py310-TF2.18-ubuntu)
path: ./**/test-results-*.xml

Test2_py311_tf2_18: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Tests (Py311-TF2.18)
uses: ./.github/actions/keras_unit_test
with:
tf_version: '2.18.0'
python_version: '3.11'
ort_version: '1.20.1'
onnx_version: '1.17.0'

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (Py310-TF2.15-ubuntu)
name: Test Results (Py311-TF2.18-ubuntu)
path: ./**/test-results-*.xml

Test_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
Test2_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-22.04
Expand All @@ -86,23 +110,37 @@ jobs:
name: Test Results (Py37-TF1.15-ubuntu)
path: ./**/test-results-*.xml

Extra_tests:
Extra_tests2:
strategy:
fail-fast: false
matrix:
name:
- 'py39-tf2.10'
- 'py38-tf2.13'
- 'py39-tf2.15'
- 'py310-tf2.18'
- 'py311-tf2.18'
os: ['ubuntu-latest', 'windows-2022']
ort_version: ['1.16.3']
onnx_version: ['1.16.1']
include:
- name: 'py39-tf2.10'
tf_version: '2.10.0'
python_version: '3.9'
- name: 'py38-tf2.13'
tf_version: '2.13.0'
python_version: '3.8'
ort_version: '1.16.3'
onnx_version: '1.16.1'
- name: 'py39-tf2.15'
tf_version: '2.15.0'
python_version: '3.9'
ort_version: '1.16.3'
onnx_version: '1.16.1'
- name: 'py310-tf2.18'
tf_version: '2.18.0'
python_version: '3.10'
ort_version: '1.20.1'
onnx_version: '1.17.0'
- name: 'py311-tf2.18'
tf_version: '2.18.0'
python_version: '3.11'
ort_version: '1.20.1'
onnx_version: '1.17.0'
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -125,7 +163,7 @@ jobs:

publish-test-results:
name: "Publish Tests Results to Github"
needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Test_py37_with_tf1_15, Extra_tests]
needs: [Test2_py38_tf2_9, Test2_py310_tf2_18, Test2_py311_tf2_18, Test2_py37_with_tf1_15, Extra_tests2]
runs-on: ubuntu-latest
permissions:
checks: write
Expand Down
Loading
Loading