mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
NNCF silence the pytorch version warning
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user