Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made MO deprecation message more explicit, PyLint errors fixed. #25211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/mo/openvino/tools/mo/convert_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ def _convert(cli_parser: argparse.ArgumentParser, framework, args, python_api_us
if 'help' in args and args['help']:
show_mo_convert_help()
return None, None
ovc_message = get_ovc_message()
if ovc_message is not None:
print(ovc_message)
simplified_mo_version = VersionChecker().get_mo_simplified_version()
telemetry = init_mo_telemetry()
telemetry.start_session('mo')
Expand Down Expand Up @@ -908,14 +911,11 @@ def _convert(cli_parser: argparse.ArgumentParser, framework, args, python_api_us

ov_update_message = get_ov_update_message()
ov_api20_message = get_ov_api20_message()
ovc_message = get_ovc_message()
_, is_caffe, is_mxnet, is_kaldi, _ = deduce_legacy_frontend_by_namespace(argv)
if ov_update_message is not None:
print(ov_update_message)
if ov_api20_message is not None and ov_model is not None:
print(ov_api20_message)
if ovc_message is not None and not is_caffe and not is_mxnet and not is_kaldi:
print(ovc_message)
is_fallback = getattr(argv, 'is_fallback', False)
if not argv.use_legacy_frontend and framework_is_tf(args, argv) and not is_fallback:
# now TF FE is default frontend for TensorFlow models conversion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def extract(cls, node):
'visualize_threshold': visualize_threshold,
'save_file': param.save_file,
# nms_param
'nms_threshold': nms_threshold,
'top_k': top_k,
'eta': eta,
'nms_threshold': nms_threshold, # pylint: disable=possibly-used-before-assignment
'top_k': top_k, # pylint: disable=possibly-used-before-assignment
'eta': eta, # pylint: disable=possibly-used-before-assignment
# save_output_param
'output_directory': param.save_output_param.output_directory,
'output_name_prefix': param.save_output_param.output_name_prefix,
Expand All @@ -111,7 +111,7 @@ def extract(cls, node):
'width': param.save_output_param.resize_param.width,
'height_scale': param.save_output_param.resize_param.height_scale,
'width_scale': param.save_output_param.resize_param.width_scale,
'pad_mode': pad_mode,
'pad_mode': pad_mode, # pylint: disable=possibly-used-before-assignment
'pad_value': ','.join(str(x) for x in param.save_output_param.resize_param.pad_value),
'interp_mode': interp_mode,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def extract(cls, node: Node) -> bool:
'kernel_spatial_idx': [2, 3],
'group': 1,
'reshape_kernel': True,
'appended_conv': appended_conv
'appended_conv': appended_conv # pylint: disable=possibly-used-before-assignment
}

mapping_rule.update(layout_attrs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def replace_op(self, graph: Graph, node: Node):
if node['use_dropout']:
mul_dropout_i = Mul(graph, {'name': split_node.soft_get('name', split_node.id) + '/mul_i'}).create_node()
mul_dropout_i.in_port(0).connect(i_sigmoid.out_port(0))
mul_dropout_i.in_port(1).connect(i_drop_scale)
mul_dropout_i.in_port(1).connect(i_drop_scale) # pylint: disable=possibly-used-before-assignment
i_sigmoid = mul_dropout_i

# f_t = Sigmoid(f_part + w_fc*ct_1)
Expand All @@ -91,7 +91,7 @@ def replace_op(self, graph: Graph, node: Node):
if node['use_dropout']:
mul_dropout_f = Mul(graph, {'name': split_node.soft_get('name', split_node.id) + '/mul_f'}).create_node()
mul_dropout_f.in_port(0).connect(f_sigmoid.out_port(0))
mul_dropout_f.in_port(1).connect(f_drop_scale)
mul_dropout_f.in_port(1).connect(f_drop_scale) # pylint: disable=possibly-used-before-assignment
f_sigmoid = mul_dropout_f

# c_t = f_t*ct_1 + i_t * tanh(c_part)
Expand Down Expand Up @@ -127,7 +127,7 @@ def replace_op(self, graph: Graph, node: Node):
if node['use_dropout']:
mul_dropout_o = Mul(graph, {'name': split_node.soft_get('name', split_node.id) + '/mul_o'}).create_node()
mul_dropout_o.in_port(0).connect(o_sigmoid.out_port(0))
mul_dropout_o.in_port(1).connect(o_drop_scale)
mul_dropout_o.in_port(1).connect(o_drop_scale) # pylint: disable=possibly-used-before-assignment
o_sigmoid = mul_dropout_o

# m_t = o_t * Tanh(c_t)
Expand Down
4 changes: 2 additions & 2 deletions tools/mo/openvino/tools/mo/middle/MXNetSplitMultiLayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def split_multilayer_cell(self, graph: Graph, match: dict):
).create_node_with_data()

