From b961e80607cf8ac5ee392e4868b54d70cf76265e Mon Sep 17 00:00:00 2001 From: lvyufeng Date: Thu, 4 Mar 2021 12:44:58 +0800 Subject: [PATCH] Check protobuf's backend in user environment --- .../mindconverter/graph_based_converter/framework.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mindinsight/mindconverter/graph_based_converter/framework.py b/mindinsight/mindconverter/graph_based_converter/framework.py index 7a0d9961..a05b0eb7 100644 --- a/mindinsight/mindconverter/graph_based_converter/framework.py +++ b/mindinsight/mindconverter/graph_based_converter/framework.py @@ -35,6 +35,8 @@ from mindinsight.mindconverter.common.exceptions import GraphInitError, TreeCrea BadParamError from mindinsight.mindconverter.graph_based_converter.third_party_graph import GraphFactory +from google.protobuf.internal import api_implementation + check_common_dependency_integrity = partial(check_dependency_integrity, "onnx", "onnxruntime", "onnxoptimizer") @@ -262,6 +264,11 @@ def main_graph_base_converter(file_config): Args: file_config (dict): The config of file which to convert. """ + if api_implementation.Type() != 'cpp' \ + or os.getenv('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION') != 'cpp': + log_console.warning("Protobuf is currently implemented in \"Python\". \ + The conversion process may take a long time. \ + Please use the \"C++\" backend version") graph_path = file_config['model_file'] frame_type = get_framework_type(graph_path) if not file_config.get("shape"):