Skip to content

Commit 4951954

Browse files
authored
[GHA] Validate integration into Keras 3, OpenVINO backend (openvinotoolkit#28390)
**Details:** Validate integration into Keras 3, OpenVINO backend. We additionally need to secure OpenVINO backend to avoid unpreferable changes from our side. **Ticket:** TBD --------- Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
1 parent b417542 commit 4951954

File tree

2 files changed

+133
-1
lines changed

2 files changed

+133
-1
lines changed
+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Keras 3 OpenVINO Backend
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
description: 'Machine on which the tests would run'
8+
type: string
9+
required: true
10+
container:
11+
description: 'JSON to be converted to the value of the "container" configuration for the job'
12+
type: string
13+
required: false
14+
default: '{"image": null}'
15+
python-version:
16+
description: 'Python version to setup. E.g., "3.11"'
17+
type: string
18+
required: true
19+
20+
permissions: read-all
21+
22+
env:
23+
PIP_CACHE_PATH_LINUX: /mount/caches/pip/linux
24+
PIP_CACHE_PATH_WIN: "C:\\mount\\caches\\pip\\win"
25+
26+
jobs:
27+
Keras3_OpenVINO_Backend:
28+
name: Keras 3 OpenVINO Backend
29+
timeout-minutes: 10
30+
defaults:
31+
run:
32+
shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }}
33+
runs-on: ${{ inputs.runner }}
34+
container: ${{ fromJSON(inputs.container) }}
35+
env:
36+
INSTALL_DIR: ${{ github.workspace }}/install
37+
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
38+
INSTALL_WHEELS_DIR: ${{ github.workspace }}/install/wheels
39+
KERAS_REPO: ${{ github.workspace }}/keras_repo
40+
KERAS_HOME: ${{ github.workspace }}/keras_repo/.github/workflows/config/openvino
41+
42+
steps:
43+
# Needed as ${{ github.workspace }} is not working correctly when using Docker
44+
- name: Setup Variables
45+
run: |
46+
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
47+
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV"
48+
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV"
49+
echo "KERAS_REPO=$GITHUB_WORKSPACE/keras" >> "$GITHUB_ENV"
50+
echo "KERAS_HOME=$GITHUB_WORKSPACE/keras/.github/workflows/config/openvino" >> "$GITHUB_ENV"
51+
52+
- name: Fetch setup_python and install wheels actions
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
timeout-minutes: 15
55+
with:
56+
sparse-checkout: |
57+
.github/actions/setup_python/action.yml
58+
.github/actions/install_ov_wheels/action.yml
59+
sparse-checkout-cone-mode: false
60+
path: 'openvino'
61+
62+
- name: Clone Keras 3 repository
63+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
timeout-minutes: 15
65+
with:
66+
repository: 'keras-team/keras'
67+
path: ${{ env.KERAS_REPO }}
68+
ref: 'master'
69+
70+
- name: Download OpenVINO artifacts (wheels)
71+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
72+
with:
73+
pattern: openvino_[wheels|openvino_tokenizers]*
74+
path: ${{ env.INSTALL_WHEELS_DIR }}
75+
merge-multiple: true
76+
77+
- name: Setup Python ${{ inputs.python-version }}
78+
uses: ./openvino/.github/actions/setup_python
79+
with:
80+
version: ${{ inputs.python-version }}
81+
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH_LINUX || env.PIP_CACHE_PATH_WIN }}
82+
should-setup-pip-paths: ${{ runner.os != 'macOS' }}
83+
self-hosted-runner: ${{ runner.os != 'macOS' }}
84+
85+
- name: Install OpenVINO Python wheels
86+
uses: ./openvino/.github/actions/install_ov_wheels
87+
with:
88+
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }}
89+
wheels-to-install: 'openvino openvino_tokenizers'
90+
91+
- name: Install test dependencies
92+
working-directory: ${{ env.KERAS_REPO }}
93+
run: |
94+
pip install -r requirements.txt --upgrade
95+
# make sure that no other keras is installed via pip
96+
pip uninstall -y keras keras-nightly
97+
# manually set keras
98+
echo "PYTHONPATH=$KERAS_REPO:$PYTHONPATH" >> "$GITHUB_ENV"
99+
100+
- name: Test integrations
101+
working-directory: ${{ env.KERAS_REPO }}
102+
run: |
103+
python integration_tests/import_test.py --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-keras3_integration1.xml
104+
python integration_tests/numerical_test.py --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-keras3_integration2.xml
105+
106+
- name: Test with pytest
107+
working-directory: ${{ env.KERAS_REPO }}
108+
run: |
109+
IGNORE_FILE="keras/src/backend/openvino/excluded_tests.txt"
110+
IGNORE_ARGS=$(awk '{print "--ignore=" $0}' "$IGNORE_FILE")
111+
pytest keras --ignore keras/src/applications $IGNORE_ARGS --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-keras3_pytest.xml
112+
113+
- name: Upload Test Results
114+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
115+
if: ${{ !cancelled() }}
116+
with:
117+
name: test-results-keras3-backend
118+
path: |
119+
${{ env.INSTALL_TEST_DIR }}/TEST*.html
120+
${{ env.INSTALL_TEST_DIR }}/TEST*.xml
121+
if-no-files-found: 'warn'

.github/workflows/ubuntu_22.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,16 @@ jobs:
344344
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
345345
python-version: '3.11'
346346

347+
Keras3_OpenVINO_Backend:
348+
name: Keras 3 OpenVINO Backend Tests
349+
if: fromJSON(needs.smart_ci.outputs.affected_components).Python_API.test
350+
needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ]
351+
uses: ./.github/workflows/job_keras3_backend.yml
352+
with:
353+
runner: 'aks-linux-4-cores-16gb'
354+
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}'
355+
python-version: '3.11'
356+
347357
CPU_Functional_Tests:
348358
name: CPU functional tests
349359
if: fromJSON(needs.smart_ci.outputs.affected_components).CPU.test
@@ -558,7 +568,8 @@ jobs:
558568
Overall_Status:
559569
name: ci/gha_overall_status
560570
needs: [Smart_CI, Build, Debian_Packages, Samples, Conformance, ONNX_Runtime, CXX_Unit_Tests, Python_Unit_Tests, TensorFlow_Layer_Tests, Pytorch_Layer_Tests,
561-
CPU_Functional_Tests, TensorFlow_Models_Tests_Precommit, PyTorch_Models_Tests, JAX_Models_Tests_Precommit, NVIDIA_Plugin, Openvino_tokenizers, iGPU]
571+
CPU_Functional_Tests, TensorFlow_Models_Tests_Precommit, PyTorch_Models_Tests, JAX_Models_Tests_Precommit, NVIDIA_Plugin, Openvino_tokenizers, iGPU,
572+
Keras3_OpenVINO_Backend]
562573
if: ${{ always() }}
563574
runs-on: ubuntu-latest
564575
steps:

0 commit comments

Comments
 (0)