if have_hidden:
layer_hidden_state = hidden_state_value[l * direction: l * direction + direction]
layer_hidden_state = hidden_state_value[l * direction: l * direction + direction] # pylint: disable=possibly-used-before-assignment
hidden_state_value_node = Const(
rnn_layer.graph,
dict(name=name + '/LayerSplittedHiddenState/{}/'.format(l), value=layer_hidden_state)
Expand All @@ -115,7 +115,7 @@ def split_multilayer_cell(self, graph: Graph, match: dict):
hidden_state_value_node = None

if have_cell:
layer_cell_state = cell_state_value[l * direction: l * direction + direction]
layer_cell_state = cell_state_value[l * direction: l * direction + direction] # pylint: disable=possibly-used-before-assignment
cell_state_value_node = Const(
rnn_layer.graph,
dict(name=name + '/LayerSplittedCellState/{}/'.format(l), value=layer_cell_state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def normalize_strided_slice(graph: Graph, node: Node):
if num_insertions > 0:
# insert blank values for ellipsis unrolling and extending
for mask_name in StridedSlice.get_mask_names():
node[mask_name] = np.insert(node[mask_name], insertion_start_idx, [0] * num_insertions).astype(int)
node[mask_name] = np.insert(node[mask_name], insertion_start_idx, [0] * num_insertions).astype(int) # pylint: disable=possibly-used-before-assignment

@staticmethod
def unroll_ellipsis_for_inputs(graph: Graph, node: Node, ellipsis_start: int, num_insertions: int):
Expand Down
2 changes: 1 addition & 1 deletion tools/mo/openvino/tools/mo/ops/one_hot.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def infer(node: Node):
hot_idx = *idx, indices[idx]

if -depth <= indices[idx] < depth:
onehot_value[hot_idx] = on_value
onehot_value[hot_idx] = on_value # pylint: disable=possibly-used-before-assignment

node.out_port(0).data.set_value(onehot_value)

Expand Down
5 changes: 3 additions & 2 deletions tools/mo/openvino/tools/mo/utils/get_ov_update_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def get_try_legacy_fe_message():

def get_ovc_message():
link = "https://docs.openvino.ai/2023.2/openvino_docs_OV_Converter_UG_prepare_model_convert_model_MO_OVC_transition.html"
message = '[ INFO ] MO command line tool is considered as the legacy conversion API as of OpenVINO 2023.2 release. ' \
'Please use OpenVINO Model Converter (OVC). ' \
message = '[ INFO ] MO command line tool is considered as the legacy conversion API as of OpenVINO 2023.2 release.\n' \
'In 2025.0 MO command line tool and openvino.tools.mo.convert_model() will be removed. ' \
'Please use OpenVINO Model Converter (OVC) or openvino.convert_model(). ' \
'OVC represents a lightweight alternative of MO and provides simplified model conversion API. \n' \
'Find more information about transition from MO to OVC at {}'.format(link)

Expand Down
2 changes: 1 addition & 1 deletion tools/mo/openvino/tools/mo/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if importlib.util.find_spec('absl') is not None:
import absl.logging

log.root.removeHandler(absl.logging._absl_handler)
log.root.removeHandler(absl.logging._absl_handler) # pylint: disable=c-extension-no-member

handler_num = 0

Expand Down
Loading