diff --git a/.github/actions/keras_application_test/action.yml b/.github/actions/keras_application_test/action.yml new file mode 100644 index 000000000..7148e417b --- /dev/null +++ b/.github/actions/keras_application_test/action.yml @@ -0,0 +1,75 @@ +name: Keras2onnx Application Test Run + +inputs: + tf_version: + description: 'TensorFlow version' + python_version: + description: 'Python version' + ort_version: + description: 'ONNXRuntime version' + onnx_version: + description: 'ONNX version' + +runs: + using: "composite" + steps: + - name: Set up Python (${{ inputs.python_version }}) + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Install dependencies (TF-v${{ inputs.tf_version }}) + shell: bash + run: | + 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 parameterized + pip install timeout-decorator + pip install coloredlogs flatbuffers + pip install tensorflow==${{ inputs.tf_version }} + pip install onnxruntime==${{ inputs.ort_version }} + pip install Pillow==8.2.0 + 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 + + 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 + else + pip install transformers + pip install "numpy<2" + fi + + pip install -e . + + echo "----- List all of depdencies:" + pip freeze --all + + - name: Run keras_application_test (${{ runner.os }}) + shell: bash + run: | + python -c "import onnxruntime" + pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml + cd tests/keras2onnx_applications/nightly_build + python run_all_v2.py diff --git a/.github/actions/keras_unit_test/action.yml b/.github/actions/keras_unit_test/action.yml new file mode 100644 index 000000000..4c78945f1 --- /dev/null +++ b/.github/actions/keras_unit_test/action.yml @@ -0,0 +1,53 @@ +name: Keras2onnx Unit Test Run + +inputs: + tf_version: + description: 'TensorFlow version' + python_version: + description: 'Python version' + ort_version: + description: 'ONNXRuntime version' + onnx_version: + description: 'ONNX version' + +runs: + using: "composite" + steps: + - name: Set up Python (${{ inputs.python_version }}) + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Install dependencies (TF-v${{ inputs.tf_version }}) + shell: bash + run: | + 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" + if [[ ${{ inputs.tf_version }} == 1.* ]]; then + pip install numpy==1.19.0 + else + pip install "numpy<2" + fi + + pip install -e . + + echo "----- List all of depdencies:" + pip freeze --all + + - name: Run keras_unit_test (Linux) + shell: bash + if: runner.os == 'Linux' + run: | + python -c "import onnxruntime" + python -c "import onnxconverter_common" + pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml diff --git a/.github/actions/pretrained_model_test/action.yml b/.github/actions/pretrained_model_test/action.yml new file mode 100644 index 000000000..f6d69d99a --- /dev/null +++ b/.github/actions/pretrained_model_test/action.yml @@ -0,0 +1,46 @@ +name: Pretrained Model Test Run + +inputs: + tf_version: + description: 'TensorFlow version' + python_version: + description: 'Python version' + ort_version: + description: 'ONNXRuntime version' + onnx_version: + description: 'ONNX version' + opset_version: + description: 'OPSET version' + skip_tflite: + description: 'Skip TFLite tests' + +runs: + using: "composite" + steps: + - name: Set up Python (${{ inputs.python_version }}) + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Install dependencies (TF-v${{ inputs.tf_version }}) + shell: bash + run: | + chmod +x ./tests/utils/setup_test_env.sh + ./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }} + + - name: Fix Paths (Windows only) + shell: pwsh + if: runner.os == 'Windows' + run: | + $site_dir = python -c "import site; print(site.getsitepackages()[1])" + echo "##vso[task.prependpath]$site_dir\numpy\.libs" + $base_dir = python -c "import site; print(site.getsitepackages()[0])" + echo "##vso[task.prependpath]$base_dir/Library/bin" + + - name: Run pretrained_model_test + shell: bash + run: | + # TODO: fix unity model path + # python tests/run_pretrained_models.py --backend $CI_ONNX_BACKEND --opset $CI_ONNX_OPSET --config tests/unity.yaml || status=$? + 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=$? + ls diff --git a/.github/actions/unit_test/action.yml b/.github/actions/unit_test/action.yml new file mode 100644 index 000000000..00cb28386 --- /dev/null +++ b/.github/actions/unit_test/action.yml @@ -0,0 +1,62 @@ +name: Unit Test Run + +inputs: + tf_version: + description: 'TensorFlow version' + python_version: + description: 'Python version' + ort_version: + description: 'ONNXRuntime version' + onnx_version: + description: 'ONNX version' + opset_version: + description: 'OPSET version' + skip_tflite: + description: 'Skip TFLite tests' + +runs: + using: "composite" + steps: + - name: Set up Python (${{ inputs.python_version }}) + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Install dependencies (TF-v${{ inputs.tf_version }}) + shell: bash + run: | + chmod +x ./tests/utils/setup_test_env.sh + ./tests/utils/setup_test_env.sh ${{ inputs.tf_version }} ${{ inputs.ort_version }} ${{ inputs.onnx_version }} + + - name: Fix Paths (Windows only) + shell: pwsh + if: runner.os == 'Windows' + run: | + $site_dir = python -c "import site; print(site.getsitepackages()[1])" + echo "##vso[task.prependpath]$site_dir\numpy\.libs" + $base_dir = python -c "import site; print(site.getsitepackages()[0])" + echo "##vso[task.prependpath]$base_dir/Library/bin" + + - name: Run unit_test (Linux) + shell: bash + if: runner.os == 'Linux' + run: | + export TF2ONNX_TEST_BACKEND=onnxruntime + export TF2ONNX_TEST_OPSET=${{ inputs.opset_version }} + export TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }} + export TF2ONNX_SKIP_TFJS_TESTS=True + export TF2ONNX_SKIP_TF_TESTS=False + python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml + ls + + - name: Run unit_test (Windows) + shell: pwsh + if: runner.os == 'Windows' + run: | + set TF2ONNX_TEST_BACKEND=onnxruntime + set TF2ONNX_TEST_OPSET=${{ inputs.opset_version }} + set TF2ONNX_SKIP_TFLITE_TESTS=${{ inputs.skip_tflite }} + set TF2ONNX_SKIP_TFJS_TESTS=True + set TF2ONNX_SKIP_TF_TESTS=False + python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append --junitxml=junit/test-results.xml + ls diff --git a/.github/workflows/keras_application_test_ci.yml b/.github/workflows/keras_application_test_ci.yml new file mode 100644 index 000000000..c962b1dc8 --- /dev/null +++ b/.github/workflows/keras_application_test_ci.yml @@ -0,0 +1,144 @@ +name: Keras2onnx App Test (CI) + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + 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. + strategy: + fail-fast: false + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py38-TF2.9) + uses: ./.github/actions/keras_application_test + with: + tf_version: '2.9.0' + python_version: '3.8' + ort_version: '1.16.3' + onnx_version: '1.16.1' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + 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. + 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' + python_version: '3.10' + ort_version: '1.16.3' + onnx_version: '1.16.1' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + 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-latest + + 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' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py37-TF1.15-ubuntu) + path: ./**/test-results-*.xml + + Extra_tests: + strategy: + fail-fast: false + matrix: + name: + - 'py39-tf2.10' + - 'py39-tf2.15' + 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: 'py39-tf2.15' + tf_version: '2.15.0' + python_version: '3.9' + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.ort_version }}) + uses: ./.github/actions/keras_application_test + with: + tf_version: ${{ matrix.tf_version }} + python_version: ${{ matrix.python_version }} + ort_version: ${{ matrix.ort_version }} + onnx_version: ${{ matrix.onnx_version }} + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (${{ matrix.python_version }}-${{ matrix.tf_version }}-${{ matrix.os }}) + path: ./**/test-results*.xml + + 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] + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + if: always() + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "artifacts/**/*.xml" diff --git a/.github/workflows/keras_unit_test_ci.yml b/.github/workflows/keras_unit_test_ci.yml new file mode 100644 index 000000000..7ef38d79a --- /dev/null +++ b/.github/workflows/keras_unit_test_ci.yml @@ -0,0 +1,143 @@ +name: Keras2onnx Unit Test (CI) + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + 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. + strategy: + fail-fast: false + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py38-TF2.9) + uses: ./.github/actions/keras_unit_test + with: + tf_version: '2.9.0' + python_version: '3.8' + ort_version: '1.16.3' + onnx_version: '1.16.1' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + 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. + 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_unit_test + with: + tf_version: '2.15.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@v3 + 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-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py37-TF1.15) + 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' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py37-TF1.15-ubuntu) + path: ./**/test-results-*.xml + + Extra_tests: + strategy: + fail-fast: false + matrix: + name: + - 'py39-tf2.10' + - 'py39-tf2.15' + 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: 'py39-tf2.15' + tf_version: '2.15.0' + python_version: '3.9' + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.ort_version }}) + uses: ./.github/actions/keras_unit_test + with: + tf_version: ${{ matrix.tf_version }} + python_version: ${{ matrix.python_version }} + ort_version: ${{ matrix.ort_version }} + onnx_version: ${{ matrix.onnx_version }} + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (${{ matrix.python_version }}-${{ matrix.tf_version }}-${{ matrix.os }}) + path: ./**/test-results*.xml + + 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] + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + if: always() + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "artifacts/**/*.xml" diff --git a/.github/workflows/pretrained_model_test_ci.yml b/.github/workflows/pretrained_model_test_ci.yml new file mode 100644 index 000000000..e82968fc3 --- /dev/null +++ b/.github/workflows/pretrained_model_test_ci.yml @@ -0,0 +1,139 @@ +name: Pretrained Model Test (CI) + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + 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. + strategy: + fail-fast: false + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py38-TF2.9-18) + uses: ./.github/actions/pretrained_model_test + with: + os: 'ubuntu-latest' + tf_version: '2.9.0' + python_version: '3.8' + ort_version: '1.16.3' + onnx_version: '1.16.1' + opset_version: '18' + skip_tflite: 'False' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py38-TF2.9-18-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-18) + uses: ./.github/actions/pretrained_model_test + with: + os: 'ubuntu-latest' + tf_version: '2.15.0' + python_version: '3.10' + ort_version: '1.16.3' + onnx_version: '1.16.1' + opset_version: '18' + skip_tflite: 'False' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py310-TF2.15-18-ubuntu) + path: ./**/test-results-*.xml + + Extra_tests: + strategy: + fail-fast: false + matrix: + name: + - 'py38-tf2.13' + - 'py39-tf2.15' + os: ['ubuntu-latest', 'windows-2022'] + opset_version: ['18', '15'] + ort_version: ['1.16.3'] + onnx_version: ['1.16.1'] + skip_tflite: ['False'] + include: + - name: 'py38-tf2.13' + tf_version: '2.13.0' + python_version: '3.8' + - name: 'py39-tf2.15' + tf_version: '2.15.0' + python_version: '3.9' + - name: 'py37-tf1.15' + tf_version: '1.15.5' + python_version: '3.7' + os: 'ubuntu-latest' + opset_version: '15' + ort_version: '1.14.1' + onnx_version: '1.14.1' + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }}) + uses: ./.github/actions/pretrained_model_test + with: + tf_version: ${{ matrix.tf_version }} + python_version: ${{ matrix.python_version }} + ort_version: ${{ matrix.ort_version }} + onnx_version: ${{ matrix.onnx_version }} + opset_version: ${{ matrix.opset_version }} + skip_tflite: ${{ matrix.skip_tflite }} + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }}) + path: ./**/test-results-*.xml + + publish-test-results: + name: "Publish Tests Results to Github" + needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Extra_tests] + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + if: always() + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "**/pytest*.xml" \ No newline at end of file diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 000000000..ac5631aa3 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,31 @@ +name: Pylint + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + enforce-style: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 # Specify the desired Python version (e.g., 3.8, 3.9) + + - name: Install dependencies + run: pip install pylint==2.4.4 + + - name: Run pylint + run: | + pip freeze + pylint --rcfile=tools/pylintrc --ignore=version.py,tflite --disable=cyclic-import tf2onnx tests/*.py tools -j 0 + +# Add other jobs or steps as needed diff --git a/.github/workflows/unit_test_ci.yml b/.github/workflows/unit_test_ci.yml new file mode 100644 index 000000000..1dcbef980 --- /dev/null +++ b/.github/workflows/unit_test_ci.yml @@ -0,0 +1,140 @@ +name: Unit Test (CI) + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + 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. + strategy: + fail-fast: false + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py38-TF2.9-18) + uses: ./.github/actions/unit_test + with: + os: 'ubuntu-latest' + tf_version: '2.9.0' + python_version: '3.8' + ort_version: '1.16.3' + onnx_version: '1.16.1' + opset_version: '18' + skip_tflite: 'False' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py38-TF2.9-18-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-18) + uses: ./.github/actions/unit_test + with: + os: 'ubuntu-latest' + tf_version: '2.15.0' + python_version: '3.10' + ort_version: '1.16.3' + onnx_version: '1.16.1' + opset_version: '18' + skip_tflite: 'False' + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py310-TF2.15-18-ubuntu) + path: ./**/test-results-*.xml + + Extra_tests: + strategy: + fail-fast: false + matrix: + name: + - 'py38-tf2.13' + - 'py39-tf2.15' + os: ['ubuntu-latest', 'windows-2022'] + opset_version: ['18', '15'] + ort_version: ['1.16.3'] + onnx_version: ['1.16.1'] + skip_tflite: ['False'] + include: + - name: 'py38-tf2.13' + tf_version: '2.13.0' + python_version: '3.8' + - name: 'py39-tf2.15' + tf_version: '2.15.0' + python_version: '3.9' + - name: 'py37-tf1.15' + tf_version: '1.15.5' + python_version: '3.7' + os: 'ubuntu-latest' + opset_version: '15' + ort_version: '1.14.1' + onnx_version: '1.14.1' + skip_tflite: 'True' + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }}) + uses: ./.github/actions/unit_test + with: + tf_version: ${{ matrix.tf_version }} + python_version: ${{ matrix.python_version }} + ort_version: ${{ matrix.ort_version }} + onnx_version: ${{ matrix.onnx_version }} + opset_version: ${{ matrix.opset_version }} + skip_tflite: ${{ matrix.skip_tflite }} + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (Py${{ matrix.python_version }}_TF${{ matrix.tf_version }}_${{ matrix.os }}_${{ matrix.opset_version }}_${{ matrix.ort_version }}_${{ matrix.skip_tflite }}) + path: ./**/test-results-*.xml + + publish-test-results: + name: "Publish Tests Results to Github" + needs: [Test_min_py_with_min_tf, Test_max_py_with_latest_tf, Extra_tests] + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + if: always() + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "artifacts/**/*.xml" \ No newline at end of file diff --git a/ci_build/azure_pipelines/coveragerc b/ci_build/azure_pipelines/coveragerc deleted file mode 100644 index 4646e272c..000000000 --- a/ci_build/azure_pipelines/coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[paths] -source = - ./ diff --git a/ci_build/azure_pipelines/keras2onnx_application_tests.yml b/ci_build/azure_pipelines/keras2onnx_application_tests.yml deleted file mode 100644 index 400fdc395..000000000 --- a/ci_build/azure_pipelines/keras2onnx_application_tests.yml +++ /dev/null @@ -1,134 +0,0 @@ -# Nightly keras2onnx application tests - -jobs: - -- job: 'Linux' - timeoutInMinutes: 180 - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - Python310-tf2-2.13: - python.version: '3.10' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.13.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==3.4.0 - INSTALL_NUMPY: pip install numpy==1.19.0 - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python39-tf2-2.12: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.12.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==3.4.0 - INSTALL_NUMPY: pip install numpy==1.19.0 - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python310-tf2-2.11: - python.version: '3.10' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.11.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==3.4.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python39-tf2-2.10: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.12.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - steps: - - template: 'templates/keras2onnx_application_tests.yml' - parameters: - platform: 'linux' - -- job: 'Win' - timeoutInMinutes: 180 - pool: - vmImage: 'windows-2019' - strategy: - matrix: - Python37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - INSTALL_KERAS: pip install keras==2.3.1 - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: - INSTALL_NUMPY: pip install numpy==1.19.0 - INSTALL_LEGACY: pip install h5py==2.9.0 - NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py" - - Python39-tf2-2.15: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.15.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.2.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python39-tf2-2.11: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.11.0 - INSTALL_ORT: pip install onnxruntime==1.15.1 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==3.4.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python38-tf2-2.10: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.15.1 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.12.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python38-tf2-2.9: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.9.0 - INSTALL_ORT: pip install onnxruntime==1.15.1 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.12.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - steps: - - template: 'templates/keras2onnx_application_tests.yml' - parameters: - platform: 'windows' diff --git a/ci_build/azure_pipelines/keras2onnx_unit_test.yml b/ci_build/azure_pipelines/keras2onnx_unit_test.yml deleted file mode 100644 index 47adaf412..000000000 --- a/ci_build/azure_pipelines/keras2onnx_unit_test.yml +++ /dev/null @@ -1,106 +0,0 @@ -# Nightly keras2onnx unit tests - -jobs: - -- job: 'Linux' - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - ############ TF Keras Unit Tests ############ - Python310-tf2-2.13: - python.version: '3.10' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.13.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python39-tf2-2.12: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.12.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python39-tf2-2.11: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.11.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python38-tf2-2.10: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - ############ Pure Keras Unit Tests ############ - Keras-Py37-tf1.15.0: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - KERAS: keras==2.4.3 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - steps: - - template: 'templates/keras2onnx_unit_test.yml' - parameters: - platform: 'linux' - -- job: 'Win' - pool: - vmImage: 'windows-2019' - strategy: - matrix: - ############ TF Keras Unit Tests ############ - Python310-tf2-2.14: - python.version: '3.10' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.14.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python39-tf2-2.13: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.13.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python38-tf2-2.12: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.12.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python39-tf2-2.11: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.11.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - Python38-tf2-2.10: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.15.0 - INSTALL_NUMPY: - - ############ Pure Keras Unit Tests ############ - Keras-Py37-tf1.15.0: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - KERAS: keras==2.4.3 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - steps: - - template: 'templates/keras2onnx_unit_test.yml' - parameters: - platform: 'windows' diff --git a/ci_build/azure_pipelines/onnxruntime_nightly_test.yml b/ci_build/azure_pipelines/onnxruntime_nightly_test.yml deleted file mode 100644 index 8a184ec50..000000000 --- a/ci_build/azure_pipelines/onnxruntime_nightly_test.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Test against latest onnxruntime nightly package - -stages: - - stage: - jobs: - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: [3.7'] - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_backends: {onnxruntime: ['nightly']} - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.8'] - tf_versions: ['2.9.0', '2.10.0'] - onnx_backends: {onnxruntime: ['nightly']} - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.9'] - tf_versions: ['2.11.0', '2.12.0'] - onnx_backends: {onnxruntime: ['nightly']} - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.10'] - tf_versions: ['2.13.0', '2.15.0'] - onnx_backends: {onnxruntime: ['nightly']} - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/combine_test_coverage.yml' - -schedules: -- cron: "0 12 */3 * *" - displayName: Every 3 days onnxruntime nightly unittest - branches: - include: - - main - always: true diff --git a/ci_build/azure_pipelines/pretrained_model_test-matrix.yml b/ci_build/azure_pipelines/pretrained_model_test-matrix.yml deleted file mode 100755 index f297a3e3c..000000000 --- a/ci_build/azure_pipelines/pretrained_model_test-matrix.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Pre-trained model test, full matrix - -jobs: - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['windows'] - python_versions: ['3.7'] # Max version that supports tf 1.15 - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['18', '17', '16', '15', '14'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.7'] # Max version that supports tf 1.15 - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['18', '17', '16', '14'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['windows'] - python_versions: ['3.9'] - tf_versions: ['2.9.0', '2.15.0'] - onnx_opsets: ['18', '17', '16', '15'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.8'] - tf_versions: ['2.9.0'] - onnx_opsets: ['17', '16', '14'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.10'] - tf_versions: ['2.15.0'] - onnx_opsets: ['17', '16', '14'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.8'] - tf_versions: ['2.10.0'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.9'] - tf_versions: ['2.11.0', '2.12.0'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.10'] - tf_versions: ['2.14.0'] - job: - steps: - - template: 'pretrained_model_test.yml' - -schedules: -- cron: "0 11 */3 * *" - displayName: pre-trained model test, full matrix, run every 3 days - branches: - include: - - main - always: true diff --git a/ci_build/azure_pipelines/pretrained_model_test.yml b/ci_build/azure_pipelines/pretrained_model_test.yml deleted file mode 100644 index a5b757daa..000000000 --- a/ci_build/azure_pipelines/pretrained_model_test.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Pre-trained model test - -jobs: -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.7'] # Max version that supports tf 1.15 - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['15'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.8'] - tf_versions: ['2.9.0'] - onnx_opsets: ['18', '15'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.9'] - tf_versions: ['2.15.0'] - onnx_opsets: ['18', '15'] - job: - steps: - - template: 'pretrained_model_test.yml' - -- template: 'templates/job_generator.yml' - parameters: - platforms: ['linux'] - python_versions: ['3.10'] - tf_versions: ['2.9.0', '2.15.0'] - onnx_opsets: ['18', '15'] - job: - steps: - - template: 'pretrained_model_test.yml' \ No newline at end of file diff --git a/ci_build/azure_pipelines/pylint.yml b/ci_build/azure_pipelines/pylint.yml deleted file mode 100644 index 1f13e0c8b..000000000 --- a/ci_build/azure_pipelines/pylint.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Pylint - -jobs: -- template: 'templates/job_generator.yml' - parameters: - onnx_opsets: [''] - job: - steps: - - bash: | - set -ex - pip install pylint==2.4.4 - pip freeze - pylint --rcfile=tools/pylintrc --ignore=version.py,tflite --disable=cyclic-import tf2onnx tests/*.py tools -j 0 - displayName: 'Pylint' - diff --git a/ci_build/azure_pipelines/templates/combine_test_coverage.yml b/ci_build/azure_pipelines/templates/combine_test_coverage.yml deleted file mode 100644 index 53d573abf..000000000 --- a/ci_build/azure_pipelines/templates/combine_test_coverage.yml +++ /dev/null @@ -1,46 +0,0 @@ -# combine and report unittest coverage - -parameters: - artifact_name: 'single_test_coverage' - -stages: -- stage: - jobs: - - job: 'combine_and_report_coverage' - variables: - CI_ARTIFACT_NAME: '${{ parameters.artifact_name }}' - - pool: - vmImage: 'ubuntu-latest' - - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download Single Test Coverage' - inputs: - artifactName: '${{ parameters.artifact_name }}' - downloadPath: $(System.DefaultWorkingDirectory) - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - architecture: 'x64' - - - bash: | - pip install -U coverage - condition: succeeded() - displayName: 'Install Coverage' - - - bash: | - cat ${CI_ARTIFACT_NAME}/.coveragerc_paths* >> ci_build/azure_pipelines/coveragerc - coverage combine --rcfile ci_build/azure_pipelines/coveragerc ${CI_ARTIFACT_NAME} - coverage report - coverage html -d ${BUILD_ARTIFACTSTAGINGDIRECTORY}/coverage_report - condition: succeeded() - displayName: 'Combine And Report Test Coverage' - - - task: PublishBuildArtifacts@1 - condition: succeeded() - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: 'test_coverage_report' - displayName: 'Deploy Test Coverage Report' diff --git a/ci_build/azure_pipelines/templates/job_generator.yml b/ci_build/azure_pipelines/templates/job_generator.yml deleted file mode 100644 index 826ff03c6..000000000 --- a/ci_build/azure_pipelines/templates/job_generator.yml +++ /dev/null @@ -1,106 +0,0 @@ -# This template generates multiple jobs based on input parameters - -parameters: - platforms: ['linux'] - python_versions: ['3.8'] - tf_versions: [''] - onnx_versions: ['1.15.0'] - onnx_opsets: ['18', '17', '16', '15', '14'] - onnx_backends: {onnxruntime: ['1.16.3']} - job: {} - run_setup: 'True' - report_coverage: 'False' - artifact_name: 'single_test_coverage' - skip_tflite_tests: 'True' - skip_tfjs_tests: 'True' - skip_tf_tests: 'False' - -jobs: - - job: ${{ parameters.job.name }} - timeoutInMinutes: 100 - pool: - vmImage: $(CI_VM_IMAGE) - - # Generate matrix - strategy: - matrix: - ${{ each platform in parameters.platforms }}: - ${{ each python_version in parameters.python_versions }}: - ${{ each tf_version in parameters.tf_versions }}: - ${{ each onnx_version in parameters.onnx_versions }}: - ${{ each onnx_backend in parameters.onnx_backends }}: - ${{ each onnx_backend_version in onnx_backend.value }}: - ${{ each onnx_opset in parameters.onnx_opsets }}: - ${{ format('{0} python{1}{2}{3} tf{4} onnx{5} {6}{7}{8}', platform, python_version, replace(replace(parameters.skip_tflite_tests,'True', ''), 'False', ' tflite'), replace(replace(parameters.skip_tfjs_tests,'True', ''), 'False', ' tfjs'), tf_version, onnx_version, replace(format('opset{0} ', onnx_opset), 'opset ', ''), onnx_backend.key, onnx_backend_version) }}: - ${{ if eq(platform, 'linux') }}: - CI_VM_IMAGE: 'ubuntu-latest' - ${{ if eq(platform, 'windows') }}: - CI_VM_IMAGE: 'windows-2019' - ${{ if eq(platform, 'mac') }}: - CI_VM_IMAGE: 'macOS-11' - CI_PLATFORM: '${{ platform }}' - CI_PYTHON_VERSION: '${{ python_version }}' - CI_TF_VERSION: '${{ tf_version }}' - CI_ONNX_VERSION: '${{ onnx_version }}' - ${{ if ne(onnx_opset, '') }}: - CI_ONNX_OPSET: '${{ onnx_opset }}' - CI_ONNX_BACKEND: '${{ onnx_backend.key }}' - CI_ONNX_BACKEND_VERSION: '${{ onnx_backend_version }}' - CI_SKIP_TF_TESTS: '${{ parameters.skip_tf_tests }}' - CI_SKIP_TFLITE_TESTS: '${{ parameters.skip_tflite_tests }}' - CI_SKIP_TFJS_TESTS: '${{ parameters.skip_tfjs_tests }}' - - ${{ if eq(tf_version, '') }}: - CI_PIP_TF_NAME: 'tensorflow' - ${{ if ne(tf_version, '') }}: - CI_PIP_TF_NAME: ${{ format('tensorflow=={0}', tf_version) }} - - ${{ if eq(onnx_version, '') }}: - CI_PIP_ONNX_NAME: 'onnx' - ${{ if ne(onnx_version, '') }}: - CI_PIP_ONNX_NAME: ${{ format('onnx=={0}', onnx_version) }} - - ${{ if eq(onnx_backend_version, '') }}: - CI_PIP_ONNX_BACKEND_NAME: '${{ onnx_backend.key }}' - ${{ if ne(onnx_backend_version, '') }}: - ${{ if ne(onnx_backend_version, 'nightly') }}: - CI_PIP_ONNX_BACKEND_NAME: ${{ format('{0}=={1}', onnx_backend.key, onnx_backend_version) }} - ${{ if eq(onnx_backend_version, 'nightly') }}: - CI_PIP_ONNX_BACKEND_NAME: '${{ onnx_backend.key }}' - CI_ONNXRUNTIME_NIGHTLY: 'true' - - # Insert all properties other than pool/steps/strategy - ${{ each pair in parameters.job }}: - ${{ if not(in(pair.key, 'pool', 'steps', 'strategy')) }}: - ${{ pair.key }}: ${{ pair.value }} - - steps: - - bash: env - displayName: 'Display Environment Variables' - - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(CI_PYTHON_VERSION)' - architecture: 'x64' - - - ${{ if eq(parameters.run_setup, 'True') }}: - - template: 'setup.yml' - - # Insert original steps - - ${{ parameters.job.steps }} - - # Report and publish test coverage - # Save source path for combining coverage cross platform - - bash: | - coverage report - mv .coverage ${BUILD_ARTIFACTSTAGINGDIRECTORY}/.coverage.${CI_PLATFORM}_python${CI_PYTHON_VERSION}_tf${CI_TF_VERSION}_onnx${CI_ONNX_VERSION}_${CI_ONNX_BACKEND}${CI_ONNX_VERSION} - echo " ${SYSTEM_DEFAULTWORKINGDIRECTORY}" > ${BUILD_ARTIFACTSTAGINGDIRECTORY}/.coveragerc_paths.${CI_PLATFORM}_python${CI_PYTHON_VERSION}_tf${CI_TF_VERSION}_onnx${CI_ONNX_VERSION}_${CI_ONNX_BACKEND}${CI_ONNX_VERSION} - condition: and(succeededOrFailed(), eq(${{ parameters.report_coverage }}, 'True')) - displayName: 'Report Single Test Coverage' - - - task: PublishBuildArtifacts@1 - condition: succeeded() - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: '${{ parameters.artifact_name }}' - displayName: 'Deploy Single Test Coverage' diff --git a/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml b/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml deleted file mode 100644 index 2c4a54e7c..000000000 --- a/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml +++ /dev/null @@ -1,128 +0,0 @@ -# Run applications tests from keras2onnx - -parameters: - platform: 'linux' - - -steps: -- ${{ if eq(parameters.platform, 'linux') }}: - - script: sudo install -d -m 0777 /home/vsts/.conda/envs - displayName: Fix Conda permissions - - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - script: | - python -m pip install --upgrade pip - conda config --set always_yes yes --set changeps1 no - pip install onnxconverter-common - pip install $(ONNX_PATH) - pip uninstall -y protobuf - pip install "protobuf~=3.20" - pip install h5py==3.7.0 - pip install parameterized - pip install timeout-decorator - pip install coloredlogs flatbuffers - $(INSTALL_TENSORFLOW) - $(INSTALL_KERAS) - $(INSTALL_ORT) - pip install Pillow==8.2.0 - 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 - $(INSTALL_KERAS_RESNET) - pip install git+https://www.github.com/keras-team/keras-contrib.git - pip install keras-tcn==2.8.3 - $(UNINSTALL_KERAS) - pip install git+https://github.com/qubvel/efficientnet - $(INSTALL_TRANSFORMERS) - pip install keras-self-attention - pip install pytest pytest-cov pytest-runner - $(INSTALL_NUMPY) - if [[ ! -z $INSTALL_LEGACY ]]; - then - pip install $(INSTALL_LEGACY) - fi - - pip freeze --all - displayName: 'Install dependencies' - - - script: | - pip install -e . - python -c "import onnxruntime" - pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml - cd tests/keras2onnx_applications/nightly_build - $(NIGHTLY_BUILD_TEST) - displayName: 'pytest' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results-*.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() - -- ${{ if eq(parameters.platform, 'windows') }}: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - - script: | - python -m pip install --upgrade pip numpy - echo Test numpy installation... && python -c "import numpy" - pip install onnxconverter-common - pip install %ONNX_PATH% - pip uninstall -y protobuf - pip install "protobuf~=3.20" - pip install h5py==3.7.0 - pip install parameterized - pip install timeout-decorator - pip install coloredlogs flatbuffers - %INSTALL_TENSORFLOW% - %INSTALL_KERAS% - %INSTALL_ORT% - pip install Pillow==8.2.0 - pip install opencv-python - pip install tqdm - pip install keras-segmentation==0.2.0 - pip install matplotlib - git clone https://github.com/qqwweee/keras-yolo3 - %INSTALL_KERAS_RESNET% - pip install git+https://www.github.com/keras-team/keras-contrib.git - pip install keras-tcn==2.8.3 - %UNINSTALL_KERAS% - pip install git+https://github.com/qubvel/efficientnet - %INSTALL_TRANSFORMERS% - pip install keras-self-attention - pip install pytest pytest-cov pytest-runner - %INSTALL_NUMPY% - IF NOT "%INSTALL_LEGACY%"=="" (pip install %INSTALL_LEGACY%) - - pip freeze --all - displayName: 'Install dependencies' - - - script: | - pip install -e . - echo Test onnxruntime installation... && python -c "import onnxruntime" - pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml - cd tests/keras2onnx_applications/nightly_build - %NIGHTLY_BUILD_TEST% - displayName: 'pytest' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results-*.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() diff --git a/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml b/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml deleted file mode 100644 index adb436f0a..000000000 --- a/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml +++ /dev/null @@ -1,97 +0,0 @@ -# Run unit tests from keras2onnx - -parameters: - platform: 'linux' - - -steps: -- ${{ if eq(parameters.platform, 'linux') }}: - - script: sudo install -d -m 0777 /home/vsts/.conda/envs - displayName: Fix Conda permissions - - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - script: | - python -m pip install --upgrade pip - conda config --set always_yes yes --set changeps1 no - pip install onnxconverter-common - pip install $(ONNX_PATH) - pip uninstall -y protobuf - pip install "protobuf~=3.20" - pip install h5py==3.7.0 - pip install parameterized - pip install timeout-decorator - pip install coloredlogs flatbuffers - pip install $(TENSORFLOW_PATH) - if [[ ! -z $KERAS ]]; - then - pip install $(KERAS) - fi - pip install -r requirements.txt - pip install -r requirements-dev.txt - pip install pytest pytest-cov pytest-runner - $(INSTALL_ORT) - $(INSTALL_NUMPY) - - pip freeze --all - displayName: 'Install dependencies' - - - script: | - pip install -e . - python -c "import onnxruntime" - python -c "import onnxconverter_common" - if [[ ! -z $KERAS ]]; - then - export TF_KERAS=0 - fi - pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml - displayName: 'pytest' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() - -- ${{ if eq(parameters.platform, 'windows') }}: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - script: | - python -m pip install --upgrade pip numpy - echo Test numpy installation... && python -c "import numpy" - pip install onnxconverter-common - pip install %ONNX_PATH% - pip uninstall -y protobuf - pip install "protobuf~=3.20" - pip install h5py==3.7.0 - pip install parameterized - pip install timeout-decorator - pip install coloredlogs flatbuffers - pip install %TENSORFLOW_PATH% - IF NOT "%KERAS%"=="" (pip install %KERAS%) - pip install pytest pytest-cov pytest-runner - %INSTALL_ORT% - %INSTALL_NUMPY% - - pip freeze --all - displayName: 'Install dependencies' - - - script: | - pip install -e . - echo Test onnxruntime installation... && python -c "import onnxruntime" - python -c "import onnxconverter_common" - IF NOT "%KERAS%"=="" (set TF_KERAS=0) - pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml - displayName: 'pytest' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() diff --git a/ci_build/azure_pipelines/templates/pretrained_model_test.yml b/ci_build/azure_pipelines/templates/pretrained_model_test.yml deleted file mode 100644 index a0971d9f2..000000000 --- a/ci_build/azure_pipelines/templates/pretrained_model_test.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Run pre-trained model test - -steps: -- bash: | - set -x - status=0 - # TODO: fix unity model path - # python tests/run_pretrained_models.py --backend $CI_ONNX_BACKEND --opset $CI_ONNX_OPSET --config tests/unity.yaml || status=$? - python tests/run_pretrained_models.py --backend $CI_ONNX_BACKEND --opset $CI_ONNX_OPSET --skip_tf_tests $CI_SKIP_TF_TESTS --skip_tflite_tests $CI_SKIP_TFLITE_TESTS --skip_tfjs_tests $CI_SKIP_TFJS_TESTS --config tests/run_pretrained_models.yaml || status=$? - exit $status - displayName: 'Test Pre-trained Model' diff --git a/ci_build/azure_pipelines/templates/setup.yml b/ci_build/azure_pipelines/templates/setup.yml deleted file mode 100644 index 2e2e86c98..000000000 --- a/ci_build/azure_pipelines/templates/setup.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Install all dependencies - -steps: -- bash: | - set -ex - pip install pytest pytest-cov pytest-runner coverage graphviz requests pyyaml pillow pandas parameterized sympy coloredlogs flatbuffers timeout-decorator - pip install $(CI_PIP_ONNX_NAME) - pip install $(CI_PIP_ONNX_BACKEND_NAME) numpy - - if [[ $CI_SKIP_TFJS_TESTS == "False" ]] ; - then - pip install tensorflowjs==3.18.0 - npm install @tensorflow/tfjs - fi - - if [[ $CI_TF_VERSION == 2.* ]] ; - then - pip install onnxruntime-extensions - pip install "tensorflow-text<=$(CI_TF_VERSION)" - fi - - if [[ $CI_ONNXRUNTIME_NIGHTLY == "true" ]] ; - then - pip uninstall -y onnxruntime - # install numpy upfront since it is not on https://test.pypi.org/simple/ - pip install 'numpy>=1.18' - pip install -i https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ ort-nightly - fi - - pip uninstall -y tensorflow - pip install $(CI_PIP_TF_NAME) - pip uninstall -y protobuf - pip install "protobuf~=3.20" - - python setup.py install - - if [[ $ONNX_TEST == "true" ]] ; - then - # onnx-weekly won't satisfy onnx requirement so uninstallation must happen here - pip uninstall -y onnx - pip install --index-url https://test.pypi.org/simple/ ${PIP_ONNX_NAME:-onnx} - fi - - pip freeze --all - displayName: 'Setup Environment' - -# TODO: remove later -# Anaconda python 3.6.8 h9f7ef89_1 changed dll lookup logic, numpy fails to load dll on Windows -# https://github.com/numpy/numpy/issues/12957 -# https://github.com/ContinuumIO/anaconda-issues/issues/10629 -# Add numpy lib path manually here -# On Windows sqlite3.dll is found under Library/bin -- bash: | - site_dir=$(python -c "import site; print(site.getsitepackages()[1])") - echo "##vso[task.prependpath]$site_dir\numpy\.libs" - base_dir=$(python -c "import site; print(site.getsitepackages()[0])") - echo "##vso[task.prependpath]$base_dir/Library/bin" - displayName: 'Fix Paths' - condition: and(succeeded(), in(variables['Agent.OS'], 'Windows_NT')) - -- bash: env - displayName: 'Display Environment Variables' diff --git a/ci_build/azure_pipelines/templates/unit_test.yml b/ci_build/azure_pipelines/templates/unit_test.yml deleted file mode 100644 index 808b9e6f3..000000000 --- a/ci_build/azure_pipelines/templates/unit_test.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Run unit test - -parameters: - onnx_opset: '' - skip_tflite_tests: '' - skip_tfjs_tests: '' - skip_tf_tests: '' - -steps: -- bash: | - parameters.onnx_opset=$CI_ONNX_OPSET - parameters.skip_tflite_tests=$CI_SKIP_TFLITE_TESTS - parameters.skip_tfjs_tests=$CI_SKIP_TFJS_TESTS - parameters.skip_tf_tests=$CI_SKIP_TF_TESTS - export TF2ONNX_TEST_BACKEND=$CI_ONNX_BACKEND - export TF2ONNX_TEST_OPSET=$CI_ONNX_OPSET - export TF2ONNX_SKIP_TFLITE_TESTS=$CI_SKIP_TFLITE_TESTS - export TF2ONNX_SKIP_TFJS_TESTS=$CI_SKIP_TFJS_TESTS - export TF2ONNX_SKIP_TF_TESTS=$CI_SKIP_TF_TESTS - python -m pytest --cov=tf2onnx --cov-report=term --disable-pytest-warnings -r s tests --cov-append - timeoutInMinutes: 15 - displayName: 'Run UnitTest' - condition: succeededOrFailed() - env: - CI_ONNX_OPSET: '${{ parameters.onnx_opset }}' - CI_SKIP_TFLITE_TESTS: '${{ parameters.skip_tflite_tests }}' - CI_SKIP_TFJS_TESTS: '${{ parameters.skip_tfjs_tests }}' - CI_SKIP_TF_TESTS: '${{ parameters.skip_tf_tests }}' diff --git a/ci_build/azure_pipelines/trimmed_keras2onnx_application_tests.yml b/ci_build/azure_pipelines/trimmed_keras2onnx_application_tests.yml deleted file mode 100644 index 2b0e66dd5..000000000 --- a/ci_build/azure_pipelines/trimmed_keras2onnx_application_tests.yml +++ /dev/null @@ -1,75 +0,0 @@ -# keras2onnx application tests (trimmed) - -jobs: - -- job: 'Linux' - timeoutInMinutes: 180 - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - Python37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - INSTALL_KERAS: pip install keras==2.3.1 - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: - INSTALL_NUMPY: pip install numpy==1.19.0 - INSTALL_LEGACY: pip install h5py==2.9.0 - NIGHTLY_BUILD_TEST: python run_all_v2.py --exclude "test_keras_applications_v2.py" - - Python38-tf2-oldest: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.9.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.2.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python310-tf2-latest: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.15.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.2.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python38-tf2-oldest-plus-1: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.2.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - Python39-tf2-latest-minus-1: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - INSTALL_KERAS: - UNINSTALL_KERAS: - INSTALL_TENSORFLOW: pip install tensorflow==2.14.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_KERAS_RESNET: pip install keras-resnet - INSTALL_TRANSFORMERS: pip install transformers==4.2.0 - INSTALL_NUMPY: - NIGHTLY_BUILD_TEST: python run_all_v2.py - - steps: - - template: 'templates/keras2onnx_application_tests.yml' - parameters: - platform: 'linux' diff --git a/ci_build/azure_pipelines/trimmed_keras2onnx_unit_test.yml b/ci_build/azure_pipelines/trimmed_keras2onnx_unit_test.yml deleted file mode 100644 index 6fc84a41d..000000000 --- a/ci_build/azure_pipelines/trimmed_keras2onnx_unit_test.yml +++ /dev/null @@ -1,102 +0,0 @@ -# Tests copied from keras2onnx - -jobs: - -- job: 'Linux' - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - - ############ TF Keras Unit Tests ############ - Python37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - Python38-tf2-oldest: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.9.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - Python39-tf2-latest: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.15.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - Python39-tf2-oldest-plus-1: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.10.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - Python310-tf2-latest-minus-1: - python.version: '3.10' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.14.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - ############ Pure Keras Unit Tests ############ - Keras-Py37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - KERAS: keras==2.4.3 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - - steps: - - template: 'templates/keras2onnx_unit_test.yml' - parameters: - platform: 'linux' - -- job: 'Win' - pool: - vmImage: 'windows-2019' - strategy: - matrix: - ############ TF Keras Unit Tests ############ - Python37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - Python38-tf2-oldest: - python.version: '3.8' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.9.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - Python39-tf2-latest: - python.version: '3.9' - ONNX_PATH: onnx==1.15.0 - TENSORFLOW_PATH: tensorflow==2.15.0 - INSTALL_ORT: pip install onnxruntime==1.16.3 - INSTALL_NUMPY: - - ############ Pure Keras Unit Tests ############ - Keras-Py37-tf-1.15: - python.version: '3.7' # Max version that supports tf 1.15 - ONNX_PATH: onnx==1.14.1 # Max version that supports python 3.7 - KERAS: keras==2.4.3 - TENSORFLOW_PATH: tensorflow==1.15.0 - INSTALL_ORT: pip install onnxruntime==1.14.1 # Max version that supports python 3.7 - INSTALL_NUMPY: pip install numpy==1.19.0 - - - steps: - - template: 'templates/keras2onnx_unit_test.yml' - parameters: - platform: 'windows' diff --git a/ci_build/azure_pipelines/unit_test-matrix.yml b/ci_build/azure_pipelines/unit_test-matrix.yml deleted file mode 100644 index 25cc33596..000000000 --- a/ci_build/azure_pipelines/unit_test-matrix.yml +++ /dev/null @@ -1,98 +0,0 @@ -# Unit test, full matrix - -stages: - - stage: - jobs: - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.8'] - platforms: ['linux', 'windows'] - tf_versions: ['2.9.0'] - onnx_opsets: ['17', '16', '14'] - skip_tflite_tests: 'False' - skip_tf_tests: 'False' - skip_tfjs_tests: 'True' - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.9'] - platforms: ['linux', 'windows'] - tf_versions: ['2.15.0'] - onnx_opsets: ['17', '16', '14'] - skip_tflite_tests: 'False' - skip_tf_tests: 'False' - skip_tfjs_tests: 'True' - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.7'] # Max version that supports tf 1.15 - platforms: ['windows'] - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['18', '17', '16', '15'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.7'] # Max version that supports tf 1.15 - platforms: ['linux'] - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['18', '17', '16'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.10'] - tf_versions: ['2.14.0'] - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.9'] - tf_versions: ['2.12.0'] - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - platforms: ['linux', 'windows'] - python_versions: ['3.8'] - tf_versions: ['2.10.0', '2.11.0'] - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/combine_test_coverage.yml' - -schedules: -- cron: "0 10 */3 * *" - displayName: Every 3 days nightly Unit Test, full matrix. - branches: - include: - - main - always: true diff --git a/ci_build/azure_pipelines/unit_test.yml b/ci_build/azure_pipelines/unit_test.yml deleted file mode 100644 index 0149196ed..000000000 --- a/ci_build/azure_pipelines/unit_test.yml +++ /dev/null @@ -1,100 +0,0 @@ -# Unit test - -stages: - - stage: - jobs: - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.8'] - platforms: ['linux', 'windows'] - tf_versions: ['2.9.0'] - onnx_opsets: ['18', '15'] - skip_tflite_tests: 'False' - skip_tf_tests: 'False' - skip_tfjs_tests: 'True' - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.9'] - platforms: ['linux', 'windows'] - tf_versions: ['2.15.0'] - onnx_opsets: ['18', '15'] - skip_tflite_tests: 'False' - skip_tf_tests: 'False' - skip_tfjs_tests: 'True' - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.10'] - platforms: ['linux'] - tf_versions: ['2.9.0', '2.15.0'] - onnx_opsets: ['18', '15'] - skip_tflite_tests: 'False' - skip_tf_tests: 'False' - skip_tfjs_tests: 'True' - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - - template: 'templates/job_generator.yml' - parameters: - python_versions: ['3.7'] # Max version that supports tf 1.15 - platforms: ['linux'] - tf_versions: ['1.15.5'] - onnx_versions: ['1.14.1'] # Max version that supports python 3.7 - onnx_opsets: ['15'] - onnx_backends: {onnxruntime: ['1.14.1']} # Max version that supports python 3.7 - job: - steps: - - template: 'unit_test.yml' - report_coverage: 'True' - - # TODO: Enable these tests once https://github.com/onnx/tensorflow-onnx/issues/2118 is fixed. - # - template: 'templates/job_generator.yml' - # parameters: - # python_versions: ['3.9'] - # tf_versions: ['2.9.0'] - # onnx_opsets: [''] - # skip_tfjs_tests: 'False' - # skip_tf_tests: 'True' - # job: - # steps: - # - template: 'unit_test.yml' - # report_coverage: 'True' - - # TODO: Enable these tests once https://github.com/onnx/tensorflow-onnx/issues/2118 is fixed. - # - template: 'templates/job_generator.yml' - # parameters: - # python_versions: ['3.9'] - # tf_versions: ['2.7.4'] - # onnx_opsets: [''] - # skip_tfjs_tests: 'False' - # skip_tf_tests: 'True' - # job: - # steps: - # - template: 'unit_test.yml' - # report_coverage: 'True' - - # TODO: Enable these tests once https://github.com/onnx/tensorflow-onnx/issues/2118 is fixed. - # - template: 'templates/job_generator.yml' - # parameters: - # python_versions: ['3.10'] - # tf_versions: ['2.9.1'] - # onnx_opsets: [''] - # skip_tfjs_tests: 'False' - # skip_tf_tests: 'True' - # job: - # steps: - # - template: 'unit_test.yml' - # report_coverage: 'True' - - - template: 'templates/combine_test_coverage.yml' diff --git a/tests/run_pretrained_models.py b/tests/run_pretrained_models.py index c81e1f322..a6a952af3 100644 --- a/tests/run_pretrained_models.py +++ b/tests/run_pretrained_models.py @@ -16,14 +16,16 @@ import time import zipfile import random + from collections import namedtuple +import six from packaging.version import Version import yaml import numpy as np import PIL.Image -import six + os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import tensorflow as tf diff --git a/tests/utils/setup_test_env.sh b/tests/utils/setup_test_env.sh new file mode 100755 index 000000000..a14828d05 --- /dev/null +++ b/tests/utils/setup_test_env.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# # Check if the argument is provided +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Assign the argument to a variable +TF_VERSION=$1 +ORT_VERSION=$2 +ONNX_VERSION=$3 + +echo "==== TensorFlow version: $TF_VERSION" +echo "==== ONNXRuntime version: $ORT_VERSION" +echo "==== ONNX version: $ONNX_VERSION" + +pip install pytest pytest-cov pytest-runner coverage graphviz requests pyyaml pillow pandas parameterized sympy coloredlogs flatbuffers timeout-decorator +pip install onnx==$ONNX_VERSION +pip install onnxruntime==$ORT_VERSION +pip install "numpy<2" + +pip install onnxruntime-extensions +pip install "tensorflow-text<=$TF_VERSION" + +pip uninstall -y tensorflow +pip install tensorflow==$TF_VERSION +pip uninstall -y protobuf +pip install "protobuf~=3.20" + +python setup.py install + +echo "----- List all of depdencies:" +pip freeze --all \ No newline at end of file diff --git a/tf2onnx/optimizer/transpose_optimizer.py b/tf2onnx/optimizer/transpose_optimizer.py index cc16e5f05..76f897828 100644 --- a/tf2onnx/optimizer/transpose_optimizer.py +++ b/tf2onnx/optimizer/transpose_optimizer.py @@ -201,6 +201,7 @@ def _initialize_handlers(self): "Clip": self._simple_through_handler, "Concat": self._concat_handler, "Elu": self._simple_through_handler, + "Erf": self._simple_through_handler, "Exp": self._simple_through_handler, "Identity": self._identity_handler, "LeakyRelu": self._simple_through_handler, @@ -222,6 +223,7 @@ def _initialize_handlers(self): "ReduceSum": self._reducesum_handler, "ReduceSumSquare": self._reduce_handler, "Relu": self._simple_through_handler, + "Selu": self._simple_through_handler, "Shape": self._shape_handler, "Sigmoid": self._simple_through_handler, "Softmax": self._softmax_handler,