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
Fixed OVC logger. (#27837)
Anastasiia Pnevskaiaca670b86c890
diff --git a/tools/ovc/openvino/tools/ovc/convert.py b/tools/ovc/openvino/tools/ovc/convert.pyindex 77693ad4be2..1bd61ff567e 100644--- a/tools/ovc/openvino/tools/ovc/convert.py+++ b/tools/ovc/openvino/tools/ovc/convert.py@@ -85,7 +85,11 @@ def convert_model(list of paths, objects derived from BaseExtension class or lists ofobjects.:param verbose:- Print detailed information about conversion.+ Print detailed information about conversion. The detailed information is logged via standard logging library.+ The log level can be changed by setting the log level using logging library.+ Example:+ import logging+ logging.getLogger().setLevel(logging.DEBUG):param share_weights:Reuse weights allocated in the original model. If input model is in file,then mmap is used to allocate weights directly from file. If input model isdiff --git a/tools/ovc/openvino/tools/ovc/convert_impl.py b/tools/ovc/openvino/tools/ovc/convert_impl.pyindex aef054f8aaf..152ff03c28e 100644--- a/tools/ovc/openvino/tools/ovc/convert_impl.py+++ b/tools/ovc/openvino/tools/ovc/convert_impl.py@@ -243,8 +243,6 @@ def check_model_object(argv):def driver(argv: argparse.Namespace, non_default_params: dict):- init_logger('ERROR', argv.verbose)-# Log dictionary with non-default cli parameters where complex classes are excluded.log.debug(str(non_default_params))@@ -433,7 +431,11 @@ def _convert(cli_parser: argparse.ArgumentParser, args, python_api_used):telemetry.send_event('ovc', 'version', simplified_ie_version)# Initialize logger with 'ERROR' as default level to be able to form nice messages# before arg parser deliver log_level requested by user- init_logger('ERROR', False)+ verbose = False+ if "verbose" in args and args["verbose"] or "--verbose" in sys.argv:+ verbose = True++ init_logger('ERROR', verbose, python_api_used)argv = None# Minimize modifications among other places in case if multiple pieces are passed as input_modelif python_api_used:diff --git a/tools/ovc/openvino/tools/ovc/help.py b/tools/ovc/openvino/tools/ovc/help.pyindex e09102be394..4f312ef20be 100644--- a/tools/ovc/openvino/tools/ovc/help.py+++ b/tools/ovc/openvino/tools/ovc/help.py@@ -43,4 +43,6 @@ def get_convert_model_help_specifics():{'action': 'version',# FIXME: Why the following is not accessible from arg parser?'version': 'OpenVINO Model Converter (ovc) {}'.format(VersionChecker().get_ie_version())},+ 'verbose':+ {'description': 'Print detailed information about conversion.'}}diff --git a/tools/ovc/openvino/tools/ovc/logger.py b/tools/ovc/openvino/tools/ovc/logger.pyindex f3c24a8582d..46bd043cf20 100644--- a/tools/ovc/openvino/tools/ovc/logger.py+++ b/tools/ovc/openvino/tools/ovc/logger.py@@ -62,7 +62,10 @@ class TagFilter(log.Filter):return True # if regex wasn't set print all logs-def init_logger(lvl: str, verbose: bool):+def init_logger(lvl: str, verbose: bool, python_api_used: bool):+ if verbose and python_api_used:+ # We need to not override logger in case of verbose=True to allow user set a log level+ returnglobal handler_numlog_exp = os.environ.get('MO_LOG_PATTERN')if not verbose: