OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[OVC] Update imports (#28356)
Anastasia Kuporosovaa6ea83404178
diff --git a/tools/ovc/openvino/tools/ovc/cli_parser.py b/tools/ovc/openvino/tools/ovc/cli_parser.pyindex 48a396c508b..6163658f00e 100644--- a/tools/ovc/openvino/tools/ovc/cli_parser.py+++ b/tools/ovc/openvino/tools/ovc/cli_parser.py@@ -10,7 +10,7 @@ from collections import OrderedDict, namedtuplefrom typing import List, Unionimport openvino-from openvino.runtime import PartialShape, Dimension, Type # pylint: disable=no-name-in-module,import-error+from openvino import PartialShape, Dimension, Type # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.error import Errorfrom openvino.tools.ovc.help import get_convert_model_help_specificsfrom openvino.tools.ovc.moc_frontend.shape_utils import to_partial_shape, is_shape_typediff --git a/tools/ovc/openvino/tools/ovc/convert.py b/tools/ovc/openvino/tools/ovc/convert.pyindex 1bd61ff567e..9aa6d363598 100644--- a/tools/ovc/openvino/tools/ovc/convert.py+++ b/tools/ovc/openvino/tools/ovc/convert.py@@ -4,7 +4,7 @@import pathlibfrom typing import Any-from openvino.runtime import Model # pylint: disable=no-name-in-module,import-error+from openvino import Model # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.cli_parser import get_all_cli_parserfrom openvino.tools.ovc.convert_impl import _convertfrom openvino.tools.ovc.logger import get_logger_state, restore_logger_state@@ -97,7 +97,7 @@ def convert_model(are reused for weights in the converted model.Returns:- openvino.runtime.Model+ openvino.Model"""params = locals()logger_state = get_logger_state()diff --git a/tools/ovc/openvino/tools/ovc/convert_impl.py b/tools/ovc/openvino/tools/ovc/convert_impl.pyindex c690df9d4a0..0c01145533e 100644--- a/tools/ovc/openvino/tools/ovc/convert_impl.py+++ b/tools/ovc/openvino/tools/ovc/convert_impl.py@@ -44,8 +44,8 @@ except:# pylint: disable=no-name-in-module,import-errorfrom openvino.frontend import FrontEndManager, OpConversionFailure, TelemetryExtension-from openvino.runtime import get_version as get_rt_version-from openvino.runtime import PartialShape+from openvino import get_version as get_rt_version+from openvino import PartialShapetry:from openvino.frontend.tensorflow.utils import create_tf_graph_iterator, type_supported_by_tf_fe, \diff --git a/tools/ovc/openvino/tools/ovc/main.py b/tools/ovc/openvino/tools/ovc/main.pyindex 1118999dcd5..762ecb258f0 100644--- a/tools/ovc/openvino/tools/ovc/main.py+++ b/tools/ovc/openvino/tools/ovc/main.py@@ -17,7 +17,7 @@ from openvino.tools.ovc.utils import import_openvino_tokenizersimport_openvino_tokenizers()# pylint: disable=no-name-in-module,import-error-from openvino.runtime import save_model+from openvino import save_modeldef main():diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py b/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.pyindex 827a8e4338a..c4b40f3c062 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py@@ -3,8 +3,8 @@import json-from openvino.runtime import PartialShape, Model, Type # pylint: disable=no-name-in-module,import-error-from openvino.runtime.utils.types import get_dtype # pylint: disable=no-name-in-module,import-error+from openvino import PartialShape, Model, Type # pylint: disable=no-name-in-module,import-error+from openvino.utils.types import get_dtype # pylint: disable=no-name-in-module,import-errordef json_model_analysis_dump(framework_model: Model):diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py b/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.pyindex 3693a54230f..344d5f70e81 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py@@ -368,7 +368,7 @@ def convert_params_lists_to_dicts(input_model,"""Convert lists of unnamed params to dicts using input names from input_model.- :param input_model: openvino.runtime.InputModel+ :param input_model: openvino.InputModel:param input_user_shapes: list of input shapes or dictionary where key is input name, value is input shape from user.:param input_user_data_types: list of input types or dictionary where key is input name, value is input type from user.@@ -377,7 +377,7 @@ def convert_params_lists_to_dicts(input_model,input_user_data_types_dict - dictionary where key is input name, value is type from user;freeze_placeholder - dictionary where key is input name, value is input value from user;"""- from openvino.runtime import PartialShape # pylint: disable=no-name-in-module,import-error+ from openvino import PartialShape # pylint: disable=no-name-in-module,import-errormodel_inputs = input_model.get_inputs()input_user_data_types_dict = {}input_user_shapes_dict = {}@@ -396,7 +396,7 @@ def convert_params_lists_to_dicts(input_model,# input_user_data_types is list only if unnamed inputs were usedif isinstance(input_user_data_types, list):- from openvino.runtime import Type # pylint: disable=no-name-in-module,import-error+ from openvino import Type # pylint: disable=no-name-in-module,import-errorif input_user_shapes_dict is None:input_user_shapes_dict = {}@@ -404,7 +404,7 @@ def convert_params_lists_to_dicts(input_model,# this cycle adds each unnamed type to dictionary using name from model_inputsfor idx, node_type in enumerate(input_user_data_types):assert isinstance(node_type, (type, np.dtype, Type)), "Got incorrect format of input types. " \- "Expected numpy type or openvino.runtime.Type, " \+ "Expected numpy type or openvino.Type, " \"got {}.".format(type(node_type))inp_name = find_first_unused_input(model_inputs, input_user_data_types_dict, "type")diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.pyindex 68c4406622f..62d85d18d0d 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py@@ -3,7 +3,7 @@from typing import Callable-from openvino.runtime import PartialShape # pylint: disable=no-name-in-module,import-error+from openvino import PartialShape # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.error import Errorfrom openvino.tools.ovc.utils import refer_to_faq_msg@@ -62,7 +62,7 @@ def get_dimension_index_by_label(input_shape: PartialShape, input_names: list, llayout = layout_value.get('source_layout', None)if layout is None:return default_dim, True- from openvino.runtime import Layout # pylint: disable=no-name-in-module,import-error+ from openvino import Layout # pylint: disable=no-name-in-module,import-errorlayout_parsed = Layout(layout)if layout_parsed.has_name(dimension_label):return layout_parsed.get_index_by_name(dimension_label), Falsediff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py b/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.pyindex 9e8e2507dea..b786a59b02a 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py@@ -3,7 +3,7 @@import argparse-from openvino.runtime import Model # pylint: disable=no-name-in-module,import-error+from openvino import Model # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.moc_frontend.preprocessing import apply_preprocessingdiff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/offline_transformations.py b/tools/ovc/openvino/tools/ovc/moc_frontend/offline_transformations.pyindex 9b7ea2bbf35..2e85d44e21f 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/offline_transformations.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/offline_transformations.py@@ -78,7 +78,7 @@ def get_available_transformations():return {}-# net should be openvino.runtime.Model type, but OV Engine is still optional dependency+# net should be openvino.Model type, but OV Engine is still optional dependencydef apply_user_transformations(func: object, transforms: list):available_transformations = get_available_transformations()diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py b/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.pyindex 4a297707a0e..58cc07ed5dc 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py@@ -11,8 +11,8 @@ import osfrom openvino.frontend import FrontEnd, InputModel, NotImplementedFailure, \Place # pylint: disable=no-name-in-module,import-error-from openvino.runtime import PartialShape, Type # pylint: disable=no-name-in-module,import-error-from openvino.runtime.utils.types import get_element_type, \+from openvino import PartialShape, Type # pylint: disable=no-name-in-module,import-error+from openvino.utils.types import get_element_type, \get_numpy_ctype # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.moc_frontend.analysis import json_model_analysis_dumpfrom openvino.tools.ovc.moc_frontend.extractor import fe_user_data_repack, convert_params_lists_to_dicts, \diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py b/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.pyindex 0195960065d..a182cfa7f44 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py@@ -6,7 +6,7 @@ import logging as logfrom openvino.preprocess import PrePostProcessor # pylint: disable=no-name-in-module,import-error# pylint: disable=no-name-in-module,import-error-from openvino.runtime import Model, Layout, PartialShape+from openvino import Model, Layout, PartialShapefrom openvino.tools.ovc.error import Errorfrom openvino.tools.ovc.moc_frontend.layout_utils import update_layout_to_dictfrom openvino.tools.ovc.utils import refer_to_faq_msgdiff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.pyindex 486f72d87fd..830a066562a 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py@@ -8,7 +8,7 @@ import sysimport numpy as np# pylint: disable=no-name-in-module,import-error-from openvino.runtime import Tensor, PartialShape+from openvino import Tensor, PartialShapefrom openvino.tools.ovc.cli_parser import single_input_to_input_cut_info, _InputCutInfofrom openvino.tools.ovc.error import Errordiff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.pyindex 739f0f53b0e..9145fad3b1b 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py@@ -4,7 +4,7 @@import sysimport numpy as np-from openvino.runtime import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-error+from openvino import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.error import Errordiff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.pyindex b7f7c8b0abc..50a3ffdc3e9 100644--- a/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py+++ b/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py@@ -6,7 +6,7 @@ import sysimport numpy as npimport openvino as ov-from openvino.runtime import Type+from openvino import Typedef is_type(val):diff --git a/tools/ovc/openvino/tools/ovc/telemetry_utils.py b/tools/ovc/openvino/tools/ovc/telemetry_utils.pyindex f68a92be5d2..98769357d69 100644--- a/tools/ovc/openvino/tools/ovc/telemetry_utils.py+++ b/tools/ovc/openvino/tools/ovc/telemetry_utils.py@@ -4,7 +4,7 @@import argparseimport numbersimport os-from openvino.runtime import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error+from openvino import get_version as get_rt_version # pylint: disable=no-name-in-module,import-errorfrom openvino.tools.ovc.cli_parser import get_params_with_paths_listfrom openvino.tools.ovc.telemetry_params import telemetry_paramsfrom openvino.tools.ovc.utils import check_values_equal@@ -95,7 +95,7 @@ def send_conversion_result(conversion_result: str, need_shutdown=False):def arg_to_str(arg):# This method converts to string only known types, otherwise returns string with name of the type- from openvino.runtime import PartialShape, Shape, Type, Layout # pylint: disable=no-name-in-module,import-error+ from openvino import PartialShape, Shape, Type, Layout # pylint: disable=no-name-in-module,import-errorif isinstance(arg, (PartialShape, Shape, Type, Layout)):return str(arg)if isinstance(arg, (str, numbers.Number, bool)):diff --git a/tools/ovc/openvino/tools/ovc/version.py b/tools/ovc/openvino/tools/ovc/version.pyindex 34e0128af92..f7509efa7ab 100644--- a/tools/ovc/openvino/tools/ovc/version.py+++ b/tools/ovc/openvino/tools/ovc/version.py@@ -3,7 +3,7 @@import re-from openvino.runtime import get_version as get_ie_version # pylint: disable=no-name-in-module,import-error+from openvino import get_version as get_ie_version # pylint: disable=no-name-in-module,import-errordef extract_release_version(version: str):@@ -29,7 +29,7 @@ def simplify_version(version: str):def get_simplified_ie_version(version=None):- from openvino.runtime import get_version # pylint: disable=no-name-in-module,import-error+ from openvino import get_version # pylint: disable=no-name-in-module,import-errorif version is None:version = get_version()diff --git a/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py b/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.pyindex dc29b439b61..f10b5d32209 100644--- a/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py+++ b/tools/ovc/unit_tests/moc_tf_fe/conversion_basic_models_test.py@@ -4,7 +4,7 @@import numpy as npimport osimport pytest-from openvino.runtime import Core+from openvino import Corefrom openvino.tools.ovc.convert import convert_modeldiff --git a/tools/ovc/unit_tests/moc_tf_fe/utils.py b/tools/ovc/unit_tests/moc_tf_fe/utils.pyindex f68c3ef0559..78fa88d26f5 100644--- a/tools/ovc/unit_tests/moc_tf_fe/utils.py+++ b/tools/ovc/unit_tests/moc_tf_fe/utils.py@@ -5,7 +5,7 @@ import osimport numpy as np-from openvino.runtime import Core+from openvino import Corefrom openvino.tools.ovc.convert import convert_modeldiff --git a/tools/ovc/unit_tests/ovc/convert/import_from_mo_test.py b/tools/ovc/unit_tests/ovc/convert/import_from_mo_test.pyindex 526942ccf71..1b7ddcc675f 100644--- a/tools/ovc/unit_tests/ovc/convert/import_from_mo_test.py+++ b/tools/ovc/unit_tests/ovc/convert/import_from_mo_test.py@@ -3,7 +3,7 @@import osimport tempfile-from openvino.runtime import serialize+from openvino import serializefrom pathlib import Pathfrom unit_tests.ovc.convert.utils import create_onnx_model, save_to_onnxfrom unit_tests.ovc.unit_test_with_mocked_telemetry import UnitTestWithMockedTelemetrydiff --git a/tools/ovc/unit_tests/ovc/convert/meta_data_test.py b/tools/ovc/unit_tests/ovc/convert/meta_data_test.pyindex d28afb507d3..cf10d217523 100644--- a/tools/ovc/unit_tests/ovc/convert/meta_data_test.py+++ b/tools/ovc/unit_tests/ovc/convert/meta_data_test.py@@ -3,8 +3,8 @@import osimport tempfile-from openvino.runtime import get_version as get_rt_version-from openvino.runtime import serialize+from openvino import get_version as get_rt_version+from openvino import serializefrom openvino.tools.ovc import convert_modelfrom pathlib import Pathfrom unit_tests.ovc.unit_test_with_mocked_telemetry import UnitTestWithMockedTelemetrydiff --git a/tools/ovc/unit_tests/ovc/convert/meta_data_test_actual.py b/tools/ovc/unit_tests/ovc/convert/meta_data_test_actual.pyindex 337853942d8..0413b3467c7 100644--- a/tools/ovc/unit_tests/ovc/convert/meta_data_test_actual.py+++ b/tools/ovc/unit_tests/ovc/convert/meta_data_test_actual.py@@ -6,8 +6,8 @@ import tempfileimport unittestfrom pathlib import Path-from openvino.runtime import get_version as get_rt_version-from openvino.runtime import serialize, convert_model+from openvino import get_version as get_rt_version+from openvino import serialize, convert_modelfrom openvino.tools.mo.utils.ir_reader.restore_graph import restore_graph_from_ir, save_restored_graph@@ -74,7 +74,7 @@ class MetaDataTestTF(unittest.TestCase):serialize(ov_model, out_xml.encode('utf-8'), out_xml.replace('.xml', '.bin').encode('utf-8'))- from openvino.runtime import Core+ from openvino import Corecore = Core()deserialized_model = core.read_model(out_xml)self.check_meta_data(deserialized_model, ref_meta)diff --git a/tools/ovc/unit_tests/ovc/utils/cli_parser_test.py b/tools/ovc/unit_tests/ovc/utils/cli_parser_test.pyindex 735acf6544d..9eab60dcdab 100644--- a/tools/ovc/unit_tests/ovc/utils/cli_parser_test.py+++ b/tools/ovc/unit_tests/ovc/utils/cli_parser_test.py@@ -7,8 +7,8 @@ import shutilimport tempfileimport unittest-import openvino.runtime as ov-from openvino.runtime import PartialShape+import openvino as ov+from openvino import PartialShapefrom openvino.tools.ovc.cli_parser import _InputCutInfofrom openvino.tools.ovc.cli_parser import input_to_input_cut_info, \