From b0e5a6c4df2c4ae293e480d77a9aaa9dd5953a98 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 9 May 2025 22:24:36 +0300 Subject: [PATCH] Add devices.has_triton() and enable NNCF compile if triton is available --- modules/devices.py | 8 ++++++++ modules/shared.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/devices.py b/modules/devices.py index 0c5fb1552..0863985e6 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -58,6 +58,14 @@ def has_zluda() -> bool: return False +def has_triton() -> bool: + try: + from torch.utils._triton import has_triton as torch_has_triton + return torch_has_triton() + except Exception: + return False + + def get_backend(shared_cmd_opts): global args # pylint: disable=global-statement args = shared_cmd_opts diff --git a/modules/shared.py b/modules/shared.py index 6a852dc03..1b90c6573 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -550,7 +550,7 @@ options_templates.update(options_section(('quantization', "Quantization Settings "nncf_quantize_mode": OptionInfo("INT8", "OpenVINO activations mode", gr.Dropdown, {"choices": ['INT8', 'FP8_E4M3', 'FP8_E5M2'], "visible": cmd_opts.use_openvino}), "nncf_quantize_conv_layers": OptionInfo(False, "Quantize the convolutional layers", gr.Checkbox, {"visible": native}), "nncf_decompress_fp32": OptionInfo(False, "Decompress using full precision", gr.Checkbox, {"visible": native}), - "nncf_decompress_compile": OptionInfo(False, "Decompress using torch.compile", gr.Checkbox, {"visible": native}), + "nncf_decompress_compile": OptionInfo(devices.has_triton(), "Decompress using torch.compile", gr.Checkbox, {"visible": native}), "nncf_quantize_shuffle_weights": OptionInfo(False, "Shuffle weights in post mode", gr.Checkbox, {"visible": native}), "layerwise_quantization_sep": OptionInfo("

Layerwise Casting

", "", gr.HTML),