From f02cfeaef93a721bc7a1f3802f4d4073837e2e32 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 27 Jul 2025 23:06:41 +0300 Subject: [PATCH] Rename SDNQ TE dtype default to Same as model --- CHANGELOG.md | 2 ++ modules/model_quant.py | 4 ++-- modules/shared.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b357a1671..576df7827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -124,6 +124,7 @@ For details, see [ChangeLog](https://github.com/vladmandic/automatic/blob/master - **SDNQ** - use inference context during quantization - use static compile + - rename quantization type for text encoders `default` option to `Same as model` - **API** - add `/sdapi/v1/lock-checkpoint` endpoint that can be used to lock/unlock model changes if model is locked, it cannot be changed using normal load or unload methods @@ -160,6 +161,7 @@ For details, see [ChangeLog](https://github.com/vladmandic/automatic/blob/master - lock directml torch to `torch-directml==0.2.4.dev240913` - lock directml transformers to `transformers==4.52.4` - improve install of `sentencepiece` tokenizer + - add int8 matmul fallback for ipex with onednn qlinear - **Refactoring** *note*: none of the removals result in loss-of-functionality since all those features are already re-implemented goal here is to remove legacy code, code duplication and reduce code complexity diff --git a/modules/model_quant.py b/modules/model_quant.py index 6ee5dfed1..c99ca8945 100644 --- a/modules/model_quant.py +++ b/modules/model_quant.py @@ -111,7 +111,7 @@ def create_sdnq_config(kwargs = None, allow: bool = True, module: str = 'Model', transformers.quantizers.auto.AUTO_QUANTIZATION_CONFIG_MAPPING["sdnq"] = SDNQConfig if weights_dtype is None: - if module in {"TE", "LLM"} and shared.opts.sdnq_quantize_weights_mode_te not in {"same as model", "default"}: + if module in {"TE", "LLM"} and shared.opts.sdnq_quantize_weights_mode_te not in {"Same as model", "default"}: weights_dtype = shared.opts.sdnq_quantize_weights_mode_te else: weights_dtype = shared.opts.sdnq_quantize_weights_mode @@ -377,7 +377,7 @@ def sdnq_quantize_model(model, op=None, sd_model=None, do_gc: bool = True, weigh from modules.sdnq import apply_sdnq_to_module if weights_dtype is None: - if op is not None and ("text_encoder" in op or op in {"TE", "LLM"}) and shared.opts.sdnq_quantize_weights_mode_te not in {"same as model", "default"}: + if op is not None and ("text_encoder" in op or op in {"TE", "LLM"}) and shared.opts.sdnq_quantize_weights_mode_te not in {"Same as model", "default"}: weights_dtype = shared.opts.sdnq_quantize_weights_mode_te else: weights_dtype = shared.opts.sdnq_quantize_weights_mode diff --git a/modules/shared.py b/modules/shared.py index 0996277f7..441ea9a4e 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -289,7 +289,7 @@ options_templates.update(options_section(("quantization", "Quantization Settings "sdnq_quantize_weights": OptionInfo([], "Quantization enabled", gr.CheckboxGroup, {"choices": ["Model", "TE", "LLM", "Control", "VAE"]}), "sdnq_quantize_mode": OptionInfo("auto", "Quantization mode", gr.Dropdown, {"choices": ["auto", "pre", "post"]}), "sdnq_quantize_weights_mode": OptionInfo("int8", "Quantization type", gr.Dropdown, {"choices": sdnq_quant_modes}), - "sdnq_quantize_weights_mode_te": OptionInfo("default", "Quantization type for Text Encoders", gr.Dropdown, {"choices": ['default'] + sdnq_quant_modes}), + "sdnq_quantize_weights_mode_te": OptionInfo("Same as model", "Quantization type for Text Encoders", gr.Dropdown, {"choices": ['Same as model'] + sdnq_quant_modes}), "sdnq_quantize_weights_group_size": OptionInfo(0, "Group size", gr.Slider, {"minimum": -1, "maximum": 4096, "step": 1}), "sdnq_quantize_conv_layers": OptionInfo(False, "Quantize convolutional layers", gr.Checkbox), "sdnq_dequantize_compile": OptionInfo(devices.has_triton(), "Dequantize using torch.compile", gr.Checkbox),