Additional telemetry events in MO. (#5662)

* Added additional telemetry events.

* Separated sending tf1 and tf2.

* Small correction.

* Unit test fix.

* Added op_names_statistic field in graph. Added op names saving in loop ext, while ext.

* Optimize imports.

* Added debug print.

* Added comments, removed debug print.

* Added comment.

* Renamed dynamic shapes event label to partially defined, added unit tests.

* Added attribute checks, moved telemetry methods to separate file.

* Small corrections.

* Updated BOM file.
This commit is contained in:
Anastasia Popova authored and GitHub committed 2021-05-24 15:21:29 +03:00
1 parent 25999222b4
commit 04de4e34bc
19 files changed
+247 -14

No files matched your search

@@ -47,6 +47,8 @@ class LoopExtractor(FrontExtractorOp):
# create an NX node
id = body_graph.unique_id(node_id(pb_node))
body_graph.add_node(id, pb=pb_node, kind='op')
if hasattr(body_graph, 'op_names_statistic') and hasattr(pb_node, 'op_type'):
body_graph.op_names_statistic[pb_node.op_type] += 1
# add incoming edges based on data_nodes_map
for dst_port, inp in enumerate(pb_node.input):
@@ -35,6 +35,8 @@ def update_body_graph(body_graph: Graph, subgraph_proto: dict,
id = body_graph.unique_id(pb_node.name)
map_original_name[pb_node.name] = id
body_graph.add_node(id, pb=pb_node, kind='op')
if hasattr(body_graph, 'op_names_statistic') and hasattr(pb_node, 'op'):
body_graph.op_names_statistic[pb_node.op] += 1
# add incoming edges based on data_nodes_map
for dst_port, inp in enumerate(pb_node.input):
@@ -8,6 +8,7 @@ from mo.front.common.register_custom_ops import update_extractors_with_extension
from mo.front.extractor import extract_node_attrs
from mo.graph.graph import Graph
from mo.utils.error import Error
from mo.utils.telemetry_utils import send_op_names_info, send_shapes_info
from mo.utils.utils import refer_to_faq_msg
@@ -49,3 +50,5 @@ class CaffeLoader(Loader):
argv.enable_flattening_nested_params if hasattr(argv, 'enable_flattening_nested_params') else False
)
extract_node_attrs(graph, lambda node: caffe_extractor(node, check_for_duplicates(caffe_type_extractors)))
send_op_names_info('caffe', graph)
send_shapes_info('caffe', graph)
@@ -8,6 +8,7 @@ from mo.front.kaldi.extractor import kaldi_extractor, kaldi_type_extractors
from mo.front.kaldi.loader.loader import load_kaldi_model
from mo.graph.graph import Graph
from mo.utils.error import Error
from mo.utils.telemetry_utils import send_shapes_info, send_op_names_info
from mo.utils.utils import refer_to_faq_msg
@@ -27,3 +28,6 @@ class KaldiLoader(Loader):
update_extractors_with_extensions(kaldi_type_extractors)
extract_node_attrs(graph, lambda node: kaldi_extractor(node))
send_op_names_info('kaldi', graph)
send_shapes_info('kaldi', graph)
@@ -17,6 +17,7 @@ from mo.front.mxnet.extractor import mxnet_op_extractors, mxnet_op_extractor
from mo.front.mxnet.loader import symbol2nx, load_symbol_def
from mo.front.mxnet.nd_to_params import save_params_file
from mo.graph.graph import Graph
from mo.utils.telemetry_utils import send_shapes_info, send_op_names_info
class MxNetLoader(Loader):
@@ -51,3 +52,5 @@ class MxNetLoader(Loader):
graph.graph['feature_dim'] = 1 if graph.graph['layout'] == 'NCHW' else 3
extract_node_attrs(graph, mxnet_op_extractor)
send_op_names_info('mxnet', graph)
send_shapes_info('mxnet', graph)
@@ -15,6 +15,7 @@ from mo.front.onnx.extractor import onnx_op_extractor, onnx_op_extractors
from mo.front.onnx.loader import load_onnx_model, protobuf2nx
from mo.graph.graph import Graph
from mo.utils.error import Error
from mo.utils.telemetry_utils import send_shapes_info, send_op_names_info
from mo.utils.utils import refer_to_faq_msg
@@ -59,3 +60,5 @@ class ONNXLoader(Loader):
graph.check_empty_graph('protobuf2nx. It may happen due to problems with loaded model')
extract_node_attrs(graph, lambda node: onnx_op_extractor(node, check_for_duplicates(onnx_op_extractors)))
send_op_names_info('onnx', graph)
send_shapes_info('onnx', graph)
+5 -1
View File
@@ -25,6 +25,7 @@ from mo.front.tf.loader import load_tf_graph_def, protobuf2nx
from mo.graph.graph import Graph
from mo.utils import tensorboard_util
from mo.utils.error import Error
from mo.utils.telemetry_utils import send_op_names_info, send_shapes_info, send_framework_info
from mo.utils.utils import refer_to_faq_msg
@@ -40,13 +41,14 @@ class TFLoader(Loader):
log.info('Loading library "{}" with custom operations'.format(library))
tf_v1.load_op_library(library)
graph_def, variables_values = load_tf_graph_def(graph_file_name=argv.input_model,
graph_def, variables_values, framework = load_tf_graph_def(graph_file_name=argv.input_model,
is_binary=not argv.input_model_is_text,
checkpoint=argv.input_checkpoint,
user_output_node_names_list=argv.output,
model_dir=argv.saved_model_dir,
meta_graph_file=argv.input_meta_graph,
saved_model_tags=argv.saved_model_tags)
send_framework_info(framework)
try:
tf_v1.import_graph_def(graph_def, name='')
@@ -98,3 +100,5 @@ class TFLoader(Loader):
graph.check_empty_graph('protobuf2nx. It may happen due to problems with loaded model')
extract_node_attrs(graph, lambda node: tf_op_extractor(node, check_for_duplicates(tf_op_extractors)))
send_op_names_info(framework, graph)
send_shapes_info(framework, graph)