Skip to content

Commit ba45714

Browse files
authored
Enable print properties of compiled model (#1046)
* print properties of compile model * Enable print properties * Remove duplicate logging
1 parent ad8a4cb commit ba45714

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

optimum/intel/openvino/modeling_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ def _compile_model(
279279

280280
compiled_model = core.compile_model(model, device.upper() if device is not None else device, config=ov_config)
281281
if "OPENVINO_LOG_LEVEL" in os.environ and int(os.environ["OPENVINO_LOG_LEVEL"]) > 2:
282-
logger.info(f"{device if device is not None else 'AUTO'} SUPPORTED_PROPERTIES:")
283282
_print_compiled_model_properties(compiled_model)
284283
return compiled_model
285284

@@ -802,7 +801,6 @@ def _compile(self):
802801
self.request = core.compile_model(self.model, self._device, self.ov_config)
803802
# OPENVINO_LOG_LEVEL can be found in https://docs.openvino.ai/2023.2/openvino_docs_OV_UG_supported_plugins_AUTO_debugging.html
804803
if "OPENVINO_LOG_LEVEL" in os.environ and int(os.environ["OPENVINO_LOG_LEVEL"]) > 2:
805-
logger.info(f"{self._device} SUPPORTED_PROPERTIES:")
806804
_print_compiled_model_properties(self.request)
807805

808806
@property

optimum/intel/openvino/modeling_diffusion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,6 @@ def _compile(self):
979979
self.request = core.compile_model(self.model, self._device, self.ov_config)
980980
# OPENVINO_LOG_LEVEL can be found in https://docs.openvino.ai/2023.2/openvino_docs_OV_UG_supported_plugins_AUTO_debugging.html
981981
if "OPENVINO_LOG_LEVEL" in os.environ and int(os.environ["OPENVINO_LOG_LEVEL"]) > 2:
982-
logger.info(f"{self._device} SUPPORTED_PROPERTIES:")
983982
_print_compiled_model_properties(self.request)
984983

985984
def to(self, *args, device: Optional[str] = None, dtype: Optional[torch.dtype] = None):

optimum/intel/openvino/modeling_seq2seq.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ def _compile(self):
550550
self.request = core.compile_model(self.model, self._device, ov_config)
551551
# OPENVINO_LOG_LEVEL can be found in https://docs.openvino.ai/2023.2/openvino_docs_OV_UG_supported_plugins_AUTO_debugging.html
552552
if "OPENVINO_LOG_LEVEL" in os.environ and int(os.environ["OPENVINO_LOG_LEVEL"]) > 2:
553-
logger.info(f"{self._device} SUPPORTED_PROPERTIES:")
554553
_print_compiled_model_properties(self.request)
555554

556555

@@ -691,7 +690,6 @@ def _compile(self):
691690
self.request = compiled_model.create_infer_request()
692691
# OPENVINO_LOG_LEVEL can be found in https://docs.openvino.ai/2023.2/openvino_docs_OV_UG_supported_plugins_AUTO_debugging.html
693692
if "OPENVINO_LOG_LEVEL" in os.environ and int(os.environ["OPENVINO_LOG_LEVEL"]) > 2:
694-
logger.info(f"{self._device} SUPPORTED_PROPERTIES:")
695693
_print_compiled_model_properties(compiled_model)
696694

697695

optimum/intel/openvino/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def _is_timm_ov_dir(model_dir):
200200

201201

202202
def _print_compiled_model_properties(compiled_model):
203+
cur_log_level = logger.getEffectiveLevel()
204+
logger.setLevel(logging.INFO)
203205
supported_properties = properties.supported_properties()
204206
skip_keys = {"SUPPORTED_METRICS", "SUPPORTED_CONFIG_KEYS", supported_properties}
205207
keys = set(compiled_model.get_property(supported_properties)) - skip_keys
@@ -222,6 +224,7 @@ def _print_compiled_model_properties(compiled_model):
222224
logger.info(f" {device}: {Core().get_property(device, 'FULL_DEVICE_NAME')}")
223225
except Exception:
224226
logger.error("[error] Get FULL_DEVICE_NAME failed")
227+
logger.setLevel(cur_log_level)
225228

226229

227230
def np_to_pt_generators(np_object, device):

0 commit comments

Comments
 (0)