Skip to content

Commit 9b22324

Browse files
authored
[TF FE][OV Tokenizers] Deploy use of OpenVINO Tokenizers in FE layer tests (openvinotoolkit#22896)
**Details:** We are going to test OpenVINO Tokenizers conversion extensions by FE layer tests. It gives better quality integration between openvino and openvino-tokenizers. For example, operation on string tensors such as tf.raw_ops.StringLower, tf.raw_ops.StringSplitV2 will supported via OV tokenizers near feature until we move them into core part. **Ticket:** 132667 --------- Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
1 parent f93fa01 commit 9b22324

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

.github/workflows/job_python_unit_tests.yml

+11
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ jobs:
5252
name: openvino_tests
5353
path: ${{ env.INSTALL_TEST_DIR }}
5454

55+
- name: Download OpenVINO tokenizers extension
56+
if: ${{ runner.os != 'macOS' && runner.arch != 'ARM64' }} # Ticket: 126287
57+
uses: actions/download-artifact@v3
58+
with:
59+
name: openvino_tokenizers_wheel
60+
path: ${{ env.INSTALL_DIR }}
61+
5562
# Needed as ${{ github.workspace }} is not working correctly when using Docker
5663
- name: Setup Variables
5764
run: |
@@ -98,6 +105,10 @@ jobs:
98105
# Install the core OV wheel
99106
python3 -m pip install ${INSTALL_DIR}/tools/openvino-*.whl
100107
108+
if [[ "${{ runner.arch }}" != "ARM64" ]]; then
109+
python3 -m pip install ${INSTALL_DIR}/openvino_tokenizers-*.whl
110+
fi
111+
101112
extras_to_install="caffe,kaldi,onnx,tensorflow2,pytorch"
102113
103114
if [[ "${{ runner.arch }}" != "ARM64" ]]; then

.github/workflows/linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ jobs:
454454

455455
Python_Unit_Tests:
456456
name: Python unit tests
457-
needs: [ Build, Smart_CI ]
457+
needs: [ Build, Smart_CI, Openvino_tokenizers ]
458458
uses: ./.github/workflows/job_python_unit_tests.yml
459459
with:
460460
runner: 'aks-linux-4-cores-16gb'

.github/workflows/windows.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ jobs:
484484

485485
Python_Unit_Tests:
486486
name: Python unit tests
487-
needs: [ Build, Smart_CI ]
487+
needs: [ Build, Smart_CI, Openvino_tokenizers ]
488488
timeout-minutes: 75
489489
defaults:
490490
run:
@@ -505,6 +505,12 @@ jobs:
505505
name: openvino_package
506506
path: ${{ env.INSTALL_DIR }}
507507

508+
- name: Download OpenVINO tokenizers extension
509+
uses: actions/download-artifact@v3
510+
with:
511+
name: openvino_tokenizers_wheel
512+
path: ${{ env.INSTALL_DIR }}
513+
508514
- name: Download OpenVINO tests package
509515
uses: actions/download-artifact@v3
510516
with:
@@ -542,6 +548,10 @@ jobs:
542548
$ovCoreWheelPath=Get-ChildItem -Path "${{ env.INSTALL_DIR }}\tools" -Filter openvino-*.whl | % { $_.FullName }
543549
python3 -m pip install "$ovCoreWheelPath"
544550
551+
# Find and install the core OV Tokenizers wheel
552+
$ovCoreWheelPath=Get-ChildItem -Path "${{ env.INSTALL_DIR }}" -Filter openvino_tokenizers-*.whl | % { $_.FullName }
553+
python3 -m pip install "$ovCoreWheelPath"
554+
545555
# Find and install the dev OV wheel
546556
$ovDevWheelPath=Get-ChildItem -Path "${{ env.INSTALL_DIR }}\tools" -Filter openvino_dev*.whl | % { $_.FullName }
547557
python3 -m pip install "$ovDevWheelPath[mxnet,caffe,kaldi,onnx,tensorflow2,pytorch]"

tests/layer_tests/common/layer_utils.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# Copyright (C) 2018-2023 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
3+
import platform
34
import subprocess
45
import sys
56

67
from common.utils.multiprocessing_utils import multiprocessing_run
78
from openvino.runtime import Core, get_version as ie2_get_version
89

10+
try:
11+
# noinspection PyUnresolvedReferences
12+
import openvino_tokenizers # do not delete, needed for validation of OpenVINO tokenizers extensions
13+
except:
14+
# TODO 132908: add build OpenVINO Tokenizers in GHA for MacOS and ARM64
15+
# TODO 132909: add build OpenVINO Tokenizers in Jenkins for layer_ubuntu20_release tests
16+
assert platform.system() in ('Linux', 'Darwin') or platform.machine() in ('arm', 'armv7l',
17+
'aarch64',
18+
'arm64', 'ARM64')
19+
920

1021
def shell(cmd, env=None, cwd=None):
1122
if sys.platform.startswith('linux') or sys.platform == 'darwin':
@@ -32,6 +43,7 @@ def infer(self, input_data, config=None, infer_timeout=10):
3243
self.res = multiprocessing_run(self.fw_infer, [input_data, config], self.name, infer_timeout)
3344
return self.res
3445

46+
3547
class InferAPI(BaseInfer):
3648
def __init__(self, model, weights, device, use_legacy_frontend):
3749
super().__init__('OpenVINO')

tests/layer_tests/common/utils/common_utils.py

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import logging
55
import os
6+
import platform
67
import shutil
78
import subprocess
89
import sys
@@ -57,6 +58,17 @@ def generate_ir_python_api(coverage=False, **kwargs):
5758
serialize(ov_model, out_dir)
5859
else:
5960
from openvino import convert_model, save_model
61+
try:
62+
# noinspection PyUnresolvedReferences
63+
import openvino_tokenizers # do not delete, needed for validation of OpenVINO tokenizers extensions
64+
except:
65+
# TODO 132908: add build OpenVINO Tokenizers in GHA for MacOS and ARM64
66+
# TODO 132909: add build OpenVINO Tokenizers in Jenkins for layer_ubuntu20_release tests
67+
assert platform.system() in ('Linux', 'Darwin') or platform.machine() in ('arm', 'armv7l',
68+
'aarch64',
69+
'arm64', 'ARM64')
70+
# CI Jenkins job and ARM64 has no openvino_tokenizers available
71+
pass
6072

6173
# cleanup parameters for convert
6274
if 'output_dir' in kwargs:

0 commit comments

Comments
 (0)