-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathjob_tensorflow_models_tests.yml
More file actions
133 lines (118 loc) · 5.48 KB
/
Copy pathjob_tensorflow_models_tests.yml
File metadata and controls
133 lines (118 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: TensorFlow Models tests
on:
workflow_call:
inputs:
runner:
description: 'Machine on which the tests would run'
type: string
required: true
image:
description: 'Docker image to use for the job'
type: string
required: false
default: null
model_scope:
description: 'Scope of models for testing.'
type: string
required: true
permissions: read-all
env:
HF_HUB_CACHE_LIN: /mount/caches/huggingface
HF_HUB_CACHE_WIN: "C:\\mount\\caches\\huggingface"
HF_TOKEN_PATH_LIN: /secrets/huggingface/token-secondary
HF_TOKEN_PATH_WIN: "C:\\mount\\secrets\\huggingface\\token-secondary"
jobs:
TensorFlow_Models_Tests:
name: TensorFlow Models tests
timeout-minutes: ${{ inputs.model_scope != 'precommit' && 400 || 40 }}
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.image }}
volumes:
- /mount:/mount
- /home/runner/secrets/:/secrets:ro
- ${{ github.workspace }}:${{ github.workspace }} # Needed as ${{ github.workspace }} is not working correctly when using Docker
defaults:
run:
shell: bash
env:
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
INSTALL_DIR: ${{ github.workspace }}/install
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests
NUMBER_OF_REPLICAS: 2
USE_SYSTEM_CACHE: False # Using remote HuggingFace cache
HF_HUB_VERBOSITY: debug
TRANSFORMERS_VERBOSITY: debug
steps:
- name: Fetch custom actions
uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
timeout-minutes: 15
with:
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
submodules: 'false'
- name: Download OpenVINO artifacts (wheels)
uses: akashchi/download-artifact@d59a9c15fec3fdb7c9adf09464124d00f9c11415 # main
with:
name: openvino_wheels
path: ${{ env.INSTALL_DIR }}
- name: Download OpenVINO artifacts (tests)
uses: akashchi/download-artifact@d59a9c15fec3fdb7c9adf09464124d00f9c11415 # main
with:
name: openvino_tests
path: ${{ env.INSTALL_DIR }}
- name: Download OpenVINO artifacts (tokenizers_wheel)
uses: akashchi/download-artifact@d59a9c15fec3fdb7c9adf09464124d00f9c11415 # main
with:
name: openvino_tokenizers_wheel
path: ${{ env.INSTALL_DIR }}
- name: Setup Variables
run: |
echo "HF_HUB_CACHE=${{ runner.os == 'Linux' && env.HF_HUB_CACHE_LIN || env.HF_HUB_CACHE_WIN }}" >> "$GITHUB_ENV"
echo "HUGGINGFACE_HUB_CACHE=${{ runner.os == 'Linux' && env.HF_HUB_CACHE_LIN || env.HF_HUB_CACHE_WIN }}" >> "$GITHUB_ENV"
echo "HF_TOKEN_PATH=${{ runner.os == 'Linux' && env.HF_TOKEN_PATH_LIN || env.HF_TOKEN_PATH_WIN }}" >> "$GITHUB_ENV"
echo "TFHUB_CACHE_DIR=/mount/testdata$((GITHUB_RUN_NUMBER % NUMBER_OF_REPLICAS))/tfhub_models" >> "$GITHUB_ENV"
- name: Extract OpenVINO artifacts (Linux and macOS)
run: pigz -dc openvino_tests.tar.gz | tar -xf - -v
working-directory: ${{ env.INSTALL_DIR }}
- name: Extract OpenVINO artifacts (Windows)
if: ${{ runner.os == 'Windows' }}
run: Expand-Archive openvino_tests.zip -DestinationPath . -Verbose
working-directory: ${{ env.INSTALL_DIR }}
- name: Setup Python 3.11
uses: ./.github/actions/setup_python
with:
version: '3.11'
set-pip-install-path: 'false'
self-hosted-runner: ${{ contains(inputs.runner, 'aks') }}
use-pip-proxy: ${{ contains(inputs.runner, 'aks') }}
- name: Install OpenVINO Python wheels
uses: ./.github/actions/install_ov_wheels
with:
wheels-dir-path: ${{ env.INSTALL_DIR }}
wheels-to-install: 'openvino openvino_tokenizers'
- name: Install TF Models tests requirements
run: python3 -m pip install -r ${INSTALL_TEST_DIR}/requirements_tensorflow
- name: TensorFlow Models Tests - TF FE
run: |
export PYTHONPATH=${INSTALL_TEST_DIR}/model_hub_tests:$PYTHONPATH
python3 -m pytest ${INSTALL_TEST_DIR}/model_hub_tests/tensorflow/test_tf_convert_model.py -m "${MODEL_SCOPE}" \
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_convert_model_"${MODEL_SCOPE}".html --self-contained-html -v
python3 -m pytest ${INSTALL_TEST_DIR}/model_hub_tests/tensorflow/test_tf_read_model.py -m "${MODEL_SCOPE}" \
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_read_model_"${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 ${INSTALL_TEST_DIR}/model_hub_tests/tensorflow/test_tf_hub_api_notebooks.py -m "${MODEL_SCOPE}" \
--html=${INSTALL_TEST_DIR}/TEST-tf_fe_models_notebooks_"${MODEL_SCOPE}".html --self-contained-html -v
env:
TEST_DEVICE: CPU
MODEL_SCOPE: ${{ inputs.model_scope }}
- name: Upload Test Results
uses: ababushk/upload-artifact@ebc7d74ace101c08868aed05dba2aaf274b9a2c7 # main
if: ${{ !cancelled() }}
with:
name: test-results-tensorflow-models-${{ inputs.model_scope }}
path: |
${{ env.INSTALL_TEST_DIR }}/TEST*.html
if-no-files-found: 'error'