From 8fadd5c29d7d4a5217e66f170f8f8041897b438e Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Wed, 19 Mar 2025 11:20:20 +0100 Subject: [PATCH 1/3] Use openvino instead of cpu_info to get CPU full name --- nncf/{common/utils => openvino}/cpu_info.py | 5 +++-- nncf/openvino/optimized_functions/models.py | 2 +- pyproject.toml | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) rename nncf/{common/utils => openvino}/cpu_info.py (80%) diff --git a/nncf/common/utils/cpu_info.py b/nncf/openvino/cpu_info.py similarity index 80% rename from nncf/common/utils/cpu_info.py rename to nncf/openvino/cpu_info.py index c0f8f1c973e..7040ce8d654 100644 --- a/nncf/common/utils/cpu_info.py +++ b/nncf/openvino/cpu_info.py @@ -11,7 +11,7 @@ import re -import cpuinfo # type: ignore +import openvino as ov _IS_LNL_CPU = None @@ -19,5 +19,6 @@ def is_lnl_cpu() -> bool: global _IS_LNL_CPU if _IS_LNL_CPU is None: - _IS_LNL_CPU = re.search(r"Ultra \d 2\d{2}", cpuinfo.get_cpu_info()["brand_raw"]) is not None + cpu_name = ov.Core().get_property("CPU", ov.properties.device.full_name) + _IS_LNL_CPU = re.search(r"Ultra \d 2\d{2}", cpu_name) is not None return _IS_LNL_CPU diff --git a/nncf/openvino/optimized_functions/models.py b/nncf/openvino/optimized_functions/models.py index 7e0588117ca..6036dd8a438 100644 --- a/nncf/openvino/optimized_functions/models.py +++ b/nncf/openvino/optimized_functions/models.py @@ -25,8 +25,8 @@ from nncf.common.utils.backend import is_openvino_at_least from nncf.common.utils.caching import ResultsCache from nncf.common.utils.caching import cache_results -from nncf.common.utils.cpu_info import is_lnl_cpu from nncf.common.utils.helpers import set_env_variable +from nncf.openvino.cpu_info import is_lnl_cpu from nncf.openvino.graph.node_utils import convert_op from nncf.openvino.graph.node_utils import non_convertable_divide_op from nncf.quantization.algorithms.weight_compression.config import WeightCompressionConfig diff --git a/pyproject.toml b/pyproject.toml index 38982653a0b..8b5d36238fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ dependencies = [ "packaging>=20.0", "pandas>=1.1.5,<2.3", "psutil", - "py-cpuinfo>=9.0.0", "pydot>=1.4.1, <=3.0.4", "pymoo>=0.6.0.1", "rich>=13.5.2", From 00ea2ffcb7f187cf0fc774411c2c01665d6bd929 Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Wed, 19 Mar 2025 13:16:28 +0100 Subject: [PATCH 2/3] Add docstring --- nncf/openvino/cpu_info.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nncf/openvino/cpu_info.py b/nncf/openvino/cpu_info.py index 7040ce8d654..f8a0239c681 100644 --- a/nncf/openvino/cpu_info.py +++ b/nncf/openvino/cpu_info.py @@ -17,6 +17,10 @@ def is_lnl_cpu() -> bool: + """ + Checks whether current CPU is an Intel Lunar Lake generation or not. + :return: True if current CPU is an Intel Lunar Lake generation, False othwerwise. + """ global _IS_LNL_CPU if _IS_LNL_CPU is None: cpu_name = ov.Core().get_property("CPU", ov.properties.device.full_name) From 9570084ad0f1dd7fd61e05f62290924aa317542b Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Wed, 19 Mar 2025 14:14:32 +0100 Subject: [PATCH 3/3] Fix typo --- nncf/openvino/cpu_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nncf/openvino/cpu_info.py b/nncf/openvino/cpu_info.py index f8a0239c681..8f1150dfc15 100644 --- a/nncf/openvino/cpu_info.py +++ b/nncf/openvino/cpu_info.py @@ -19,7 +19,7 @@ def is_lnl_cpu() -> bool: """ Checks whether current CPU is an Intel Lunar Lake generation or not. - :return: True if current CPU is an Intel Lunar Lake generation, False othwerwise. + :return: True if current CPU is an Intel Lunar Lake generation, False otherwise. """ global _IS_LNL_CPU if _IS_LNL_CPU is None: