From ce8c32dece52ed4650b5ce7f554e7f0520498a63 Mon Sep 17 00:00:00 2001 From: almilosz Date: Wed, 27 Nov 2024 13:44:51 +0000 Subject: [PATCH] Revert changes to tools/ovc/openvino/ Revert changes to tools/ovc/openvino/ beside tools/ovc/openvino/__init__.py --- tools/ovc/openvino/tools/ovc/__init__.py | 2 +- tools/ovc/openvino/tools/ovc/cli_parser.py | 2 +- tools/ovc/openvino/tools/ovc/convert.py | 2 +- tools/ovc/openvino/tools/ovc/convert_impl.py | 4 ++-- tools/ovc/openvino/tools/ovc/main.py | 2 +- tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py | 5 ++--- tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py | 4 ++-- tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py | 4 ++-- tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py | 2 +- tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py | 4 ++-- tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py | 3 +-- .../tools/ovc/moc_frontend/pytorch_frontend_utils.py | 2 +- tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py | 2 +- tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py | 2 +- tools/ovc/openvino/tools/ovc/telemetry_utils.py | 4 ++-- tools/ovc/openvino/tools/ovc/version.py | 4 ++-- 16 files changed, 23 insertions(+), 25 deletions(-) diff --git a/tools/ovc/openvino/tools/ovc/__init__.py b/tools/ovc/openvino/tools/ovc/__init__.py index e16767708a7b52..5b750b58969d24 100644 --- a/tools/ovc/openvino/tools/ovc/__init__.py +++ b/tools/ovc/openvino/tools/ovc/__init__.py @@ -11,7 +11,7 @@ except importlib_metadata.PackageNotFoundError: optimum_version = None -from openvino._pyopenvino import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error +from openvino.runtime import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error telemetry = init_ovc_telemetry('OpenVINO') telemetry.send_event("ov", "import", "general_import") diff --git a/tools/ovc/openvino/tools/ovc/cli_parser.py b/tools/ovc/openvino/tools/ovc/cli_parser.py index e2eb55669ccadf..ab4099a17f7093 100644 --- a/tools/ovc/openvino/tools/ovc/cli_parser.py +++ b/tools/ovc/openvino/tools/ovc/cli_parser.py @@ -10,7 +10,7 @@ from typing import List, Union import openvino -from openvino import PartialShape, Dimension, Type # pylint: disable=no-name-in-module,import-error +from openvino.runtime import PartialShape, Dimension, Type # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error from openvino.tools.ovc.help import get_convert_model_help_specifics from openvino.tools.ovc.moc_frontend.shape_utils import to_partial_shape, is_shape_type diff --git a/tools/ovc/openvino/tools/ovc/convert.py b/tools/ovc/openvino/tools/ovc/convert.py index f76e779fb30232..77693ad4be2ca1 100644 --- a/tools/ovc/openvino/tools/ovc/convert.py +++ b/tools/ovc/openvino/tools/ovc/convert.py @@ -4,7 +4,7 @@ import pathlib from typing import Any -from openvino import Model # pylint: disable=no-name-in-module,import-error +from openvino.runtime import Model # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.cli_parser import get_all_cli_parser from openvino.tools.ovc.convert_impl import _convert from openvino.tools.ovc.logger import get_logger_state, restore_logger_state diff --git a/tools/ovc/openvino/tools/ovc/convert_impl.py b/tools/ovc/openvino/tools/ovc/convert_impl.py index 370e8fe9be4058..aef054f8aafc24 100644 --- a/tools/ovc/openvino/tools/ovc/convert_impl.py +++ b/tools/ovc/openvino/tools/ovc/convert_impl.py @@ -44,8 +44,8 @@ # pylint: disable=no-name-in-module,import-error from openvino.frontend import FrontEndManager, OpConversionFailure, TelemetryExtension -from openvino import get_version as get_rt_version -from openvino import PartialShape +from openvino.runtime import get_version as get_rt_version +from openvino.runtime import PartialShape try: 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.py index 762ecb258f0c11..1118999dcd5a7b 100644 --- a/tools/ovc/openvino/tools/ovc/main.py +++ b/tools/ovc/openvino/tools/ovc/main.py @@ -17,7 +17,7 @@ import_openvino_tokenizers() # pylint: disable=no-name-in-module,import-error -from openvino import save_model +from openvino.runtime import save_model def main(): diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py b/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py index bb542c5c23752c..827a8e4338af96 100644 --- a/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py +++ b/tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py @@ -3,9 +3,8 @@ import json -from openvino import PartialShape, Type -from openvino import Model # pylint: disable=no-name-in-module,import-error -from openvino.utils.types import get_dtype # pylint: disable=no-name-in-module,import-error +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 def 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.py index 539dc83ba92652..3693a54230f9c2 100644 --- a/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py +++ b/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py @@ -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 import PartialShape # pylint: disable=no-name-in-module,import-error + from openvino.runtime import PartialShape # pylint: disable=no-name-in-module,import-error model_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 used if isinstance(input_user_data_types, list): - from openvino import Type # pylint: disable=no-name-in-module,import-error + from openvino.runtime import Type # pylint: disable=no-name-in-module,import-error if input_user_shapes_dict is None: input_user_shapes_dict = {} diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py index 62d85d18d0df81..68c4406622f9b6 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 import PartialShape # pylint: disable=no-name-in-module,import-error +from openvino.runtime import PartialShape # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error from 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, l layout = layout_value.get('source_layout', None) if layout is None: return default_dim, True - from openvino import Layout # pylint: disable=no-name-in-module,import-error + from openvino.runtime import Layout # pylint: disable=no-name-in-module,import-error layout_parsed = Layout(layout) if layout_parsed.has_name(dimension_label): return layout_parsed.get_index_by_name(dimension_label), False diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py b/tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py index b786a59b02a1e8..9e8e2507dea1a3 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 import Model # pylint: disable=no-name-in-module,import-error +from openvino.runtime import Model # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.moc_frontend.preprocessing import apply_preprocessing diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py b/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py index 58cc07ed5dc319..4a297707a0e537 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 @@ from openvino.frontend import FrontEnd, InputModel, NotImplementedFailure, \ Place # pylint: disable=no-name-in-module,import-error -from openvino import PartialShape, Type # pylint: disable=no-name-in-module,import-error -from openvino.utils.types import get_element_type, \ +from openvino.runtime import PartialShape, Type # pylint: disable=no-name-in-module,import-error +from openvino.runtime.utils.types import get_element_type, \ get_numpy_ctype # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.moc_frontend.analysis import json_model_analysis_dump from 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.py index 570be66a7bc6c1..0195960065d88e 100644 --- a/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py +++ b/tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py @@ -6,8 +6,7 @@ from openvino.preprocess import PrePostProcessor # pylint: disable=no-name-in-module,import-error # pylint: disable=no-name-in-module,import-error -from openvino import Model -from openvino import Layout, PartialShape +from openvino.runtime import Model, Layout, PartialShape from openvino.tools.ovc.error import Error from openvino.tools.ovc.moc_frontend.layout_utils import update_layout_to_dict from openvino.tools.ovc.utils import refer_to_faq_msg diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py index 830a066562a6e0..486f72d87fd89d 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 numpy as np # pylint: disable=no-name-in-module,import-error -from openvino import Tensor, PartialShape +from openvino.runtime import Tensor, PartialShape from openvino.tools.ovc.cli_parser import single_input_to_input_cut_info, _InputCutInfo from openvino.tools.ovc.error import Error diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py index 9145fad3b1bb06..739f0f53b0ef16 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 sys import numpy as np -from openvino import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-error +from openvino.runtime import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error diff --git a/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py b/tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py index 50a3ffdc3e9fce..b7f7c8b0abc1ce 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 numpy as np import openvino as ov -from openvino import Type +from openvino.runtime import Type def is_type(val): diff --git a/tools/ovc/openvino/tools/ovc/telemetry_utils.py b/tools/ovc/openvino/tools/ovc/telemetry_utils.py index 5167f258e5eca1..412d9b9607541e 100644 --- a/tools/ovc/openvino/tools/ovc/telemetry_utils.py +++ b/tools/ovc/openvino/tools/ovc/telemetry_utils.py @@ -4,7 +4,7 @@ import argparse import numbers import os -from openvino import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error +from openvino.runtime import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.cli_parser import get_params_with_paths_list from openvino.tools.ovc.telemetry_params import telemetry_params from openvino.tools.ovc.utils import check_values_equal @@ -89,7 +89,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 import PartialShape, Shape, Type, Layout # pylint: disable=no-name-in-module,import-error + from openvino.runtime import PartialShape, Shape, Type, Layout # pylint: disable=no-name-in-module,import-error if 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.py index f7509efa7ab4c5..34e0128af929da 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 import get_version as get_ie_version # pylint: disable=no-name-in-module,import-error +from openvino.runtime import get_version as get_ie_version # pylint: disable=no-name-in-module,import-error def extract_release_version(version: str): @@ -29,7 +29,7 @@ def simplify_version(version: str): def get_simplified_ie_version(version=None): - from openvino import get_version # pylint: disable=no-name-in-module,import-error + from openvino.runtime import get_version # pylint: disable=no-name-in-module,import-error if version is None: version = get_version()