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 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9bcef5e
Try tf 2.18.0 version.
fatcat-z Dec 30, 2024
6d1f789
Call tf_keras for keras 3.x.
fatcat-z Dec 30, 2024
b75fe78
Check output_names attr as well.
fatcat-z Dec 31, 2024
d66a43c
fix reset_uids
xadupre Feb 4, 2025
b234051
improve ci
xadupre Feb 4, 2025
5475574
update ci
xadupre Feb 4, 2025
177b3de
ci
xadupre Feb 4, 2025
c1cc37b
ci
xadupre Feb 4, 2025
0bd3c4e
lint
xadupre Feb 4, 2025
e9b45bc
lint
xadupre Feb 4, 2025
4e6eace
Merge branch 'main' of https://github.com/onnx/tensorflow-onnx into ci
xadupre Feb 4, 2025
cbede92
lint
xadupre Feb 4, 2025
672f7d8
lint
xadupre Feb 4, 2025
ca449a9
lint
xadupre Feb 4, 2025
bc1dd9a
fix ci
xadupre Feb 4, 2025
aefc71f
lint
xadupre Feb 4, 2025
e1ba6d4
fix cond
xadupre Feb 4, 2025
4a6b320
ci
xadupre Feb 4, 2025
c27e246
fix script
xadupre Feb 4, 2025
30edd9b
fix ci
xadupre Feb 4, 2025
04d0b80
remove 3.12
xadupre Feb 4, 2025
e4c3409
fix unit test
xadupre Feb 4, 2025
681cb1d
fix np.cast
xadupre Feb 4, 2025
0e83b27
fix install
xadupre Feb 4, 2025
f578b48
fix issue
xadupre Feb 4, 2025
5377187
fix issues
xadupre Feb 4, 2025
03c615f
fix ci
xadupre Feb 4, 2025
a0e1d3b
first try
xadupre Feb 26, 2025
dc8e01e
2.19é
xadupre Jun 10, 2025
55c2873
Support Keras 3 models in from_keras
nfirle Jun 12, 2025
671f22e
removed debug statements and small fix
nfirle Jul 20, 2025
c806726
merge conflicts
xadupre Jul 29, 2025
8428be7
simplify two tests'
xadupre Jul 30, 2025
a96260e
remove deprecated packages
xadupre Jul 30, 2025
61b8495
update ci
xadupre Jul 30, 2025
6f4c5b3
Merge branch 'keras3-support' of https://github.com/nfirle/tensorflow…
xadupre Jul 30, 2025
f3fa91e
changes
xadupre Jul 30, 2025
d7247b0
reduce the number of jobs
xadupre Jul 30, 2025
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
30 changes: 17 additions & 13 deletions .github/actions/keras_application_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,43 @@ 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
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
pip install keras-resnet
pip install git+https://www.github.com/keras-team/keras-contrib.git
pip install keras-tcn==2.8.3
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
# deprecated packages
pip install keras-self-attention
pip install keras-segmentation==0.2.0
pip install keras-resnet
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 +73,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
92 changes: 33 additions & 59 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_py310_tf2_19: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand All @@ -24,86 +24,60 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Tests (Py39-TF2.9)
- name: Run Tests (Py310-TF2.19)
uses: ./.github/actions/keras_application_test
with:
tf_version: '2.9.0'
python_version: '3.9'
ort_version: '1.16.3'
onnx_version: '1.16.1'

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (Py39-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.
strategy:
fail-fast: false
runs-on: ubuntu-latest

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

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

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

Test_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

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

- name: Run Tests (Py37-TF1.15)
uses: ./.github/actions/keras_application_test
with:
tf_version: '1.15.5'
python_version: '3.7'
ort_version: '1.14.1'
onnx_version: '1.14.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 (Py37-TF1.15-ubuntu)
name: Test Results (Py310-TF2.19-ubuntu)
path: ./**/test-results-*.xml

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

steps:
Expand All @@ -126,7 +100,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_py310_tf2_19, Extra_tests1]
runs-on: ubuntu-latest
permissions:
checks: write
Expand Down
60 changes: 37 additions & 23 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 (Py39-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_19: # 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,62 +47,76 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Tests (Py310-TF2.15)
- name: Run Tests (Py310-TF2.19)
uses: ./.github/actions/keras_unit_test
with:
tf_version: '2.15.0'
tf_version: '2.19.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.19-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_py311_tf2_19: # Do not change this name because it is used in Ruleset of this repo.
strategy:
fail-fast: false
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

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

- name: Run Tests (Py37-TF1.15)
- name: Run Tests (Py311-TF2.19)
uses: ./.github/actions/keras_unit_test
with:
tf_version: '1.15.5'
python_version: '3.7'
ort_version: '1.14.1'
onnx_version: '1.14.1'
tf_version: '2.19.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 (Py37-TF1.15-ubuntu)
name: Test Results (Py311-TF2.19-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.19'
- 'py311-tf2.19'
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.19'
tf_version: '2.19.0'
python_version: '3.10'
ort_version: '1.20.1'
onnx_version: '1.17.0'
- name: 'py311-tf2.19'
tf_version: '2.19.0'
python_version: '3.11'
ort_version: '1.20.1'
onnx_version: '1.17.0'
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -125,7 +139,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_19, Test2_py311_tf2_19, Extra_tests2]
runs-on: ubuntu-latest
permissions:
checks: write
Expand Down
Loading
Loading