Add tf_idf output mode test coverage for StringLookup #14612
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| # TODO: Consider enabling all tests (pytest, applications, etc.) with NNX in the future | |
| # Currently only basic flow tests run with NNX enabled | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| run_cpu_tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| backend: [tensorflow, jax, torch, numpy, openvino] | |
| nnx_enabled: [false] | |
| include: | |
| - backend: jax | |
| nnx_enabled: true | |
| container: | |
| image: python:3.11-slim | |
| name: ${{ format('Run tests on CPU ({0}{1})', matrix.backend, matrix.nnx_enabled && ', NNX' || '') }} | |
| runs-on: linux-x86-n2-16 | |
| timeout-minutes: 120 | |
| env: | |
| KERAS_HOME: .github/workflows/config/${{ matrix.backend }} | |
| steps: | |
| - name: Install binary dependencies | |
| # build-essential is the C++ compiler for Torch Dynamo | |
| # curl, git, gpg are for codecov/codecov-action | |
| run: | | |
| apt-get update | |
| apt-get -y install build-essential | |
| apt-get -y install curl | |
| apt-get -y install git | |
| apt-get -y install gnupg | |
| git config --global --add safe.directory '*' | |
| - name: Checkout ${{ github.ref }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Check for changes in keras/src/applications | |
| uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| id: filter | |
| with: | |
| filters: | | |
| applications: | |
| - 'keras/src/applications/**' | |
| wrappers: | |
| - 'keras/src/wrappers/**' | |
| - name: Install Python dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install --no-deps tf_keras | |
| - name: Run Tests for applications | |
| if: ${{ steps.filter.outputs.applications == 'true' && matrix.nnx_enabled == false }} | |
| run: | | |
| pytest keras/src/applications --cov=keras/src/applications --cov-config=pyproject.toml | |
| coverage xml --include='keras/src/applications/*' -o apps-coverage.xml | |
| - name: Upload Coverage for applications | |
| if: ${{ steps.filter.outputs.applications == 'true' && matrix.nnx_enabled == false }} | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| env_vars: PYTHON,KERAS_HOME | |
| flags: keras.applications,keras.applications-${{ matrix.backend }} | |
| files: apps-coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Run Tests for wrappers | |
| if: ${{ steps.filter.outputs.wrappers == 'true' && matrix.nnx_enabled == false }} | |
| run: | | |
| pytest keras/src/wrappers --cov=keras/src/wrappers --cov-config=pyproject.toml | |
| coverage xml --include='keras/src/wrappers/*' -o wrappers-coverage.xml | |
| - name: Upload Coverage for wrappers | |
| if: ${{ steps.filter.outputs.wrappers == 'true' && matrix.nnx_enabled == false }} | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| env_vars: PYTHON,KERAS_HOME | |
| flags: keras.wrappers,keras.wrappers-${{ matrix.backend }} | |
| files: wrappers-coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Test integrations | |
| if: ${{ matrix.backend != 'numpy' && matrix.nnx_enabled == false }} | |
| run: | | |
| python integration_tests/import_test.py | |
| python integration_tests/numerical_test.py | |
| - name: Test JAX-specific integrations | |
| if: ${{ matrix.backend == 'jax' && matrix.nnx_enabled == false }} | |
| run: | | |
| python integration_tests/jax_custom_fit_test.py | |
| - name: Test basic flow with NNX | |
| if: ${{ matrix.nnx_enabled == true }} | |
| env: | |
| KERAS_NNX_ENABLED: true | |
| run: | | |
| python integration_tests/import_test.py | |
| python integration_tests/basic_full_flow.py | |
| - name: Test TF-specific integrations | |
| if: ${{ matrix.backend == 'tensorflow'}} | |
| run: | | |
| python integration_tests/tf_distribute_training_test.py | |
| python integration_tests/tf_custom_fit_test.py | |
| - name: Test Torch-specific integrations | |
| if: ${{ matrix.backend == 'torch'}} | |
| run: | | |
| pytest integration_tests/torch_workflow_test.py | |
| python integration_tests/torch_custom_fit_test.py | |
| - name: Run Tests | |
| if: ${{ matrix.nnx_enabled == false }} | |
| run: pytest keras -n auto --dist loadfile --ignore keras/src/applications --ignore keras/src/wrappers --cov=keras --cov-config=pyproject.toml | |
| - name: Run Multi-Device Tests | |
| if: ${{ matrix.backend == 'jax' }} | |
| run: JAX_NUM_CPU_DEVICES=4 pytest keras -m multi_device --cov=keras --cov-config=pyproject.toml --cov-append | |
| - name: Convert Coverage | |
| if: ${{ matrix.nnx_enabled == false }} | |
| run: coverage xml --omit='keras/src/applications/*,keras/src/wrappers/*,keras/api' -o core-coverage.xml | |
| - name: Upload Coverage | |
| if: ${{ matrix.nnx_enabled == false }} | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| env_vars: PYTHON,KERAS_HOME,KERAS_NNX_ENABLED | |
| flags: keras,keras-cpu,keras-${{ matrix.backend }}${{ matrix.nnx_enabled == 'true' && '-nnx' || '' }} | |
| files: core-coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| format: | |
| name: Check the code format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout ${{ github.ref }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: '3.11' | |
| - name: Get pip cache dir | |
| id: pip-cache | |
| run: | | |
| python -m pip install --upgrade pip setuptools | |
| echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
| - name: pip cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 # zizmor: ignore[cache-poisoning] | |
| with: | |
| path: ${{ steps.pip-cache.outputs.dir }} | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }} | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt --upgrade | |
| - name: Run pre-commit | |
| run: pre-commit run --all-files --hook-stage manual |