From 944408e93b1cda1266fda6c2f1aeca9b4c30ee75 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 10 Dec 2024 10:39:13 -0500 Subject: [PATCH] warn on quanto with offload Signed-off-by: Vladimir Mandic --- modules/model_quant.py | 7 +++++-- modules/shared.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/model_quant.py b/modules/model_quant.py index 9482fe898..03043b33a 100644 --- a/modules/model_quant.py +++ b/modules/model_quant.py @@ -58,11 +58,11 @@ def load_torchao(msg='', silent=False): import torchao ao = torchao 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=quanto version={ao.__version__} fn={fn}') # pylint: disable=protected-access + log.debug(f'Quantization: type=torchao version={ao.__version__} fn={fn}') # pylint: disable=protected-access return ao except Exception as e: if len(msg) > 0: - log.error(f"{msg} failed to import optimum.quanto: {e}") + log.error(f"{msg} failed to import torchao: {e}") ao = None if not silent: raise @@ -92,6 +92,7 @@ def load_bnb(msg='', silent=False): def load_quanto(msg='', silent=False): + from modules import shared global quanto # pylint: disable=global-statement if quanto is not None: return quanto @@ -101,6 +102,8 @@ def load_quanto(msg='', silent=False): quanto = optimum_quanto 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=quanto version={quanto.__version__} fn={fn}') # pylint: disable=protected-access + if shared.opts.diffusers_offload_mode != 'none': + shared.log.error(f'Quantization: type=quanto offload={shared.opts.diffusers_offload_mode} not supported') return quanto except Exception as e: if len(msg) > 0: diff --git a/modules/shared.py b/modules/shared.py index 3d7571029..17db4595f 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -549,7 +549,7 @@ options_templates.update(options_section(('backends', "Backend Settings"), { "diffusers_fuse_projections": OptionInfo(False, "Fused projections"), "torch_expandable_segments": OptionInfo(False, "Expandable segments"), "cuda_mem_fraction": OptionInfo(0.0, "Memory limit", gr.Slider, {"minimum": 0, "maximum": 2.0, "step": 0.05}), - "torch_gc_threshold": OptionInfo(80, "GC threshold", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}), + "torch_gc_threshold": OptionInfo(70, "GC threshold", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}), "inference_mode": OptionInfo("no-grad", "Inference mode", gr.Radio, {"choices": ["no-grad", "inference-mode", "none"]}), "torch_malloc": OptionInfo("native", "Memory allocator", gr.Radio, {"choices": ['native', 'cudaMallocAsync'] }), @@ -566,7 +566,7 @@ options_templates.update(options_section(('backends', "Backend Settings"), { "olive_cache_optimized": OptionInfo(True, 'Olive cache optimized models'), "ipex_sep": OptionInfo("

IPEX

", "", gr.HTML, {"visible": devices.backend == "ipex"}), - "ipex_optimize": OptionInfo([], "IPEX Optimize for Intel GPUs", gr.CheckboxGroup, {"choices": ["Model", "VAE", "Text Encoder", "Upscaler"], "visible": devices.backend == "ipex"}), + "ipex_optimize": OptionInfo([], "IPEX Optimize", gr.CheckboxGroup, {"choices": ["Model", "VAE", "Text Encoder", "Upscaler"], "visible": devices.backend == "ipex"}), "openvino_sep": OptionInfo("

OpenVINO

", "", gr.HTML, {"visible": cmd_opts.use_openvino}), "openvino_devices": OptionInfo([], "OpenVINO devices to use", gr.CheckboxGroup, {"choices": get_openvino_device_list() if cmd_opts.use_openvino else [], "visible": cmd_opts.use_openvino}), # pylint: disable=E0606