From 1ee9832e052ef63c8132a37f11cfca0cbc62ff4b Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 9 May 2025 23:16:55 +0300 Subject: [PATCH] NNCF silence the pytorch version warning --- CHANGELOG.md | 2 +- modules/intel/openvino/__init__.py | 5 +++++ modules/model_quant.py | 5 +++++ modules/model_quant_nncf.py | 13 ++++++++----- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf5e328a..1fd5371b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ supports text, image and video prompts with or without input image *note*: if input image is provided, model should be left at default `gemma-3-4b-it` as most other LLMs do not support hybrid workflows - **Fixes** - - ROCm: disable cuDNN, fixes slow MIOpen tuning with `torch==2.7` + - ROCm: disable cuDNN benchmark, fixes slow MIOpen tuning with `torch==2.7` - Extensions: use in-process installer for extensions-builtin, improves startup performance - FramePack: monkey-patch for dynamically installed `av` - Logging: reduce spam while progress is active diff --git a/modules/intel/openvino/__init__.py b/modules/intel/openvino/__init__.py index c89a50dd4..e822c9274 100644 --- a/modules/intel/openvino/__init__.py +++ b/modules/intel/openvino/__init__.py @@ -32,6 +32,11 @@ try: except Exception: pass +try: + # silence the pytorch version warning + nncf.common.logging.logger.warn_bkc_version_mismatch = lambda *args, **kwargs: None +except Exception: + pass # Set default params torch._dynamo.config.cache_size_limit = max(64, torch._dynamo.config.cache_size_limit) # pylint: disable=protected-access diff --git a/modules/model_quant.py b/modules/model_quant.py index 95a106c6f..eef10ff04 100644 --- a/modules/model_quant.py +++ b/modules/model_quant.py @@ -268,6 +268,11 @@ def load_nncf(msg='', silent=False): try: import nncf intel_nncf = nncf + try: + # silence the pytorch version warning + nncf.common.logging.logger.warn_bkc_version_mismatch = lambda *args, **kwargs: None + except Exception: + pass fn = f'{sys._getframe(2).f_code.co_name}:{sys._getframe(1).f_code.co_name}' # pylint: disable=protected-access log.debug(f'Quantization: type=nncf version={nncf.__version__} fn={fn}') # pylint: disable=protected-access return intel_nncf diff --git a/modules/model_quant_nncf.py b/modules/model_quant_nncf.py index 781ca2fdd..2fc41bcf4 100644 --- a/modules/model_quant_nncf.py +++ b/modules/model_quant_nncf.py @@ -392,11 +392,14 @@ def decompress_int4_symmetric(input: torch.Tensor, scale: torch.Tensor, shape: t if shared.opts.nncf_decompress_compile: - torch._dynamo.config.cache_size_limit = max(8192, torch._dynamo.config.cache_size_limit) # pylint: disable=protected-access - decompress_asymmetric = torch.compile(decompress_asymmetric, fullgraph=True) - decompress_symmetric = torch.compile(decompress_symmetric, fullgraph=True) - decompress_int4_asymmetric = torch.compile(decompress_int4_asymmetric, fullgraph=True) - decompress_int4_symmetric = torch.compile(decompress_int4_symmetric, fullgraph=True) + try: + torch._dynamo.config.cache_size_limit = max(8192, torch._dynamo.config.cache_size_limit) # pylint: disable=protected-access + decompress_asymmetric = torch.compile(decompress_asymmetric, fullgraph=True) + decompress_symmetric = torch.compile(decompress_symmetric, fullgraph=True) + decompress_int4_asymmetric = torch.compile(decompress_int4_asymmetric, fullgraph=True) + decompress_int4_symmetric = torch.compile(decompress_int4_symmetric, fullgraph=True) + except Exception as e: + shared.logs.warning(f"Quantization: type=nncf Decompress using torch.compile is not available: {e}") class INT8AsymmetricWeightsDecompressor(torch.nn.Module):