122 lines
4.9 KiB
YAML
122 lines
4.9 KiB
YAML
name: TensorFlow Models tests
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
runner:
|
|
description: 'Machine on which the tests would run'
|
|
type: string
|
|
required: true
|
|
container:
|
|
description: 'JSON to be converted to the value of the "container" configuration for the job'
|
|
type: string
|
|
required: false
|
|
default: '{"image": null}'
|
|
model_scope:
|
|
description: 'Scope of models for testing.'
|
|
type: string
|
|
required: true
|
|
|
|
jobs:
|
|
TensorFlow_Models_Tests:
|
|
name: TensorFlow Models tests
|
|
timeout-minutes: ${{ inputs.model_scope != 'precommit' && 400 || 40 }}
|
|
runs-on: ${{ inputs.runner }}
|
|
container: ${{ fromJSON(inputs.container) }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
|
|
OPENVINO_REPO: ${{ github.workspace }}/openvino
|
|
INSTALL_DIR: ${{ github.workspace }}/install
|
|
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
|
|
MODEL_HUB_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/model_hub_tests
|
|
NUMBER_OF_REPLICAS: 2
|
|
steps:
|
|
- name: Download OpenVINO package
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: openvino_package
|
|
path: ${{ env.INSTALL_DIR }}
|
|
|
|
- name: Download OpenVINO tokenizers extension
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: openvino_tokenizers_wheel
|
|
path: ${{ env.INSTALL_DIR }}
|
|
|
|
- name: Download OpenVINO tests package
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: openvino_tests
|
|
path: ${{ env.INSTALL_TEST_DIR }}
|
|
|
|
# Needed as ${{ github.workspace }} is not working correctly when using Docker
|
|
- name: Setup Variables
|
|
run: |
|
|
echo "OPENVINO_REPO=$GITHUB_WORKSPACE/openvino" >> "$GITHUB_ENV"
|
|
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV"
|
|
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV"
|
|
echo "MODEL_HUB_TESTS_INSTALL_DIR=$GITHUB_WORKSPACE/install/tests/model_hub_tests" >> "$GITHUB_ENV"
|
|
echo "TFHUB_CACHE_DIR=/mount/testdata$((GITHUB_RUN_NUMBER % NUMBER_OF_REPLICAS))/tfhub_models" >> "$GITHUB_ENV"
|
|
echo $TFHUB_CACHE_DIR
|
|
echo "HF_HUB_CACHE=/mount/testdata$((GITHUB_RUN_NUMBER % NUMBER_OF_REPLICAS))/hugging_face" >> "$GITHUB_ENV"
|
|
echo $HF_HUB_CACHE
|
|
|
|
- name: Extract OpenVINO packages
|
|
run: |
|
|
pushd ${INSTALL_DIR}
|
|
tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR}
|
|
popd
|
|
|
|
pushd ${INSTALL_TEST_DIR}
|
|
tar -xzf openvino_tests.tar.gz -C ${INSTALL_DIR}
|
|
popd
|
|
|
|
- name: Fetch setup_python action
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
.github/actions/setup_python/action.yml
|
|
sparse-checkout-cone-mode: false
|
|
path: 'openvino'
|
|
|
|
- name: Setup Python 3.11
|
|
uses: ./openvino/.github/actions/setup_python
|
|
with:
|
|
version: '3.11'
|
|
should-setup-pip-paths: 'false'
|
|
self-hosted-runner: ${{ contains(inputs.runner, 'aks') }}
|
|
|
|
- name: Install OpenVINO Python wheels
|
|
run: |
|
|
python3 -m pip install ${INSTALL_DIR}/tools/openvino-*
|
|
python3 -m pip install ${INSTALL_DIR}/openvino_tokenizers-*
|
|
|
|
- name: Install TF Models tests requirements
|
|
run: python3 -m pip install -r ${MODEL_HUB_TESTS_INSTALL_DIR}/tensorflow/requirements.txt
|
|
|
|
- name: TensorFlow Models Tests - TF FE
|
|
run: |
|
|
export PYTHONPATH=${MODEL_HUB_TESTS_INSTALL_DIR}:$PYTHONPATH
|
|
python3 -m pytest ${MODEL_HUB_TESTS_INSTALL_DIR}/tensorflow/test_tf_convert_model.py -m ${{ inputs.model_scope }} \
|
|
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_convert_model_${{ inputs.model_scope }}.html --self-contained-html -v
|
|
python3 -m pytest ${MODEL_HUB_TESTS_INSTALL_DIR}/tensorflow/test_tf_read_model.py -m ${{ inputs.model_scope }} \
|
|
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_read_model_${{ inputs.model_scope }}.html --self-contained-html -v
|
|
# decouple notebook tests due to GitHub issue in tensorflow_hub https://github.com/tensorflow/hub/issues/903
|
|
# and use WA to switch to (legacy) Keras 2
|
|
TF_USE_LEGACY_KERAS=1 python3 -m pytest ${MODEL_HUB_TESTS_INSTALL_DIR}/tensorflow/test_tf_hub_api_notebooks.py -m ${{ inputs.model_scope }} \
|
|
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_notebooks_${{ inputs.model_scope }}.html --self-contained-html -v
|
|
env:
|
|
TEST_DEVICE: CPU
|
|
|
|
- name: Upload Test Results
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
name: test-results-tensorflow-models-${{ inputs.model_scope }}
|
|
path: |
|
|
${{ env.INSTALL_TEST_DIR }}/TEST*.html
|
|
if-no-files-found: 'error'
|