SDNQ disable FP8 MM on dynamic quant with unsupported GPUs

This commit is contained in:
Disty0
2026-04-15 23:28:20 +03:00
parent 202f12ea6c
commit 8a1743712a
2 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import json
import torch
from diffusers.models.modeling_utils import ModelMixin
from .common import dtype_dict, use_tensorwise_fp8_matmul, is_fp8_mm_supported, check_torch_compile, conv_types, linear_types
from modules import dtype_dict, is_fp8_mm_supported, use_tensorwise_fp8_matmul, check_torch_compile, conv_types, linear_types
from .quantizer import SDNQConfig, sdnq_post_load_quant, prepare_weight_for_matmul, prepare_svd_for_matmul, get_quant_args_from_config
from .forward import get_forward_func
from .file_loader import load_files
+9 -3
View File
@@ -15,7 +15,7 @@ from diffusers.utils import get_module_from_name
from accelerate import init_empty_weights
from modules import devices, shared
from .common import sdnq_version, dtype_dict, common_skip_keys, module_skip_keys_dict, accepted_weight_dtypes, accepted_matmul_dtypes, weights_dtype_order, allowed_types, linear_types, embedding_types, conv_types, conv_transpose_types, compile_func, use_tensorwise_fp8_matmul, use_contiguous_mm, check_torch_compile
from .common import sdnq_version, dtype_dict, common_skip_keys, module_skip_keys_dict, accepted_weight_dtypes, accepted_matmul_dtypes, weights_dtype_order, allowed_types, linear_types, embedding_types, conv_types, conv_transpose_types, compile_func, is_fp8_mm_supported, use_tensorwise_fp8_matmul, use_contiguous_mm, check_torch_compile
from .dequantizer import SDNQDequantizer, dequantize_sdnq_model
from .packed_int import pack_int
from .packed_float import pack_float
@@ -437,10 +437,16 @@ def sdnq_quantize_layer_weight_dynamic(weight, layer_class_name=None, weights_dt
quantization_loss = None
svd_is_transposed = False
for i in range(weights_dtype_order.index(weights_dtype), len(weights_dtype_order)):
current_weights_dtype = weights_dtype_order[i]
if quantized_matmul_dtype is None and not is_fp8_mm_supported and not dtype_dict[current_weights_dtype]["is_integer"] and dtype_dict[current_weights_dtype]["num_bits"] < 16:
current_use_quantized_matmul = False
else:
current_use_quantized_matmul = use_quantized_matmul
quantized_weight, scale, zero_point, _, _, sdnq_dequantizer = sdnq_quantize_layer_weight(
svd_weight,
layer_class_name=layer_class_name,
weights_dtype=weights_dtype_order[i],
weights_dtype=current_weights_dtype,
quantized_matmul_dtype=quantized_matmul_dtype,
torch_dtype=torch_dtype,
group_size=group_size,
@@ -448,7 +454,7 @@ def sdnq_quantize_layer_weight_dynamic(weight, layer_class_name=None, weights_dt
svd_steps=svd_steps,
use_svd=False,
using_pre_calculated_svd=use_svd,
use_quantized_matmul=use_quantized_matmul,
use_quantized_matmul=current_use_quantized_matmul,
use_stochastic_rounding=use_stochastic_rounding,
dequantize_fp32=dequantize_fp32,
param_name=param_name,