Skip to content

Commit

Permalink
Add try for get_property (#510)
Browse files Browse the repository at this point in the history
* Add try for get_property

* refine code

---------

Co-authored-by: fishbell <[email protected]>
  • Loading branch information
wgzintel and WeldonWangwang authored Jan 12, 2024
1 parent 23f4f5d commit 3f7551e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions optimum/intel/openvino/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ def _print_compiled_model_properties(compiled_model):
skip_keys = {"SUPPORTED_METRICS", "SUPPORTED_CONFIG_KEYS", supported_properties}
keys = set(compiled_model.get_property(supported_properties)) - skip_keys
for k in keys:
value = compiled_model.get_property(k)
if k == properties.device.properties():
for device_key in value.keys():
logger.info(f" {device_key}:")
for k2, value2 in value.get(device_key).items():
if k2 not in skip_keys:
logger.info(f" {k2}: {value2}")
else:
logger.info(f" {k}: {value}")
try:
value = compiled_model.get_property(k)
if k == properties.device.properties():
for device_key in value.keys():
logger.info(f" {device_key}:")
for k2, value2 in value.get(device_key).items():
if k2 not in skip_keys:
logger.info(f" {k2}: {value2}")
else:
logger.info(f" {k}: {value}")
except Exception:
logger.error(f"[error] Get property of '{k}' failed")

0 comments on commit 3f7551e

Please sign in to comment.